diff --git a/Jakefile.js b/Jakefile.js index 52df2d15e4771..e9b1d0c9e1714 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -141,7 +141,10 @@ var harnessSources = harnessCoreSources.concat([ "session.ts", "versionCache.ts", "convertToBase64.ts", - "transpile.ts" + "transpile.ts", + "reuseProgramStructure.ts", + "cachingInServerLSHost.ts", + "moduleResolution.ts" ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ @@ -155,10 +158,10 @@ var harnessSources = harnessCoreSources.concat([ var librarySourceMap = [ { target: "lib.core.d.ts", sources: ["core.d.ts"] }, - { target: "lib.dom.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts"], }, - { target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "extensions.d.ts", "intl.d.ts", "webworker.generated.d.ts"], }, + { target: "lib.dom.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "dom.generated.d.ts"], }, + { target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "webworker.generated.d.ts"], }, { target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], }, - { target: "lib.d.ts", sources: ["core.d.ts", "extensions.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], }, + { target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], }, { target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]}, { target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }, ]; @@ -765,6 +768,8 @@ desc("Updates the sublime plugin's tsserver"); task("update-sublime", ["local", serverFile], function() { jake.cpR(serverFile, "../TypeScript-Sublime-Plugin/tsserver/"); jake.cpR(serverFile + ".map", "../TypeScript-Sublime-Plugin/tsserver/"); + jake.cpR(path.join(builtLocalDirectory, "lib.d.ts"), "../TypeScript-Sublime-Plugin/tsserver/"); + jake.cpR(path.join(builtLocalDirectory, "lib.es6.d.ts"), "../TypeScript-Sublime-Plugin/tsserver/"); }); // if the codebase were free of linter errors we could make jake runtests diff --git a/README.md b/README.md index c8bc5936c2488..c474f62fb4c5a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [twitter account](https://twitter.com/typescriptlang). +[TypeScript](http://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](http://www.typescriptlang.org/Playground), and stay up to date via [our blog](http://blogs.msdn.com/typescript) and [Twitter account](https://twitter.com/typescriptlang). ## Installing diff --git a/lib/lib.core.d.ts b/lib/lib.core.d.ts index a265b5c2a95f8..b588c9fdb77ee 100644 --- a/lib/lib.core.d.ts +++ b/lib/lib.core.d.ts @@ -331,31 +331,31 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A function that returns the replacement text. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: RegExp, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A function that returns the replacement text. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; /** * Finds the first substring match in a regular expression search. @@ -986,14 +986,14 @@ interface JSON { * @param replacer A function that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; + stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer Array that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: any[], space: any): string; + stringify(value: any, replacer: any[], space: string | number): string; } /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. @@ -1196,4 +1196,2645 @@ interface PromiseLike { */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} +} + +interface ArrayLike { + length: number; + [n: number]: T; +} + + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): boolean; +} +declare var ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int8Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int8Array; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + +} +declare var Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8Array; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + +} +declare var Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8ClampedArray; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int16Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int16Array; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare var Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint16Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint16Array; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + +} +declare var Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int32Array; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare var Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint32Array; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare var Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float32Array; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + +} +declare var Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float64Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float64Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float64Array; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare var Float64Array: Float64ArrayConstructor; diff --git a/lib/lib.core.es6.d.ts b/lib/lib.core.es6.d.ts index 48d02ec146555..fd115497f8a2b 100644 --- a/lib/lib.core.es6.d.ts +++ b/lib/lib.core.es6.d.ts @@ -331,31 +331,31 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A function that returns the replacement text. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: RegExp, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A function that returns the replacement text. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; /** * Finds the first substring match in a regular expression search. @@ -986,14 +986,14 @@ interface JSON { * @param replacer A function that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; + stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer Array that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: any[], space: any): string; + stringify(value: any, replacer: any[], space: string | number): string; } /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. @@ -1196,280 +1196,253 @@ interface PromiseLike { */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - [Symbol.toStringTag]: string; } -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - prototype: Symbol; +interface ArrayLike { + length: number; + [n: number]: T; +} - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { /** - * 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. + * Read-only. The length of the ArrayBuffer (in bytes). */ - for(key: string): symbol; + byteLength: number; /** - * 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. + * Returns a section of an ArrayBuffer. */ - keyFor(sym: symbol): string; + slice(begin:number, end?:number): ArrayBuffer; +} - // Well-known Symbols +interface ArrayBufferConstructor { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): boolean; +} +declare var ArrayBuffer: ArrayBufferConstructor; - /** - * 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. +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. */ - hasInstance: symbol; + buffer: ArrayBuffer; - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. + /** + * The length in bytes of the array. */ - isConcatSpreadable: symbol; + byteLength: number; - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. + /** + * The offset in bytes of the array. */ - iterator: symbol; + byteOffset: number; +} +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - match: symbol; + getFloat32(byteOffset: number, littleEndian?: boolean): number; - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - replace: symbol; + getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - search: symbol; + getInt8(byteOffset: number): number; - /** - * A function valued property that is the constructor function that is used to create - * derived objects. + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - species: symbol; - + getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - split: symbol; + getInt32(byteOffset: number, littleEndian?: boolean): number; - /** - * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive - * abstract operation. + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - toPrimitive: symbol; + getUint8(byteOffset: number): number; - /** - * 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. + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - toStringTag: symbol; + getUint16(byteOffset: number, littleEndian?: boolean): number; - /** - * An Object whose own property names are property names that are excluded from the with - * environment bindings of the associated objects. + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - unscopables: symbol; -} -declare var Symbol: SymbolConstructor; + getUint32(byteOffset: number, littleEndian?: boolean): number; -interface Object { /** - * Determines whether an object has a property with the specified name. - * @param v A property name. + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - hasOwnProperty(v: PropertyKey): boolean; + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - /** - * Determines whether a specified property is enumerable. - * @param v A property name. + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - propertyIsEnumerable(v: PropertyKey): boolean; -} + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; -interface ObjectConstructor { /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. */ - assign(target: any, ...sources: any[]): any; + setInt8(byteOffset: number, value: number): void; /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - getOwnPropertySymbols(o: any): symbol[]; + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - is(value1: any, value2: any): boolean; + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. */ - setPrototypeOf(o: any, proto: any): any; + setUint8(byteOffset: number, value: number): void; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; } -interface Function { - /** - * Returns a new function object that is identical to the argument object in all ways except - * for its identity and the value of its HomeObject internal slot. - */ - toMethod(newHome: Object): Function; +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { /** - * Returns the name of the function. Function names are read-only and can not be changed. + * The size in bytes of each element in the array. */ - name: string; -} + BYTES_PER_ELEMENT: number; -interface NumberConstructor { /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. + * The ArrayBuffer instance referenced by the array. */ - EPSILON: number; + buffer: ArrayBuffer; /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. + * The length in bytes of the array. */ - isFinite(number: number): boolean; + byteLength: number; /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. + * The offset in bytes of the array. */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - MAX_SAFE_INTEGER: number; + byteOffset: number; /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. */ - MIN_SAFE_INTEGER: number; + copyWithin(target: number, start: number, end?: number): Int8Array; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - parseFloat(string: string): number; + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface ArrayLike { - length: number; - [n: number]: T; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int8Array; - /** - * Returns an list of values in the array + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - values(): IterableIterator; + filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -1480,7 +1453,7 @@ interface Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -1491,660 +1464,492 @@ interface Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; -interface ArrayConstructor { /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + indexOf(searchElement: number, fromIndex?: number): number; /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + join(separator?: string): string; /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. */ - from(arrayLike: ArrayLike): Array; + lastIndexOf(searchElement: number, fromIndex?: number): number; /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. + * The length of the array. */ - from(iterable: Iterable): Array; + length: number; /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - codePointAt(pos: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - contains(searchString: string, position?: number): boolean; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. */ - endsWith(searchString: string, endPosition?: number): boolean; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - normalize(form?: string): string; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append + * Reverses the elements in an Array. */ - repeat(count: number): string; + reverse(): Int8Array; /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. */ - startsWith(searchString: string, position?: number): boolean; + set(index: number, value: number): void; /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. */ - anchor(name: string): string; + set(array: ArrayLike, offset?: number): void; - /** Returns a HTML element */ - big(): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; -interface StringConstructor { /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. */ - fromCodePoint(...codePoints: number[]): string; + sort(compareFn?: (a: number, b: number) => number): Int8Array; /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} + subarray(begin: number, end?: number): Int8Array; -interface IteratorResult { - done: boolean; - value?: T; -} + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} + /** + * Returns a string representation of an array. + */ + toString(): string; -interface Iterable { - [Symbol.iterator](): Iterator; + [index: number]: number; } +interface Int8ArrayConstructor { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; -interface GeneratorFunction extends Function { + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } +declare var Int8Array: Int8ArrayConstructor; -interface GeneratorFunctionConstructor { +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. + * The size in bytes of each element in the array. */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; + BYTES_PER_ELEMENT: number; -interface Math { /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. + * The ArrayBuffer instance referenced by the array. */ - clz32(x: number): number; + buffer: ArrayBuffer; /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number + * The length in bytes of the array. */ - imul(x: number, y: number): number; + byteLength: number; /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test + * The offset in bytes of the array. */ - sign(x: number): number; + byteOffset: number; - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. */ - log10(x: number): number; + copyWithin(target: number, start: number, end?: number): Uint8Array; /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - log2(x: number): number; + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8Array; /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - expm1(x: number): number; + filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. */ - cosh(x: number): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. */ - sinh(x: number): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - tanh(x: number): number; + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. */ - acosh(x: number): number; + indexOf(searchElement: number, fromIndex?: number): number; /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. */ - asinh(x: number): number; + join(separator?: string): string; /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. */ - atanh(x: number): number; + lastIndexOf(searchElement: number, fromIndex?: number): number; /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. + * The length of the array. */ - hypot(...values: number[] ): number; + length: number; /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - trunc(x: number): number; + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - fround(x: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - cbrt(x: number): number; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - [Symbol.toStringTag]: string; -} + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; -interface RegExp { /** - * Matches a string with a regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - match(string: string): string[]; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Replaces text in a string, using a regular expression. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of rgExp in stringObj. + * Reverses the elements in an Array. */ - replace(string: string, replaceValue: string): string; - - search(string: string): number; + reverse(): Uint8Array; /** - * Returns an Array object into which substrings of the result of converting string to a String - * have been stored. The substrings are determined by searching from left to right for matches - * of the this value regular expression; these occurrences are not part of any substring in the - * returned array, but serve to divide up the String value. - * - * If the regular expression that contains capturing parentheses, then each time separator is - * matched the results (including any undefined results) of the capturing parentheses are spliced. - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than limit elements. + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. */ - split(string: string, limit?: number): string[]; + set(index: number, value: number): void; /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. */ - flags: string; + set(array: ArrayLike, offset?: number): void; /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. */ - sticky: boolean; + slice(start?: number, end?: number): Uint8Array; - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - unicode: boolean; -} + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - [Symbol.toStringTag]: string; -} + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8Array; -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - prototype: Map; -} -declare var Map: MapConstructor; + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - [Symbol.toStringTag]: string; -} + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; + /** + * Returns a string representation of an array. + */ + toString(): string; -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - [Symbol.toStringTag]: string; + [index: number]: number; } -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - prototype: Set; -} -declare var Set: SetConstructor; +interface Uint8ArrayConstructor { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - [Symbol.toStringTag]: string; -} + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -interface JSON { - [Symbol.toStringTag]: string; } +declare var Uint8Array: Uint8ArrayConstructor; /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. */ -interface ArrayBuffer { +interface Uint8ClampedArray { /** - * Read-only. The length of the ArrayBuffer (in bytes). + * The size in bytes of each element in the array. */ - byteLength: number; + BYTES_PER_ELEMENT: number; /** - * Returns a section of an ArrayBuffer. + * The ArrayBuffer instance referenced by the array. */ - slice(begin: number, end?: number): ArrayBuffer; - - [Symbol.toStringTag]: string; -} - -interface ArrayBufferConstructor { - prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): boolean; -} -declare var ArrayBuffer: ArrayBufferConstructor; - -interface DataView { buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; + /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. + * The length in bytes of the array. */ - getFloat32(byteOffset: number, littleEndian: boolean): number; + byteLength: number; /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. + * The offset in bytes of the array. */ - getFloat64(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - - [Symbol.toStringTag]: string; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare var DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; + byteOffset: number; /** * Returns the this object after copying a section of the array identified by start and end @@ -2155,12 +1960,7 @@ interface Int8Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; /** * Determines whether all the members of an array satisfy the specified test. @@ -2170,7 +1970,7 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -2180,7 +1980,7 @@ interface Int8Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int8Array; + fill(value: number, start?: number, end?: number): Uint8ClampedArray; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -2189,7 +1989,7 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -2220,7 +2020,7 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -2237,11 +2037,6 @@ interface Int8Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -2263,7 +2058,7 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2275,7 +2070,7 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2287,7 +2082,7 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2299,7 +2094,7 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2311,12 +2106,12 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Int8Array; + reverse(): Uint8ClampedArray; /** * Sets a value or an array of values. @@ -2330,14 +2125,14 @@ interface Int8Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int8Array, offset?: number): void; + set(array: Uint8ClampedArray, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Int8Array; + slice(start?: number, end?: number): Uint8ClampedArray; /** * Determines whether the specified callback function returns true for any element of an array. @@ -2347,22 +2142,22 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Int8Array; + subarray(begin: number, end?: number): Uint8ClampedArray; /** * Converts a number to a string by using the current locale. @@ -2374,21 +2169,14 @@ interface Int8Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Int8ArrayConstructor { - prototype: Int8Array; - new (length: number): Int8Array; - new (array: Int8Array): Int8Array; - new (array: number[]): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** * The size in bytes of each element in the array. @@ -2399,7 +2187,7 @@ interface Int8ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Int8Array; + of(...items: number[]): Uint8ClampedArray; /** * Creates an array from an array-like or iterable object. @@ -2407,15 +2195,15 @@ interface Int8ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } -declare var Int8Array: Int8ArrayConstructor; +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ -interface Uint8Array { +interface Int16Array { /** * The size in bytes of each element in the array. */ @@ -2445,12 +2233,7 @@ interface Uint8Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Int16Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -2460,7 +2243,7 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -2470,7 +2253,7 @@ interface Uint8Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8Array; + fill(value: number, start?: number, end?: number): Int16Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -2479,7 +2262,7 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -2510,7 +2293,7 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -2527,11 +2310,6 @@ interface Uint8Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -2553,7 +2331,7 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2565,7 +2343,7 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2577,7 +2355,7 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2589,7 +2367,7 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2601,12 +2379,12 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Uint8Array; + reverse(): Int16Array; /** * Sets a value or an array of values. @@ -2620,14 +2398,14 @@ interface Uint8Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint8Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Uint8Array; + slice(start?: number, end?: number): Int16Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -2637,22 +2415,22 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; + sort(compareFn?: (a: number, b: number) => number): Int16Array; /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Uint8Array; + subarray(begin: number, end?: number): Int16Array; /** * Converts a number to a string by using the current locale. @@ -2664,21 +2442,14 @@ interface Uint8Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Uint8ArrayConstructor { - prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: Uint8Array): Uint8Array; - new (array: number[]): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; +interface Int16ArrayConstructor { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** * The size in bytes of each element in the array. @@ -2689,23 +2460,24 @@ interface Uint8ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Uint8Array; - + of(...items: number[]): Int16Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} -declare var Uint8Array: Uint8ArrayConstructor; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare var Int16Array: Int16ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. */ -interface Uint8ClampedArray { +interface Uint16Array { /** * The size in bytes of each element in the array. */ @@ -2735,12 +2507,7 @@ interface Uint8ClampedArray { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Uint16Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -2750,7 +2517,7 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -2760,7 +2527,7 @@ interface Uint8ClampedArray { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; + fill(value: number, start?: number, end?: number): Uint16Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -2769,7 +2536,7 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -2800,7 +2567,7 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -2817,11 +2584,6 @@ interface Uint8ClampedArray { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -2843,7 +2605,7 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2855,7 +2617,7 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2867,7 +2629,7 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2879,7 +2641,7 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2891,12 +2653,12 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Uint8ClampedArray; + reverse(): Uint16Array; /** * Sets a value or an array of values. @@ -2910,14 +2672,14 @@ interface Uint8ClampedArray { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint8ClampedArray, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Uint8ClampedArray; + slice(start?: number, end?: number): Uint16Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -2927,22 +2689,22 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + sort(compareFn?: (a: number, b: number) => number): Uint16Array; /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Uint8ClampedArray; + subarray(begin: number, end?: number): Uint16Array; /** * Converts a number to a string by using the current locale. @@ -2954,21 +2716,14 @@ interface Uint8ClampedArray { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Uint8ClampedArrayConstructor { - prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: Uint8ClampedArray): Uint8ClampedArray; - new (array: number[]): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; +interface Uint16ArrayConstructor { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** * The size in bytes of each element in the array. @@ -2979,23 +2734,23 @@ interface Uint8ClampedArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Uint8ClampedArray; - + of(...items: number[]): Uint16Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} +declare var Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ -interface Int16Array { +interface Int32Array { /** * The size in bytes of each element in the array. */ @@ -3025,12 +2780,7 @@ interface Int16Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Int32Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -3040,7 +2790,7 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -3050,7 +2800,7 @@ interface Int16Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int16Array; + fill(value: number, start?: number, end?: number): Int32Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -3059,7 +2809,7 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -3090,7 +2840,7 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3107,11 +2857,6 @@ interface Int16Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -3133,7 +2878,7 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3145,7 +2890,7 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3157,7 +2902,7 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3169,7 +2914,7 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3181,12 +2926,12 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Int16Array; + reverse(): Int32Array; /** * Sets a value or an array of values. @@ -3200,14 +2945,14 @@ interface Int16Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int16Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Int16Array; + slice(start?: number, end?: number): Int32Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -3217,22 +2962,22 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; + sort(compareFn?: (a: number, b: number) => number): Int32Array; /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Int16Array; + subarray(begin: number, end?: number): Int32Array; /** * Converts a number to a string by using the current locale. @@ -3244,21 +2989,14 @@ interface Int16Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Int16ArrayConstructor { - prototype: Int16Array; - new (length: number): Int16Array; - new (array: Int16Array): Int16Array; - new (array: number[]): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; +interface Int32ArrayConstructor { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** * The size in bytes of each element in the array. @@ -3269,23 +3007,23 @@ interface Int16ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Int16Array; - + of(...items: number[]): Int32Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } -declare var Int16Array: Int16ArrayConstructor; +declare var Int32Array: Int32ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ -interface Uint16Array { +interface Uint32Array { /** * The size in bytes of each element in the array. */ @@ -3315,12 +3053,7 @@ interface Uint16Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Uint32Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -3330,7 +3063,7 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -3340,7 +3073,7 @@ interface Uint16Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint16Array; + fill(value: number, start?: number, end?: number): Uint32Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -3349,7 +3082,7 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -3380,7 +3113,7 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3397,11 +3130,6 @@ interface Uint16Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -3423,7 +3151,7 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3435,7 +3163,7 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3447,7 +3175,7 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3459,7 +3187,7 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3471,12 +3199,12 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Uint16Array; + reverse(): Uint32Array; /** * Sets a value or an array of values. @@ -3490,14 +3218,14 @@ interface Uint16Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint16Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Uint16Array; + slice(start?: number, end?: number): Uint32Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -3507,22 +3235,22 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; + sort(compareFn?: (a: number, b: number) => number): Uint32Array; /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Uint16Array; + subarray(begin: number, end?: number): Uint32Array; /** * Converts a number to a string by using the current locale. @@ -3534,21 +3262,14 @@ interface Uint16Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Uint16ArrayConstructor { - prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: Uint16Array): Uint16Array; - new (array: number[]): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; +interface Uint32ArrayConstructor { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** * The size in bytes of each element in the array. @@ -3559,23 +3280,23 @@ interface Uint16ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Uint16Array; - + of(...items: number[]): Uint32Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } -declare var Uint16Array: Uint16ArrayConstructor; +declare var Uint32Array: Uint32ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. */ -interface Int32Array { +interface Float32Array { /** * The size in bytes of each element in the array. */ @@ -3605,12 +3326,7 @@ interface Int32Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Float32Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -3620,7 +3336,7 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -3630,7 +3346,7 @@ interface Int32Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int32Array; + fill(value: number, start?: number, end?: number): Float32Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -3639,7 +3355,7 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -3670,7 +3386,7 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3687,11 +3403,6 @@ interface Int32Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -3713,7 +3424,7 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3725,7 +3436,7 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3737,7 +3448,7 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3749,7 +3460,7 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3761,12 +3472,12 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Int32Array; + reverse(): Float32Array; /** * Sets a value or an array of values. @@ -3780,14 +3491,14 @@ interface Int32Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int32Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Int32Array; + slice(start?: number, end?: number): Float32Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -3797,22 +3508,22 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; + sort(compareFn?: (a: number, b: number) => number): Float32Array; /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Int32Array; + subarray(begin: number, end?: number): Float32Array; /** * Converts a number to a string by using the current locale. @@ -3824,21 +3535,14 @@ interface Int32Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Int32ArrayConstructor { - prototype: Int32Array; - new (length: number): Int32Array; - new (array: Int32Array): Int32Array; - new (array: number[]): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; +interface Float32ArrayConstructor { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** * The size in bytes of each element in the array. @@ -3849,23 +3553,24 @@ interface Int32ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Int32Array; - + of(...items: number[]): Float32Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + } -declare var Int32Array: Int32ArrayConstructor; +declare var Float32Array: Float32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. */ -interface Uint32Array { +interface Float64Array { /** * The size in bytes of each element in the array. */ @@ -3895,12 +3600,7 @@ interface Uint32Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Float64Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -3910,7 +3610,7 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -3920,7 +3620,7 @@ interface Uint32Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint32Array; + fill(value: number, start?: number, end?: number): Float64Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -3929,7 +3629,7 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -3960,7 +3660,7 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3977,11 +3677,6 @@ interface Uint32Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -4003,7 +3698,7 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -4015,7 +3710,7 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -4027,7 +3722,7 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -4039,7 +3734,7 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -4051,12 +3746,12 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Uint32Array; + reverse(): Float64Array; /** * Sets a value or an array of values. @@ -4070,14 +3765,14 @@ interface Uint32Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint32Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Uint32Array; + slice(start?: number, end?: number): Float64Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -4087,22 +3782,22 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; + sort(compareFn?: (a: number, b: number) => number): Float64Array; /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Uint32Array; + subarray(begin: number, end?: number): Float64Array; /** * Converts a number to a string by using the current locale. @@ -4114,21 +3809,14 @@ interface Uint32Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Uint32ArrayConstructor { - prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: Uint32Array): Uint32Array; - new (array: number[]): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; +interface Float64ArrayConstructor { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** * The size in bytes of each element in the array. @@ -4139,377 +3827,302 @@ interface Uint32ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Uint32Array; - + of(...items: number[]): Float64Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Uint32Array: Uint32ArrayConstructor; +declare var Float64Array: Float64ArrayConstructor; +declare type PropertyKey = string | number | symbol; -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + [Symbol.toStringTag]: string; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. */ - BYTES_PER_ELEMENT: number; + prototype: Symbol; /** - * The ArrayBuffer instance referenced by the array. + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. */ - buffer: ArrayBuffer; + (description?: string|number): symbol; /** - * The length in bytes of the array. + * 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. */ - byteLength: number; + for(key: string): symbol; /** - * The offset in bytes of the array. + * 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. */ - byteOffset: number; + keyFor(sym: symbol): string; + + // Well-known Symbols /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * 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. */ - copyWithin(target: number, start: number, end?: number): Float32Array; + hasInstance: symbol; /** - * Returns an array of key, value pairs for every entry in the array + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. */ - entries(): IterableIterator<[number, number]>; + isConcatSpreadable: symbol; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + iterator: symbol; /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + replace: symbol; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + search: symbol; /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * A function valued property that is the constructor function that is used to create + * derived objects. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + split: symbol; /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + toPrimitive: symbol; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + /** + * 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. */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + toStringTag: symbol; /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. */ - indexOf(searchElement: number, fromIndex?: number): number; + unscopables: symbol; +} +declare var Symbol: SymbolConstructor; +interface Object { /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. + * Determines whether an object has a property with the specified name. + * @param v A property name. */ - join(separator?: string): string; + hasOwnProperty(v: PropertyKey): boolean; /** - * Returns an list of keys in the array + * Determines whether a specified property is enumerable. + * @param v A property name. */ - keys(): IterableIterator; + propertyIsEnumerable(v: PropertyKey): boolean; +} +interface ObjectConstructor { /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. */ - lastIndexOf(searchElement: number, fromIndex?: number): number; + assign(target: any, ...sources: any[]): any; /** - * The length of the array. + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. */ - length: number; + getOwnPropertySymbols(o: any): symbol[]; /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + is(value1: any, value2: any): boolean; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + setPrototypeOf(o: any, proto: any): any; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; /** - * Reverses the elements in an Array. + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. */ - reverse(): Float32Array; + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} +interface Function { /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. + * Returns the name of the function. Function names are read-only and can not be changed. */ - set(index: number, value: number): void; + name: string; /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Float32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} +interface NumberConstructor { /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + EPSILON: number; /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; + isFinite(number: number): boolean; /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. */ - subarray(begin: number, end?: number): Float32Array; + isInteger(number: number): boolean; /** - * Converts a number to a string by using the current locale. + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. */ - toLocaleString(): string; + isNaN(number: number): boolean; /** - * Returns a string representation of an array. + * Returns true if the value passed is a safe integer. + * @param number A numeric value. */ - toString(): string; + isSafeInteger(number: number): boolean; /** - * Returns an list of values in the array + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. */ - values(): IterableIterator; - - [index: number]: number; - [Symbol.iterator](): IterableIterator; -} - -interface Float32ArrayConstructor { - prototype: Float32Array; - new (length: number): Float32Array; - new (array: Float32Array): Float32Array; - new (array: number[]): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + MAX_SAFE_INTEGER: number; - /** - * The size in bytes of each element in the array. + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). */ - BYTES_PER_ELEMENT: number; + MIN_SAFE_INTEGER: number; /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. */ - of(...items: number[]): Float32Array; + parseFloat(string: string): number; /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + parseInt(string: string, radix?: number): number; } -declare var Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - /** - * The length in bytes of the array. - */ - byteLength: number; +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; /** * Returns an array of key, value pairs for every entry in the array */ - entries(): IterableIterator<[number, number]>; + entries(): IterableIterator<[number, T]>; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + /** + * Returns an list of keys in the array */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; + keys(): IterableIterator; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + /** + * Returns an list of values in the array */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + values(): IterableIterator; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -4520,7 +4133,7 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -4531,195 +4144,852 @@ interface Float64Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + // Overloads for objects with methods of well-known symbols. + + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface GeneratorFunction extends Function { + +} + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; + + [Symbol.toStringTag]: string; +} +interface Date { /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. */ - indexOf(searchElement: number, fromIndex?: number): number; + [Symbol.match](string: string): RegExpMatchArray; /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; + + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + unicode: boolean; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface Map { + clear(): void; + delete(key: K): boolean; + entries(): IterableIterator<[K, V]>; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + keys(): IterableIterator; + set(key: K, value?: V): Map; + size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator<[K,V]>; + [Symbol.toStringTag]: string; +} + +interface MapConstructor { + new (): Map; + new (): Map; + new (iterable: Iterable<[K, V]>): Map; + prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; + [Symbol.toStringTag]: string; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; + prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + entries(): IterableIterator<[T, T]>; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + keys(): IterableIterator; + size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator; + [Symbol.toStringTag]: string; +} + +interface SetConstructor { + new (): Set; + new (): Set; + new (iterable: Iterable): Set; + prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): WeakSet; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; + [Symbol.toStringTag]: string; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (): WeakSet; + new (iterable: Iterable): WeakSet; + prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; + +interface JSON { + [Symbol.toStringTag]: string; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + [Symbol.toStringTag]: string; +} + +interface DataView { + [Symbol.toStringTag]: string; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + + [Symbol.iterator](): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - join(separator?: string): string; + entries(): IterableIterator<[number, number]>; /** * Returns an list of keys in the array */ keys(): IterableIterator; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. + /** + * Returns an list of values in the array */ - lastIndexOf(searchElement: number, fromIndex?: number): number; + values(): IterableIterator; - /** - * The length of the array. - */ - length: number; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + [Symbol.iterator](): IterableIterator; +} - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. + * Returns an array of key, value pairs for every entry in the array */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - + entries(): IterableIterator<[number, number]>; /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Returns an list of keys in the array */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. + keys(): IterableIterator; + /** + * Returns an list of values in the array */ - reverse(): Float64Array; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - set(array: Float64Array, offset?: number): void; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. + * Returns an array of key, value pairs for every entry in the array */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. + keys(): IterableIterator; + /** + * Returns an list of values in the array */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - subarray(begin: number, end?: number): Float64Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} - /** - * Converts a number to a string by using the current locale. +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - toLocaleString(): string; + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; /** - * Returns a string representation of an array. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - toString(): string; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; /** * Returns an list of values in the array */ values(): IterableIterator; - - [index: number]: number; [Symbol.iterator](): IterableIterator; } -interface Float64ArrayConstructor { - prototype: Float64Array; - new (length: number): Float64Array; - new (array: Float64Array): Float64Array; - new (array: number[]): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; /** - * The size in bytes of each element in the array. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - BYTES_PER_ELEMENT: number; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - of(...items: number[]): Float64Array; + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; /** * Creates an array from an array-like or iterable object. @@ -4727,9 +4997,8 @@ interface Float64ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Float64Array: Float64ArrayConstructor; interface ProxyHandler { getPrototypeOf? (target: T): any; @@ -4754,9 +5023,9 @@ interface ProxyConstructor { } declare var Proxy: ProxyConstructor; -declare module Reflect { +declare namespace Reflect { function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; function deleteProperty(target: any, propertyKey: PropertyKey): boolean; function enumerate(target: any): IterableIterator; @@ -4857,20 +5126,3 @@ interface PromiseConstructor { } declare var Promise: PromiseConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} \ No newline at end of file diff --git a/lib/lib.d.ts b/lib/lib.d.ts index 430d8279de43c..7a411e002fa3e 100644 --- a/lib/lib.d.ts +++ b/lib/lib.d.ts @@ -331,31 +331,31 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A function that returns the replacement text. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: RegExp, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A function that returns the replacement text. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; /** * Finds the first substring match in a regular expression search. @@ -986,14 +986,14 @@ interface JSON { * @param replacer A function that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; + stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer Array that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: any[], space: any): string; + stringify(value: any, replacer: any[], space: string | number): string; } /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. @@ -1196,11 +1196,13 @@ interface PromiseLike { */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} +} + +interface ArrayLike { + length: number; + [n: number]: T; +} -///////////////////////////// -/// IE10 ECMAScript Extensions -///////////////////////////// /** * Represents a raw buffer of binary data, which is used to store data for the @@ -1253,14 +1255,14 @@ interface DataView { * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ - getFloat32(byteOffset: number, littleEndian: boolean): number; + getFloat32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Float64 value at the specified byte offset from the start of the view. There is * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ - getFloat64(byteOffset: number, littleEndian: boolean): number; + getFloat64(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Int8 value at the specified byte offset from the start of the view. There is @@ -1274,13 +1276,13 @@ interface DataView { * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ - getInt16(byteOffset: number, littleEndian: boolean): number; + getInt16(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Int32 value at the specified byte offset from the start of the view. There is * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ - getInt32(byteOffset: number, littleEndian: boolean): number; + getInt32(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Uint8 value at the specified byte offset from the start of the view. There is @@ -1294,14 +1296,14 @@ interface DataView { * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ - getUint16(byteOffset: number, littleEndian: boolean): number; + getUint16(byteOffset: number, littleEndian?: boolean): number; /** * Gets the Uint32 value at the specified byte offset from the start of the view. There is * no alignment constraint; multi-byte values may be fetched from any offset. * @param byteOffset The place in the buffer at which the value should be retrieved. */ - getUint32(byteOffset: number, littleEndian: boolean): number; + getUint32(byteOffset: number, littleEndian?: boolean): number; /** * Stores an Float32 value at the specified byte offset from the start of the view. @@ -1310,7 +1312,7 @@ interface DataView { * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ - setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Stores an Float64 value at the specified byte offset from the start of the view. @@ -1319,7 +1321,7 @@ interface DataView { * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ - setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Stores an Int8 value at the specified byte offset from the start of the view. @@ -1335,7 +1337,7 @@ interface DataView { * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ - setInt16(byteOffset: number, value: number, littleEndian: boolean): void; + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Stores an Int32 value at the specified byte offset from the start of the view. @@ -1344,7 +1346,7 @@ interface DataView { * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ - setInt32(byteOffset: number, value: number, littleEndian: boolean): void; + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Stores an Uint8 value at the specified byte offset from the start of the view. @@ -1360,7 +1362,7 @@ interface DataView { * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ - setUint16(byteOffset: number, value: number, littleEndian: boolean): void; + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** * Stores an Uint32 value at the specified byte offset from the start of the view. @@ -1369,7 +1371,7 @@ interface DataView { * @param littleEndian If false or undefined, a big-endian value should be written, * otherwise a little-endian value should be written. */ - setUint32(byteOffset: number, value: number, littleEndian: boolean): void; + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; } interface DataViewConstructor { @@ -1576,7 +1578,7 @@ interface Int8Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int8Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. @@ -1625,8 +1627,7 @@ interface Int8Array { interface Int8ArrayConstructor { prototype: Int8Array; new (length: number): Int8Array; - new (array: Int8Array): Int8Array; - new (array: number[]): Int8Array; + new (array: ArrayLike): Int8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; /** @@ -1639,6 +1640,15 @@ interface Int8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + } declare var Int8Array: Int8ArrayConstructor; @@ -1841,7 +1851,7 @@ interface Uint8Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint8Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. @@ -1891,8 +1901,7 @@ interface Uint8Array { interface Uint8ArrayConstructor { prototype: Uint8Array; new (length: number): Uint8Array; - new (array: Uint8Array): Uint8Array; - new (array: number[]): Uint8Array; + new (array: ArrayLike): Uint8Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; /** @@ -1905,9 +1914,291 @@ interface Uint8ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + } declare var Uint8Array: Uint8ArrayConstructor; +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8ClampedArray; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + /** * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. @@ -2107,7 +2398,7 @@ interface Int16Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int16Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. @@ -2157,8 +2448,7 @@ interface Int16Array { interface Int16ArrayConstructor { prototype: Int16Array; new (length: number): Int16Array; - new (array: Int16Array): Int16Array; - new (array: number[]): Int16Array; + new (array: ArrayLike): Int16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** @@ -2171,6 +2461,15 @@ interface Int16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + } declare var Int16Array: Int16ArrayConstructor; @@ -2373,7 +2672,7 @@ interface Uint16Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint16Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. @@ -2423,8 +2722,7 @@ interface Uint16Array { interface Uint16ArrayConstructor { prototype: Uint16Array; new (length: number): Uint16Array; - new (array: Uint16Array): Uint16Array; - new (array: number[]): Uint16Array; + new (array: ArrayLike): Uint16Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** @@ -2437,6 +2735,15 @@ interface Uint16ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + } declare var Uint16Array: Uint16ArrayConstructor; /** @@ -2638,7 +2945,7 @@ interface Int32Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int32Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. @@ -2688,8 +2995,7 @@ interface Int32Array { interface Int32ArrayConstructor { prototype: Int32Array; new (length: number): Int32Array; - new (array: Int32Array): Int32Array; - new (array: number[]): Int32Array; + new (array: ArrayLike): Int32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** @@ -2702,6 +3008,14 @@ interface Int32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } declare var Int32Array: Int32ArrayConstructor; @@ -2904,7 +3218,7 @@ interface Uint32Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint32Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. @@ -2954,8 +3268,7 @@ interface Uint32Array { interface Uint32ArrayConstructor { prototype: Uint32Array; new (length: number): Uint32Array; - new (array: Uint32Array): Uint32Array; - new (array: number[]): Uint32Array; + new (array: ArrayLike): Uint32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** @@ -2968,6 +3281,14 @@ interface Uint32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } declare var Uint32Array: Uint32ArrayConstructor; @@ -3170,7 +3491,7 @@ interface Float32Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Float32Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. @@ -3220,8 +3541,7 @@ interface Float32Array { interface Float32ArrayConstructor { prototype: Float32Array; new (length: number): Float32Array; - new (array: Float32Array): Float32Array; - new (array: number[]): Float32Array; + new (array: ArrayLike): Float32Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** @@ -3234,6 +3554,15 @@ interface Float32ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + } declare var Float32Array: Float32ArrayConstructor; @@ -3436,7 +3765,7 @@ interface Float64Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Float64Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. @@ -3486,8 +3815,7 @@ interface Float64Array { interface Float64ArrayConstructor { prototype: Float64Array; new (length: number): Float64Array; - new (array: Float64Array): Float64Array; - new (array: number[]): Float64Array; + new (array: ArrayLike): Float64Array; new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** @@ -3500,8 +3828,17 @@ interface Float64ArrayConstructor { * @param items A set of elements to include in the new array object. */ of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Float64Array: Float64ArrayConstructor;///////////////////////////// +declare var Float64Array: Float64ArrayConstructor; +///////////////////////////// /// ECMAScript Internationalization API ///////////////////////////// @@ -6135,7 +6472,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. * @param replace Specifies whether the existing entry for the document is replaced in the history list. */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document | Window; + open(url?: string, name?: string, features?: string, replace?: boolean): Document; /** * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. @@ -6706,7 +7043,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(): File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; } interface FileList { @@ -10541,7 +10878,7 @@ interface IDBDatabase extends EventTarget { createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -10662,7 +10999,7 @@ interface IDBTransaction extends EventTarget { READ_ONLY: string; READ_WRITE: string; VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -10692,11 +11029,14 @@ interface ImageData { width: number; } -declare var ImageData: { +interface ImageDataConstructor { prototype: ImageData; - new(): ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; } +declare var ImageData: ImageDataConstructor; + interface KeyboardEvent extends UIEvent { altKey: boolean; char: string; @@ -15638,7 +15978,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; opener: Window; - orientation: string; + orientation: string | number; outerHeight: number; outerWidth: number; pageXOffset: number; @@ -15845,7 +16185,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { LOADING: number; OPENED: number; UNSENT: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -16115,7 +16455,7 @@ interface MSBaseReader { DONE: number; EMPTY: number; LOADING: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -16271,7 +16611,7 @@ interface XMLHttpRequestEventTarget { onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; ontimeout: (ev: ProgressEvent) => any; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -16288,11 +16628,17 @@ interface NodeListOf extends NodeList { [index: number]: TNode; } + interface BlobPropertyBag { type?: string; endings?: string; } +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + interface EventListenerObject { handleEvent(evt: Event): void; } @@ -16453,7 +16799,7 @@ declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; declare var opener: Window; -declare var orientation: string; +declare var orientation: string | number; declare var outerHeight: number; declare var outerWidth: number; declare var pageXOffset: number; @@ -16628,7 +16974,8 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; + ///////////////////////////// /// WorkerGlobalScope APIs ///////////////////////////// diff --git a/lib/lib.dom.d.ts b/lib/lib.dom.d.ts index 5ec268b2fd578..896db2d55ef3f 100644 --- a/lib/lib.dom.d.ts +++ b/lib/lib.dom.d.ts @@ -14,2311 +14,7 @@ and limitations under the License. ***************************************************************************** */ /// - -///////////////////////////// -/// IE10 ECMAScript Extensions -///////////////////////////// - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): boolean; -} -declare var ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare var DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int8Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - prototype: Int8Array; - new (length: number): Int8Array; - new (array: Int8Array): Int8Array; - new (array: number[]): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; -} -declare var Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: Uint8Array): Uint8Array; - new (array: number[]): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; -} -declare var Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int16Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - prototype: Int16Array; - new (length: number): Int16Array; - new (array: Int16Array): Int16Array; - new (array: number[]): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; -} -declare var Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint16Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: Uint16Array): Uint16Array; - new (array: number[]): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; -} -declare var Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - prototype: Int32Array; - new (length: number): Int32Array; - new (array: Int32Array): Int32Array; - new (array: number[]): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; -} -declare var Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: Uint32Array): Uint32Array; - new (array: number[]): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; -} -declare var Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Float32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - prototype: Float32Array; - new (length: number): Float32Array; - new (array: Float32Array): Float32Array; - new (array: number[]): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; -} -declare var Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Float64Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - prototype: Float64Array; - new (length: number): Float64Array; - new (array: Float64Array): Float64Array; - new (array: number[]): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; -} -declare var Float64Array: Float64ArrayConstructor;///////////////////////////// +///////////////////////////// /// ECMAScript Internationalization API ///////////////////////////// @@ -4952,7 +2648,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. * @param replace Specifies whether the existing entry for the document is replaced in the history list. */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document | Window; + open(url?: string, name?: string, features?: string, replace?: boolean): Document; /** * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. @@ -5523,7 +3219,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(): File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; } interface FileList { @@ -9358,7 +7054,7 @@ interface IDBDatabase extends EventTarget { createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -9479,7 +7175,7 @@ interface IDBTransaction extends EventTarget { READ_ONLY: string; READ_WRITE: string; VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -9509,11 +7205,14 @@ interface ImageData { width: number; } -declare var ImageData: { +interface ImageDataConstructor { prototype: ImageData; - new(): ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; } +declare var ImageData: ImageDataConstructor; + interface KeyboardEvent extends UIEvent { altKey: boolean; char: string; @@ -14455,7 +12154,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; opener: Window; - orientation: string; + orientation: string | number; outerHeight: number; outerWidth: number; pageXOffset: number; @@ -14662,7 +12361,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { LOADING: number; OPENED: number; UNSENT: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -14932,7 +12631,7 @@ interface MSBaseReader { DONE: number; EMPTY: number; LOADING: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -15088,7 +12787,7 @@ interface XMLHttpRequestEventTarget { onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; ontimeout: (ev: ProgressEvent) => any; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -15105,11 +12804,17 @@ interface NodeListOf extends NodeList { [index: number]: TNode; } + interface BlobPropertyBag { type?: string; endings?: string; } +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + interface EventListenerObject { handleEvent(evt: Event): void; } @@ -15270,7 +12975,7 @@ declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; declare var opener: Window; -declare var orientation: string; +declare var orientation: string | number; declare var outerHeight: number; declare var outerWidth: number; declare var pageXOffset: number; @@ -15445,4 +13150,4 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; diff --git a/lib/lib.es6.d.ts b/lib/lib.es6.d.ts index 6c06cc08dc7de..02b89b3a2bab9 100644 --- a/lib/lib.es6.d.ts +++ b/lib/lib.es6.d.ts @@ -331,31 +331,31 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A function that returns the replacement text. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: RegExp, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A function that returns the replacement text. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; /** * Finds the first substring match in a regular expression search. @@ -986,14 +986,14 @@ interface JSON { * @param replacer A function that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: (key: string, value: any) => any, space: any): string; + stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; /** * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. * @param value A JavaScript value, usually an object or array, to be converted. * @param replacer Array that transforms the results. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. */ - stringify(value: any, replacer: any[], space: any): string; + stringify(value: any, replacer: any[], space: string | number): string; } /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. @@ -1196,280 +1196,253 @@ interface PromiseLike { */ then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; -} -declare type PropertyKey = string | number | symbol; - -interface Symbol { - /** Returns a string representation of an object. */ - toString(): string; - - /** Returns the primitive value of the specified object. */ - valueOf(): Object; - - [Symbol.toStringTag]: string; } -interface SymbolConstructor { - /** - * A reference to the prototype. - */ - prototype: Symbol; +interface ArrayLike { + length: number; + [n: number]: T; +} - /** - * Returns a new unique Symbol value. - * @param description Description of the new Symbol object. - */ - (description?: string|number): symbol; +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { /** - * 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. + * Read-only. The length of the ArrayBuffer (in bytes). */ - for(key: string): symbol; + byteLength: number; /** - * 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. + * Returns a section of an ArrayBuffer. */ - keyFor(sym: symbol): string; + slice(begin:number, end?:number): ArrayBuffer; +} - // Well-known Symbols +interface ArrayBufferConstructor { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): boolean; +} +declare var ArrayBuffer: ArrayBufferConstructor; - /** - * 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. +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. */ - hasInstance: symbol; + buffer: ArrayBuffer; - /** - * A Boolean value that if true indicates that an object should flatten to its array elements - * by Array.prototype.concat. + /** + * The length in bytes of the array. */ - isConcatSpreadable: symbol; + byteLength: number; - /** - * A method that returns the default iterator for an object. Called by the semantics of the - * for-of statement. + /** + * The offset in bytes of the array. */ - iterator: symbol; + byteOffset: number; +} +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; /** - * A regular expression method that matches the regular expression against a string. Called - * by the String.prototype.match method. + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - match: symbol; + getFloat32(byteOffset: number, littleEndian?: boolean): number; - /** - * A regular expression method that replaces matched substrings of a string. Called by the - * String.prototype.replace method. + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - replace: symbol; + getFloat64(byteOffset: number, littleEndian?: boolean): number; /** - * A regular expression method that returns the index within a string that matches the - * regular expression. Called by the String.prototype.search method. + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - search: symbol; + getInt8(byteOffset: number): number; - /** - * A function valued property that is the constructor function that is used to create - * derived objects. + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - species: symbol; - + getInt16(byteOffset: number, littleEndian?: boolean): number; /** - * A regular expression method that splits a string at the indices that match the regular - * expression. Called by the String.prototype.split method. + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - split: symbol; + getInt32(byteOffset: number, littleEndian?: boolean): number; - /** - * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive - * abstract operation. + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - toPrimitive: symbol; + getUint8(byteOffset: number): number; - /** - * 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. + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - toStringTag: symbol; + getUint16(byteOffset: number, littleEndian?: boolean): number; - /** - * An Object whose own property names are property names that are excluded from the with - * environment bindings of the associated objects. + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. */ - unscopables: symbol; -} -declare var Symbol: SymbolConstructor; + getUint32(byteOffset: number, littleEndian?: boolean): number; -interface Object { /** - * Determines whether an object has a property with the specified name. - * @param v A property name. + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - hasOwnProperty(v: PropertyKey): boolean; + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; - /** - * Determines whether a specified property is enumerable. - * @param v A property name. + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - propertyIsEnumerable(v: PropertyKey): boolean; -} + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; -interface ObjectConstructor { /** - * Copy the values of all of the enumerable own properties from one or more source objects to a - * target object. Returns the target object. - * @param target The target object to copy to. - * @param sources One or more source objects to copy properties from. + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. */ - assign(target: any, ...sources: any[]): any; + setInt8(byteOffset: number, value: number): void; /** - * Returns an array of all symbol properties found directly on object o. - * @param o Object to retrieve the symbols from. + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - getOwnPropertySymbols(o: any): symbol[]; + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Returns true if the values are the same value, false otherwise. - * @param value1 The first value. - * @param value2 The second value. + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - is(value1: any, value2: any): boolean; + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Sets the prototype of a specified object o to object proto or null. Returns the object o. - * @param o The object to change its prototype. - * @param proto The value of the new prototype or null. + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. */ - setPrototypeOf(o: any, proto: any): any; + setUint8(byteOffset: number, value: number): void; /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not - * inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript - * object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor - * property. + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. */ - defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; } -interface Function { - /** - * Returns a new function object that is identical to the argument object in all ways except - * for its identity and the value of its HomeObject internal slot. - */ - toMethod(newHome: Object): Function; +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { /** - * Returns the name of the function. Function names are read-only and can not be changed. + * The size in bytes of each element in the array. */ - name: string; -} + BYTES_PER_ELEMENT: number; -interface NumberConstructor { /** - * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 - * that is representable as a Number value, which is approximately: - * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. + * The ArrayBuffer instance referenced by the array. */ - EPSILON: number; + buffer: ArrayBuffer; /** - * Returns true if passed value is finite. - * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a - * number. Only finite values of the type number, result in true. - * @param number A numeric value. + * The length in bytes of the array. */ - isFinite(number: number): boolean; + byteLength: number; /** - * Returns true if the value passed is an integer, false otherwise. - * @param number A numeric value. + * The offset in bytes of the array. */ - isInteger(number: number): boolean; - - /** - * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a - * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter - * to a number. Only values of the type number, that are also NaN, result in true. - * @param number A numeric value. - */ - isNaN(number: number): boolean; - - /** - * Returns true if the value passed is a safe integer. - * @param number A numeric value. - */ - isSafeInteger(number: number): boolean; - - /** - * The value of the largest integer n such that n and n + 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. - */ - MAX_SAFE_INTEGER: number; + byteOffset: number; /** - * The value of the smallest integer n such that n and n − 1 are both exactly representable as - * a Number value. - * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. */ - MIN_SAFE_INTEGER: number; + copyWithin(target: number, start: number, end?: number): Int8Array; /** - * Converts a string to a floating-point number. - * @param string A string that contains a floating-point number. + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - parseFloat(string: string): number; + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; /** - * Converts A string to an integer. - * @param s A string to convert into a number. - * @param radix A value between 2 and 36 that specifies the base of the number in numString. - * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. - * All other strings are considered decimal. - */ - parseInt(string: string, radix?: number): number; -} - -interface ArrayLike { - length: number; - [n: number]: T; -} - -interface Array { - /** Iterator */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, T]>; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int8Array; - /** - * Returns an list of values in the array + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - values(): IterableIterator; + filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -1480,7 +1453,7 @@ interface Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; /** * Returns the index of the first element in the array where predicate is true, and undefined @@ -1491,660 +1464,492 @@ interface Array { * @param thisArg If provided, it will be used as the this value for each invocation of * predicate. If it is not provided, undefined is used instead. */ - findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: T, start?: number, end?: number): T[]; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - copyWithin(target: number, start: number, end?: number): T[]; -} - -interface IArguments { - /** Iterator */ - [Symbol.iterator](): IterableIterator; -} + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; -interface ArrayConstructor { /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + indexOf(searchElement: number, fromIndex?: number): number; /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. */ - from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + join(separator?: string): string; /** - * Creates an array from an array-like object. - * @param arrayLike An array-like object to convert to an array. + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. */ - from(arrayLike: ArrayLike): Array; + lastIndexOf(searchElement: number, fromIndex?: number): number; /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. + * The length of the array. */ - from(iterable: Iterable): Array; + length: number; /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - of(...items: T[]): Array; -} - -interface String { - /** Iterator */ - [Symbol.iterator](): IterableIterator; + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; /** - * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point - * value of the UTF-16 encoded code point starting at the string element at position pos in - * the String resulting from converting this object to a String. - * If there is no element at that position, the result is undefined. - * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - codePointAt(pos: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; /** - * Returns true if searchString appears as a substring of the result of converting this - * object to a String, at one or more positions that are - * greater than or equal to position; otherwise, returns false. - * @param searchString search string - * @param position If position is undefined, 0 is assumed, so as to search all of the String. + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - contains(searchString: string, position?: number): boolean; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * endPosition – length(this). Otherwise returns false. + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. */ - endsWith(searchString: string, endPosition?: number): boolean; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - /** - * Returns the String value result of normalizing the string into the normalization form - * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. - * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default - * is "NFC" + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - normalize(form?: string): string; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; /** - * Returns a String value that is made from count copies appended together. If count is 0, - * T is the empty String is returned. - * @param count number of copies to append + * Reverses the elements in an Array. */ - repeat(count: number): string; + reverse(): Int8Array; /** - * Returns true if the sequence of elements of searchString converted to a String is the - * same as the corresponding elements of this object (converted to a String) starting at - * position. Otherwise returns false. + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. */ - startsWith(searchString: string, position?: number): boolean; + set(index: number, value: number): void; /** - * Returns an HTML anchor element and sets the name attribute to the text value - * @param name + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. */ - anchor(name: string): string; + set(array: ArrayLike, offset?: number): void; - /** Returns a HTML element */ - big(): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; - /** Returns a HTML element */ - blink(): string; - - /** Returns a HTML element */ - bold(): string; - - /** Returns a HTML element */ - fixed(): string - - /** Returns a HTML element and sets the color attribute value */ - fontcolor(color: string): string - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: number): string; - - /** Returns a HTML element and sets the size attribute value */ - fontsize(size: string): string; - - /** Returns an HTML element */ - italics(): string; - - /** Returns an HTML element and sets the href attribute value */ - link(url: string): string; - - /** Returns a HTML element */ - small(): string; - - /** Returns a HTML element */ - strike(): string; - - /** Returns a HTML element */ - sub(): string; - - /** Returns a HTML element */ - sup(): string; -} + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; -interface StringConstructor { /** - * Return the String value whose elements are, in order, the elements in the List elements. - * If length is 0, the empty string is returned. + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. */ - fromCodePoint(...codePoints: number[]): string; + sort(compareFn?: (a: number, b: number) => number): Int8Array; /** - * String.raw is intended for use as a tag function of a Tagged Template String. When called - * as such the first argument will be a well formed template call site object and the rest - * parameter will contain the substitution values. - * @param template A well-formed template string call site representation. - * @param substitutions A set of substitution values. + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. */ - raw(template: TemplateStringsArray, ...substitutions: any[]): string; -} + subarray(begin: number, end?: number): Int8Array; -interface IteratorResult { - done: boolean; - value?: T; -} + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -interface Iterator { - next(value?: any): IteratorResult; - return?(value?: any): IteratorResult; - throw?(e?: any): IteratorResult; -} + /** + * Returns a string representation of an array. + */ + toString(): string; -interface Iterable { - [Symbol.iterator](): Iterator; + [index: number]: number; } +interface Int8ArrayConstructor { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; -interface IterableIterator extends Iterator { - [Symbol.iterator](): IterableIterator; -} + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; -interface GeneratorFunction extends Function { + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } +declare var Int8Array: Int8ArrayConstructor; -interface GeneratorFunctionConstructor { +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { /** - * Creates a new Generator function. - * @param args A list of arguments the function accepts. + * The size in bytes of each element in the array. */ - new (...args: string[]): GeneratorFunction; - (...args: string[]): GeneratorFunction; - prototype: GeneratorFunction; -} -declare var GeneratorFunction: GeneratorFunctionConstructor; + BYTES_PER_ELEMENT: number; -interface Math { /** - * Returns the number of leading zero bits in the 32-bit binary representation of a number. - * @param x A numeric expression. + * The ArrayBuffer instance referenced by the array. */ - clz32(x: number): number; + buffer: ArrayBuffer; /** - * Returns the result of 32-bit multiplication of two numbers. - * @param x First number - * @param y Second number + * The length in bytes of the array. */ - imul(x: number, y: number): number; + byteLength: number; /** - * Returns the sign of the x, indicating whether x is positive, negative or zero. - * @param x The numeric expression to test + * The offset in bytes of the array. */ - sign(x: number): number; + byteOffset: number; - /** - * Returns the base 10 logarithm of a number. - * @param x A numeric expression. + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. */ - log10(x: number): number; + copyWithin(target: number, start: number, end?: number): Uint8Array; /** - * Returns the base 2 logarithm of a number. - * @param x A numeric expression. + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - log2(x: number): number; + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; /** - * Returns the natural logarithm of 1 + x. - * @param x A numeric expression. - */ - log1p(x: number): number; + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8Array; /** - * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of - * the natural logarithms). - * @param x A numeric expression. + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - expm1(x: number): number; + filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - /** - * Returns the hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. */ - cosh(x: number): number; + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - /** - * Returns the hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. */ - sinh(x: number): number; + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; /** - * Returns the hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - tanh(x: number): number; + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; /** - * Returns the inverse hyperbolic cosine of a number. - * @param x A numeric expression that contains an angle measured in radians. + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. */ - acosh(x: number): number; + indexOf(searchElement: number, fromIndex?: number): number; /** - * Returns the inverse hyperbolic sine of a number. - * @param x A numeric expression that contains an angle measured in radians. + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. */ - asinh(x: number): number; + join(separator?: string): string; /** - * Returns the inverse hyperbolic tangent of a number. - * @param x A numeric expression that contains an angle measured in radians. + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. */ - atanh(x: number): number; + lastIndexOf(searchElement: number, fromIndex?: number): number; /** - * Returns the square root of the sum of squares of its arguments. - * @param values Values to compute the square root for. - * If no arguments are passed, the result is +0. - * If there is only one argument, the result is the absolute value. - * If any argument is +Infinity or -Infinity, the result is +Infinity. - * If any argument is NaN, the result is NaN. - * If all arguments are either +0 or −0, the result is +0. + * The length of the array. */ - hypot(...values: number[] ): number; + length: number; /** - * Returns the integral part of the a numeric expression, x, removing any fractional digits. - * If x is already an integer, the result is x. - * @param x A numeric expression. + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - trunc(x: number): number; + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; /** - * Returns the nearest single precision float representation of a number. - * @param x A numeric expression. + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - fround(x: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; /** - * Returns an implementation-dependent approximation to the cube root of number. - * @param x A numeric expression. + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - cbrt(x: number): number; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - [Symbol.toStringTag]: string; -} + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; -interface RegExp { /** - * Matches a string with a regular expression, and returns an array containing the results of - * that search. - * @param string A string to search within. + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. */ - match(string: string): string[]; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; /** - * Replaces text in a string, using a regular expression. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of rgExp in stringObj. + * Reverses the elements in an Array. */ - replace(string: string, replaceValue: string): string; - - search(string: string): number; + reverse(): Uint8Array; /** - * Returns an Array object into which substrings of the result of converting string to a String - * have been stored. The substrings are determined by searching from left to right for matches - * of the this value regular expression; these occurrences are not part of any substring in the - * returned array, but serve to divide up the String value. - * - * If the regular expression that contains capturing parentheses, then each time separator is - * matched the results (including any undefined results) of the capturing parentheses are spliced. - * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than limit elements. + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. */ - split(string: string, limit?: number): string[]; + set(index: number, value: number): void; /** - * Returns a string indicating the flags of the regular expression in question. This field is read-only. - * The characters in this string are sequenced and concatenated in the following order: - * - * - "g" for global - * - "i" for ignoreCase - * - "m" for multiline - * - "u" for unicode - * - "y" for sticky - * - * If no flags are set, the value is the empty string. + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. */ - flags: string; + set(array: ArrayLike, offset?: number): void; /** - * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular - * expression. Default is false. Read-only. + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. */ - sticky: boolean; + slice(start?: number, end?: number): Uint8Array; - /** - * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular - * expression. Default is false. Read-only. + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. */ - unicode: boolean; -} + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; -interface Map { - clear(): void; - delete(key: K): boolean; - entries(): IterableIterator<[K, V]>; - forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; - get(key: K): V; - has(key: K): boolean; - keys(): IterableIterator; - set(key: K, value?: V): Map; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator<[K,V]>; - [Symbol.toStringTag]: string; -} + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8Array; -interface MapConstructor { - new (): Map; - new (): Map; - new (iterable: Iterable<[K, V]>): Map; - prototype: Map; -} -declare var Map: MapConstructor; + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; -interface WeakMap { - clear(): void; - delete(key: K): boolean; - get(key: K): V; - has(key: K): boolean; - set(key: K, value?: V): WeakMap; - [Symbol.toStringTag]: string; -} + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -interface WeakMapConstructor { - new (): WeakMap; - new (): WeakMap; - new (iterable: Iterable<[K, V]>): WeakMap; - prototype: WeakMap; -} -declare var WeakMap: WeakMapConstructor; + /** + * Returns a string representation of an array. + */ + toString(): string; -interface Set { - add(value: T): Set; - clear(): void; - delete(value: T): boolean; - entries(): IterableIterator<[T, T]>; - forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; - has(value: T): boolean; - keys(): IterableIterator; - size: number; - values(): IterableIterator; - [Symbol.iterator]():IterableIterator; - [Symbol.toStringTag]: string; + [index: number]: number; } -interface SetConstructor { - new (): Set; - new (): Set; - new (iterable: Iterable): Set; - prototype: Set; -} -declare var Set: SetConstructor; +interface Uint8ArrayConstructor { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; -interface WeakSet { - add(value: T): WeakSet; - clear(): void; - delete(value: T): boolean; - has(value: T): boolean; - [Symbol.toStringTag]: string; -} + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; -interface WeakSetConstructor { - new (): WeakSet; - new (): WeakSet; - new (iterable: Iterable): WeakSet; - prototype: WeakSet; -} -declare var WeakSet: WeakSetConstructor; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -interface JSON { - [Symbol.toStringTag]: string; } +declare var Uint8Array: Uint8ArrayConstructor; /** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. */ -interface ArrayBuffer { +interface Uint8ClampedArray { /** - * Read-only. The length of the ArrayBuffer (in bytes). + * The size in bytes of each element in the array. */ - byteLength: number; + BYTES_PER_ELEMENT: number; /** - * Returns a section of an ArrayBuffer. + * The ArrayBuffer instance referenced by the array. */ - slice(begin: number, end?: number): ArrayBuffer; - - [Symbol.toStringTag]: string; -} - -interface ArrayBufferConstructor { - prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): boolean; -} -declare var ArrayBuffer: ArrayBufferConstructor; - -interface DataView { buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; + /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. + * The length in bytes of the array. */ - getFloat32(byteOffset: number, littleEndian: boolean): number; + byteLength: number; /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. + * The offset in bytes of the array. */ - getFloat64(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - - [Symbol.toStringTag]: string; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare var DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; + byteOffset: number; /** * Returns the this object after copying a section of the array identified by start and end @@ -2155,12 +1960,7 @@ interface Int8Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; /** * Determines whether all the members of an array satisfy the specified test. @@ -2170,7 +1970,7 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -2180,7 +1980,7 @@ interface Int8Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int8Array; + fill(value: number, start?: number, end?: number): Uint8ClampedArray; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -2189,7 +1989,7 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -2220,7 +2020,7 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -2237,11 +2037,6 @@ interface Int8Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -2263,7 +2058,7 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2275,7 +2070,7 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2287,7 +2082,7 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2299,7 +2094,7 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2311,12 +2106,12 @@ interface Int8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Int8Array; + reverse(): Uint8ClampedArray; /** * Sets a value or an array of values. @@ -2330,14 +2125,14 @@ interface Int8Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int8Array, offset?: number): void; + set(array: Uint8ClampedArray, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Int8Array; + slice(start?: number, end?: number): Uint8ClampedArray; /** * Determines whether the specified callback function returns true for any element of an array. @@ -2347,22 +2142,22 @@ interface Int8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Int8Array; + subarray(begin: number, end?: number): Uint8ClampedArray; /** * Converts a number to a string by using the current locale. @@ -2374,21 +2169,14 @@ interface Int8Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Int8ArrayConstructor { - prototype: Int8Array; - new (length: number): Int8Array; - new (array: Int8Array): Int8Array; - new (array: number[]): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; /** * The size in bytes of each element in the array. @@ -2399,7 +2187,7 @@ interface Int8ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Int8Array; + of(...items: number[]): Uint8ClampedArray; /** * Creates an array from an array-like or iterable object. @@ -2407,15 +2195,15 @@ interface Int8ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } -declare var Int8Array: Int8ArrayConstructor; +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ -interface Uint8Array { +interface Int16Array { /** * The size in bytes of each element in the array. */ @@ -2445,12 +2233,7 @@ interface Uint8Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Int16Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -2460,7 +2243,7 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -2470,7 +2253,7 @@ interface Uint8Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8Array; + fill(value: number, start?: number, end?: number): Int16Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -2479,7 +2262,7 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -2510,7 +2293,7 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -2527,11 +2310,6 @@ interface Uint8Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -2553,7 +2331,7 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2565,7 +2343,7 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2577,7 +2355,7 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2589,7 +2367,7 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2601,12 +2379,12 @@ interface Uint8Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Uint8Array; + reverse(): Int16Array; /** * Sets a value or an array of values. @@ -2620,14 +2398,14 @@ interface Uint8Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint8Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Uint8Array; + slice(start?: number, end?: number): Int16Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -2637,22 +2415,22 @@ interface Uint8Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; + sort(compareFn?: (a: number, b: number) => number): Int16Array; /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Uint8Array; + subarray(begin: number, end?: number): Int16Array; /** * Converts a number to a string by using the current locale. @@ -2664,21 +2442,14 @@ interface Uint8Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Uint8ArrayConstructor { - prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: Uint8Array): Uint8Array; - new (array: number[]): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; +interface Int16ArrayConstructor { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; /** * The size in bytes of each element in the array. @@ -2689,23 +2460,24 @@ interface Uint8ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Uint8Array; - + of(...items: number[]): Int16Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} -declare var Uint8Array: Uint8ArrayConstructor; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare var Int16Array: Int16ArrayConstructor; /** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. */ -interface Uint8ClampedArray { +interface Uint16Array { /** * The size in bytes of each element in the array. */ @@ -2735,12 +2507,7 @@ interface Uint8ClampedArray { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Uint16Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -2750,7 +2517,7 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -2760,7 +2527,7 @@ interface Uint8ClampedArray { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; + fill(value: number, start?: number, end?: number): Uint16Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -2769,7 +2536,7 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -2800,7 +2567,7 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -2817,11 +2584,6 @@ interface Uint8ClampedArray { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -2843,7 +2605,7 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2855,7 +2617,7 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -2867,7 +2629,7 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2879,7 +2641,7 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -2891,12 +2653,12 @@ interface Uint8ClampedArray { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Uint8ClampedArray; + reverse(): Uint16Array; /** * Sets a value or an array of values. @@ -2910,14 +2672,14 @@ interface Uint8ClampedArray { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint8ClampedArray, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Uint8ClampedArray; + slice(start?: number, end?: number): Uint16Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -2927,22 +2689,22 @@ interface Uint8ClampedArray { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + sort(compareFn?: (a: number, b: number) => number): Uint16Array; /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Uint8ClampedArray; + subarray(begin: number, end?: number): Uint16Array; /** * Converts a number to a string by using the current locale. @@ -2954,21 +2716,14 @@ interface Uint8ClampedArray { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Uint8ClampedArrayConstructor { - prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: Uint8ClampedArray): Uint8ClampedArray; - new (array: number[]): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; +interface Uint16ArrayConstructor { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; /** * The size in bytes of each element in the array. @@ -2979,23 +2734,23 @@ interface Uint8ClampedArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Uint8ClampedArray; - + of(...items: number[]): Uint16Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} +declare var Uint16Array: Uint16ArrayConstructor; /** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ -interface Int16Array { +interface Int32Array { /** * The size in bytes of each element in the array. */ @@ -3025,12 +2780,7 @@ interface Int16Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Int32Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -3040,7 +2790,7 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -3050,7 +2800,7 @@ interface Int16Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int16Array; + fill(value: number, start?: number, end?: number): Int32Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -3059,7 +2809,7 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -3090,7 +2840,7 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3107,11 +2857,6 @@ interface Int16Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -3133,7 +2878,7 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3145,7 +2890,7 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3157,7 +2902,7 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3169,7 +2914,7 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3181,12 +2926,12 @@ interface Int16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Int16Array; + reverse(): Int32Array; /** * Sets a value or an array of values. @@ -3200,14 +2945,14 @@ interface Int16Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int16Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Int16Array; + slice(start?: number, end?: number): Int32Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -3217,22 +2962,22 @@ interface Int16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; + sort(compareFn?: (a: number, b: number) => number): Int32Array; /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Int16Array; + subarray(begin: number, end?: number): Int32Array; /** * Converts a number to a string by using the current locale. @@ -3244,21 +2989,14 @@ interface Int16Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Int16ArrayConstructor { - prototype: Int16Array; - new (length: number): Int16Array; - new (array: Int16Array): Int16Array; - new (array: number[]): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; +interface Int32ArrayConstructor { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; /** * The size in bytes of each element in the array. @@ -3269,23 +3007,23 @@ interface Int16ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Int16Array; - + of(...items: number[]): Int32Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } -declare var Int16Array: Int16ArrayConstructor; +declare var Int32Array: Int32ArrayConstructor; /** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. */ -interface Uint16Array { +interface Uint32Array { /** * The size in bytes of each element in the array. */ @@ -3315,12 +3053,7 @@ interface Uint16Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Uint32Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -3330,7 +3063,7 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -3340,7 +3073,7 @@ interface Uint16Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint16Array; + fill(value: number, start?: number, end?: number): Uint32Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -3349,7 +3082,7 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -3380,7 +3113,7 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3397,11 +3130,6 @@ interface Uint16Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -3423,7 +3151,7 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3435,7 +3163,7 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3447,7 +3175,7 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3459,7 +3187,7 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3471,12 +3199,12 @@ interface Uint16Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Uint16Array; + reverse(): Uint32Array; /** * Sets a value or an array of values. @@ -3490,14 +3218,14 @@ interface Uint16Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint16Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Uint16Array; + slice(start?: number, end?: number): Uint32Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -3507,22 +3235,22 @@ interface Uint16Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; + sort(compareFn?: (a: number, b: number) => number): Uint32Array; /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Uint16Array; + subarray(begin: number, end?: number): Uint32Array; /** * Converts a number to a string by using the current locale. @@ -3534,21 +3262,14 @@ interface Uint16Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Uint16ArrayConstructor { - prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: Uint16Array): Uint16Array; - new (array: number[]): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; +interface Uint32ArrayConstructor { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; /** * The size in bytes of each element in the array. @@ -3559,23 +3280,23 @@ interface Uint16ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Uint16Array; - + of(...items: number[]): Uint32Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } -declare var Uint16Array: Uint16ArrayConstructor; +declare var Uint32Array: Uint32ArrayConstructor; /** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. */ -interface Int32Array { +interface Float32Array { /** * The size in bytes of each element in the array. */ @@ -3605,12 +3326,7 @@ interface Int32Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Float32Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -3620,7 +3336,7 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -3630,7 +3346,7 @@ interface Int32Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Int32Array; + fill(value: number, start?: number, end?: number): Float32Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -3639,7 +3355,7 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -3670,7 +3386,7 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3687,11 +3403,6 @@ interface Int32Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -3713,7 +3424,7 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3725,7 +3436,7 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -3737,7 +3448,7 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3749,7 +3460,7 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -3761,12 +3472,12 @@ interface Int32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Int32Array; + reverse(): Float32Array; /** * Sets a value or an array of values. @@ -3780,14 +3491,14 @@ interface Int32Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Int32Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Int32Array; + slice(start?: number, end?: number): Float32Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -3797,22 +3508,22 @@ interface Int32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; + sort(compareFn?: (a: number, b: number) => number): Float32Array; /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Int32Array; + subarray(begin: number, end?: number): Float32Array; /** * Converts a number to a string by using the current locale. @@ -3824,21 +3535,14 @@ interface Int32Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Int32ArrayConstructor { - prototype: Int32Array; - new (length: number): Int32Array; - new (array: Int32Array): Int32Array; - new (array: number[]): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; +interface Float32ArrayConstructor { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; /** * The size in bytes of each element in the array. @@ -3849,23 +3553,24 @@ interface Int32ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Int32Array; - + of(...items: number[]): Float32Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + } -declare var Int32Array: Int32ArrayConstructor; +declare var Float32Array: Float32ArrayConstructor; /** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. */ -interface Uint32Array { +interface Float64Array { /** * The size in bytes of each element in the array. */ @@ -3895,12 +3600,7 @@ interface Uint32Array { * is treated as length+end. * @param end If not specified, length of the this object is used as its default value. */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; + copyWithin(target: number, start: number, end?: number): Float64Array; /** * Determines whether all the members of an array satisfy the specified test. @@ -3910,7 +3610,7 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Returns the this object after filling the section identified by start and end with value @@ -3920,7 +3620,7 @@ interface Uint32Array { * @param end index to stop filling the array at. If end is negative, it is treated as * length+end. */ - fill(value: number, start?: number, end?: number): Uint32Array; + fill(value: number, start?: number, end?: number): Float64Array; /** * Returns the elements of an array that meet the condition specified in a callback function. @@ -3929,7 +3629,7 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; /** * Returns the value of the first element in the array where predicate is true, and undefined @@ -3960,7 +3660,7 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; /** * Returns the index of the first occurrence of a value in an array. @@ -3977,11 +3677,6 @@ interface Uint32Array { */ join(separator?: string): string; - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - /** * Returns the index of the last occurrence of a value in an array. * @param searchElement The value to locate in the array. @@ -4003,7 +3698,7 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -4015,7 +3710,7 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array. The return value of @@ -4027,7 +3722,7 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -4039,7 +3734,7 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an * argument instead of an array value. */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; /** * Calls the specified callback function for all the elements in an array, in descending order. @@ -4051,12 +3746,12 @@ interface Uint32Array { * the accumulation. The first call to the callbackfn function provides this value as an argument * instead of an array value. */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; /** * Reverses the elements in an Array. */ - reverse(): Uint32Array; + reverse(): Float64Array; /** * Sets a value or an array of values. @@ -4070,14 +3765,14 @@ interface Uint32Array { * @param array A typed or untyped array of values to set. * @param offset The index in the current array at which the values are to be written. */ - set(array: Uint32Array, offset?: number): void; + set(array: ArrayLike, offset?: number): void; /** * Returns a section of an array. * @param start The beginning of the specified portion of the array. * @param end The end of the specified portion of the array. */ - slice(start?: number, end?: number): Uint32Array; + slice(start?: number, end?: number): Float64Array; /** * Determines whether the specified callback function returns true for any element of an array. @@ -4087,22 +3782,22 @@ interface Uint32Array { * @param thisArg An object to which the this keyword can refer in the callbackfn function. * If thisArg is omitted, undefined is used as the this value. */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; /** * Sorts an array. * @param compareFn The name of the function used to determine the order of the elements. If * omitted, the elements are sorted in ascending, ASCII character order. */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; + sort(compareFn?: (a: number, b: number) => number): Float64Array; /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements * at begin, inclusive, up to end, exclusive. * @param begin The index of the beginning of the array. * @param end The index of the end of the array. */ - subarray(begin: number, end?: number): Uint32Array; + subarray(begin: number, end?: number): Float64Array; /** * Converts a number to a string by using the current locale. @@ -4114,21 +3809,14 @@ interface Uint32Array { */ toString(): string; - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - [index: number]: number; - [Symbol.iterator](): IterableIterator; } -interface Uint32ArrayConstructor { - prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: Uint32Array): Uint32Array; - new (array: number[]): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; +interface Float64ArrayConstructor { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; /** * The size in bytes of each element in the array. @@ -4139,297 +3827,973 @@ interface Uint32ArrayConstructor { * Returns a new array from a set of elements. * @param items A set of elements to include in the new array object. */ - of(...items: number[]): Uint32Array; - + of(...items: number[]): Float64Array; + /** * Creates an array from an array-like or iterable object. * @param arrayLike An array-like or iterable object to convert to an array. * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Uint32Array: Uint32ArrayConstructor; +declare var Float64Array: Float64ArrayConstructor; +declare type PropertyKey = string | number | symbol; -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + [Symbol.toStringTag]: string; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. */ - BYTES_PER_ELEMENT: number; + prototype: Symbol; /** - * The ArrayBuffer instance referenced by the array. + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. */ - buffer: ArrayBuffer; + (description?: string|number): symbol; /** - * The length in bytes of the array. + * 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. */ - byteLength: number; + for(key: string): symbol; /** - * The offset in bytes of the array. + * 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. */ - byteOffset: number; + keyFor(sym: symbol): string; + + // Well-known Symbols /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. + * 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. */ - copyWithin(target: number, start: number, end?: number): Float32Array; + hasInstance: symbol; /** - * Returns an array of key, value pairs for every entry in the array + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. */ - entries(): IterableIterator<[number, number]>; + isConcatSpreadable: symbol; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + iterator: symbol; /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + replace: symbol; /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + search: symbol; /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * A function valued property that is the constructor function that is used to create + * derived objects. */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + split: symbol; /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + toPrimitive: symbol; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + /** + * 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. */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + toStringTag: symbol; /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. */ - indexOf(searchElement: number, fromIndex?: number): number; + unscopables: symbol; +} +declare var Symbol: SymbolConstructor; +interface Object { /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. + * Determines whether an object has a property with the specified name. + * @param v A property name. */ - join(separator?: string): string; + hasOwnProperty(v: PropertyKey): boolean; /** - * Returns an list of keys in the array + * Determines whether a specified property is enumerable. + * @param v A property name. */ - keys(): IterableIterator; + propertyIsEnumerable(v: PropertyKey): boolean; +} +interface ObjectConstructor { /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. */ - lastIndexOf(searchElement: number, fromIndex?: number): number; + assign(target: any, ...sources: any[]): any; /** - * The length of the array. + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. */ - length: number; + getOwnPropertySymbols(o: any): symbol[]; /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript + * object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + name: string; + + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10â€âˆ’â€16. + */ + EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + // Overloads for objects with methods of well-known symbols. + + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface GeneratorFunction extends Function { + +} + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + sign(x: number): number; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; + + [Symbol.toStringTag]: string; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; + + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + unicode: boolean; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface Map { + clear(): void; + delete(key: K): boolean; + entries(): IterableIterator<[K, V]>; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + keys(): IterableIterator; + set(key: K, value?: V): Map; + size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator<[K,V]>; + [Symbol.toStringTag]: string; +} + +interface MapConstructor { + new (): Map; + new (): Map; + new (iterable: Iterable<[K, V]>): Map; + prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; + [Symbol.toStringTag]: string; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; + prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + entries(): IterableIterator<[T, T]>; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + keys(): IterableIterator; + size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator; + [Symbol.toStringTag]: string; +} + +interface SetConstructor { + new (): Set; + new (): Set; + new (iterable: Iterable): Set; + prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): WeakSet; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; + [Symbol.toStringTag]: string; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (): WeakSet; + new (iterable: Iterable): WeakSet; + prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; + +interface JSON { + [Symbol.toStringTag]: string; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + [Symbol.toStringTag]: string; +} - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; +interface DataView { + [Symbol.toStringTag]: string; +} +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. + * Returns an array of key, value pairs for every entry in the array */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - + entries(): IterableIterator<[number, number]>; /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Returns an list of keys in the array */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. + keys(): IterableIterator; + /** + * Returns an list of values in the array */ - reverse(): Float32Array; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - set(array: Float32Array, offset?: number): void; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. + * Returns an array of key, value pairs for every entry in the array */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. + keys(): IterableIterator; + /** + * Returns an list of values in the array */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - subarray(begin: number, end?: number): Float32Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} - /** - * Converts a number to a string by using the current locale. +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * Returns an array of key, value pairs for every entry in the array */ - toLocaleString(): string; + entries(): IterableIterator<[number, number]>; - /** - * Returns a string representation of an array. + /** + * Returns an list of keys in the array */ - toString(): string; + keys(): IterableIterator; /** * Returns an list of values in the array */ values(): IterableIterator; - [index: number]: number; [Symbol.iterator](): IterableIterator; } -interface Float32ArrayConstructor { - prototype: Float32Array; - new (length: number): Float32Array; - new (array: Float32Array): Float32Array; - new (array: number[]): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; /** * Creates an array from an array-like or iterable object. @@ -4437,289 +4801,195 @@ interface Float32ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } -declare var Float32Array: Float32ArrayConstructor; /** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - +interface Int16Array { /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * Returns an list of keys in the array */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + keys(): IterableIterator; /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * Returns an list of values in the array */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + values(): IterableIterator; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; + [Symbol.iterator](): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - join(separator?: string): string; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; /** * Returns an list of keys in the array */ keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. + /** + * Returns an list of values in the array */ - length: number; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - + entries(): IterableIterator<[number, number]>; /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. + * Returns an list of keys in the array */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - + keys(): IterableIterator; /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Returns an list of values in the array */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - set(index: number, value: number): void; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - set(array: Float64Array, offset?: number): void; - + entries(): IterableIterator<[number, number]>; /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. + * Returns an list of keys in the array */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + keys(): IterableIterator; + /** + * Returns an list of values in the array */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - subarray(begin: number, end?: number): Float64Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} - /** - * Converts a number to a string by using the current locale. +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array */ - toString(): string; - + keys(): IterableIterator; /** * Returns an list of values in the array */ values(): IterableIterator; - - [index: number]: number; [Symbol.iterator](): IterableIterator; } -interface Float64ArrayConstructor { - prototype: Float64Array; - new (length: number): Float64Array; - new (array: Float64Array): Float64Array; - new (array: number[]): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; /** - * The size in bytes of each element in the array. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - BYTES_PER_ELEMENT: number; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - of(...items: number[]): Float64Array; + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; /** * Creates an array from an array-like or iterable object. @@ -4727,9 +4997,8 @@ interface Float64ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Float64Array: Float64ArrayConstructor; interface ProxyHandler { getPrototypeOf? (target: T): any; @@ -4754,9 +5023,9 @@ interface ProxyConstructor { } declare var Proxy: ProxyConstructor; -declare module Reflect { +declare namespace Reflect { function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; function deleteProperty(target: any, propertyKey: PropertyKey): boolean; function enumerate(target: any): IterableIterator; @@ -4857,23 +5126,7 @@ interface PromiseConstructor { } declare var Promise: PromiseConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -}///////////////////////////// +///////////////////////////// /// ECMAScript Internationalization API ///////////////////////////// @@ -7507,7 +7760,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. * @param replace Specifies whether the existing entry for the document is replaced in the history list. */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document | Window; + open(url?: string, name?: string, features?: string, replace?: boolean): Document; /** * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. @@ -8078,7 +8331,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(): File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; } interface FileList { @@ -11913,7 +12166,7 @@ interface IDBDatabase extends EventTarget { createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -12034,7 +12287,7 @@ interface IDBTransaction extends EventTarget { READ_ONLY: string; READ_WRITE: string; VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -12064,11 +12317,14 @@ interface ImageData { width: number; } -declare var ImageData: { +interface ImageDataConstructor { prototype: ImageData; - new(): ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; } +declare var ImageData: ImageDataConstructor; + interface KeyboardEvent extends UIEvent { altKey: boolean; char: string; @@ -17010,7 +17266,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window onvolumechange: (ev: Event) => any; onwaiting: (ev: Event) => any; opener: Window; - orientation: string; + orientation: string | number; outerHeight: number; outerWidth: number; pageXOffset: number; @@ -17217,7 +17473,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { LOADING: number; OPENED: number; UNSENT: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -17487,7 +17743,7 @@ interface MSBaseReader { DONE: number; EMPTY: number; LOADING: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -17643,7 +17899,7 @@ interface XMLHttpRequestEventTarget { onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; ontimeout: (ev: ProgressEvent) => any; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -17660,11 +17916,17 @@ interface NodeListOf extends NodeList { [index: number]: TNode; } + interface BlobPropertyBag { type?: string; endings?: string; } +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + interface EventListenerObject { handleEvent(evt: Event): void; } @@ -17825,7 +18087,7 @@ declare var onunload: (ev: Event) => any; declare var onvolumechange: (ev: Event) => any; declare var onwaiting: (ev: Event) => any; declare var opener: Window; -declare var orientation: string; +declare var orientation: string | number; declare var outerHeight: number; declare var outerWidth: number; declare var pageXOffset: number; @@ -18000,7 +18262,8 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;interface DOMTokenList { +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +interface DOMTokenList { [Symbol.iterator](): IterableIterator; } @@ -18011,6 +18274,7 @@ interface NodeList { interface NodeListOf { [Symbol.iterator](): IterableIterator } + ///////////////////////////// /// WorkerGlobalScope APIs ///////////////////////////// diff --git a/lib/lib.webworker.d.ts b/lib/lib.webworker.d.ts index d9e8a2ab333a1..ed9f18e8daefb 100644 --- a/lib/lib.webworker.d.ts +++ b/lib/lib.webworker.d.ts @@ -14,2311 +14,7 @@ and limitations under the License. ***************************************************************************** */ /// - -///////////////////////////// -/// IE10 ECMAScript Extensions -///////////////////////////// - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): boolean; -} -declare var ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare var DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int8Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - prototype: Int8Array; - new (length: number): Int8Array; - new (array: Int8Array): Int8Array; - new (array: number[]): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; -} -declare var Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: Uint8Array): Uint8Array; - new (array: number[]): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; -} -declare var Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int16Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - prototype: Int16Array; - new (length: number): Int16Array; - new (array: Int16Array): Int16Array; - new (array: number[]): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; -} -declare var Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint16Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: Uint16Array): Uint16Array; - new (array: number[]): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; -} -declare var Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - prototype: Int32Array; - new (length: number): Int32Array; - new (array: Int32Array): Int32Array; - new (array: number[]): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; -} -declare var Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: Uint32Array): Uint32Array; - new (array: number[]): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; -} -declare var Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Float32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - prototype: Float32Array; - new (length: number): Float32Array; - new (array: Float32Array): Float32Array; - new (array: number[]): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; -} -declare var Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Float64Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - prototype: Float64Array; - new (length: number): Float64Array; - new (array: Float64Array): Float64Array; - new (array: number[]): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; -} -declare var Float64Array: Float64ArrayConstructor;///////////////////////////// +///////////////////////////// /// ECMAScript Internationalization API ///////////////////////////// @@ -2496,10 +192,28 @@ interface Date { /// IE Worker APIs ///////////////////////////// +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; +} + interface EventListener { (evt: Event): void; } +interface AudioBuffer { + duration: number; + length: number; + numberOfChannels: number; + sampleRate: number; + getChannelData(channel: number): any; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + interface Blob { size: number; type: string; @@ -2553,6 +267,21 @@ declare var Console: { new(): Console; } +interface Coordinates { + accuracy: number; + altitude: number; + altitudeAccuracy: number; + heading: number; + latitude: number; + longitude: number; + speed: number; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + interface DOMError { name: string; toString(): string; @@ -2703,7 +432,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(): File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; } interface FileList { @@ -2774,7 +503,7 @@ interface IDBDatabase extends EventTarget { createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -2895,7 +624,7 @@ interface IDBTransaction extends EventTarget { READ_ONLY: string; READ_WRITE: string; VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -2925,11 +654,14 @@ interface ImageData { width: number; } -declare var ImageData: { +interface ImageDataConstructor { prototype: ImageData; - new(): ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; } +declare var ImageData: ImageDataConstructor; + interface MSApp { clearTemporaryWebDataAsync(): MSAppAsyncOperation; createBlobFromRandomAccessStream(type: string, seeker: any): Blob; @@ -2953,6 +685,29 @@ interface MSApp { } declare var MSApp: MSApp; +interface MSAppAsyncOperation extends EventTarget { + error: DOMError; + oncomplete: (ev: Event) => any; + onerror: (ev: Event) => any; + readyState: number; + result: any; + start(): void; + COMPLETED: number; + ERROR: number; + STARTED: number; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + COMPLETED: number; + ERROR: number; + STARTED: number; +} + interface MSBlobBuilder { append(data: any, endings?: string): void; getBlob(contentType?: string): Blob; @@ -2989,6 +744,18 @@ declare var MSStreamReader: { new(): MSStreamReader; } +interface MediaQueryList { + matches: boolean; + media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + interface MessageChannel { port1: MessagePort; port2: MessagePort; @@ -3026,6 +793,33 @@ declare var MessagePort: { new(): MessagePort; } +interface Position { + coords: Coordinates; + timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + code: number; + message: string; + toString(): string; + PERMISSION_DENIED: number; + POSITION_UNAVAILABLE: number; + TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + PERMISSION_DENIED: number; + POSITION_UNAVAILABLE: number; + TIMEOUT: number; +} + interface ProgressEvent extends Event { lengthComputable: boolean; loaded: number; @@ -3113,7 +907,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { LOADING: number; OPENED: number; UNSENT: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -3135,6 +929,15 @@ declare var XMLHttpRequest: { create(): XMLHttpRequest; } +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + interface AbstractWorker { onerror: (ev: Event) => any; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -3154,7 +957,7 @@ interface MSBaseReader { DONE: number; EMPTY: number; LOADING: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -3195,7 +998,7 @@ interface XMLHttpRequestEventTarget { onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; ontimeout: (ev: ProgressEvent) => any; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -3281,17 +1084,16 @@ interface WorkerUtils extends Object, WindowBase64 { } -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - interface BlobPropertyBag { type?: string; endings?: string; } +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + interface EventListenerObject { handleEvent(evt: Event): void; } @@ -3299,7 +1101,7 @@ interface EventListenerObject { declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject; interface ErrorEventHandler { - (event: Event | string, source?: string, fileno?: number, columnNumber?: number): void; + (message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void; } interface PositionCallback { (position: Position): void; @@ -3313,11 +1115,11 @@ interface MediaQueryListListener { interface MSLaunchUriCallback { (): void; } -interface FrameRequestCallback { - (time: number): void; +interface MSUnsafeFunctionCallback { + (): any; } -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; } interface DecodeSuccessCallback { (decodedData: AudioBuffer): void; @@ -3354,4 +1156,4 @@ declare function postMessage(data: any): void; declare var console: Console; declare function addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; declare function addEventListener(type: "message", listener: (ev: MessageEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; diff --git a/lib/tsc.js b/lib/tsc.js index 185aca1ef44bb..eb2a963b828c7 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -57,6 +57,7 @@ var ts; set: set, contains: contains, remove: remove, + clear: clear, forEachValue: forEachValueInMap }; function set(fileName, value) { @@ -78,6 +79,9 @@ var ts; function normalizeKey(key) { return getCanonicalFileName(normalizeSlashes(key)); } + function clear() { + files = {}; + } } ts.createFileMap = createFileMap; function forEach(array, callback) { @@ -495,7 +499,7 @@ var ts; if (path.lastIndexOf("file:///", 0) === 0) { return "file:///".length; } - var idx = path.indexOf('://'); + var idx = path.indexOf("://"); if (idx !== -1) { return idx + "://".length; } @@ -649,7 +653,7 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - ts.supportedExtensions = [".tsx", ".ts", ".d.ts"]; + ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { @@ -864,7 +868,7 @@ var ts; function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); - var _os = require('os'); + var _os = require("os"); var platform = _os.platform(); var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName, encoding) { @@ -892,7 +896,7 @@ var ts; } function writeFile(fileName, data, writeByteOrderMark) { if (writeByteOrderMark) { - data = '\uFEFF' + data; + data = "\uFEFF" + data; } _fs.writeFileSync(fileName, data, "utf8"); } @@ -933,7 +937,7 @@ var ts; newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { - var buffer = new Buffer(s, 'utf8'); + var buffer = new Buffer(s, "utf8"); var offset = 0; var toWrite = buffer.length; var written = 0; @@ -955,7 +959,6 @@ var ts; } callback(fileName); } - ; }, resolvePath: function (path) { return _path.resolve(path); @@ -992,7 +995,7 @@ var ts; if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } - else if (typeof module !== "undefined" && module.exports) { + else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { return getNodeSystem(); } else { @@ -1255,6 +1258,7 @@ var ts; Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, @@ -1294,7 +1298,7 @@ var ts; Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." }, Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: "Duplicate function implementation." }, Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, @@ -1425,6 +1429,8 @@ var ts; JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The global type 'JSX.{0}' may not have more than one property" }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, + A_member_initializer_in_a_const_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_const_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a 'const' enum declaration cannot reference members declared after it, including members defined in other 'const' enums." }, + Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1504,20 +1510,11 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, - Option_sourceMap_cannot_be_specified_with_option_isolatedModules: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'isolatedModules'." }, - Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." }, - Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." }, - Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, - Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, - Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, - Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, + Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, + Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1568,7 +1565,6 @@ var ts; Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, - Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, @@ -1613,7 +1609,8 @@ var ts; JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, - Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." } + Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } }; })(ts || (ts = {})); /// @@ -1621,123 +1618,123 @@ var ts; var ts; (function (ts) { var textToToken = { - "abstract": 112, - "any": 114, - "as": 113, - "boolean": 117, - "break": 67, - "case": 68, - "catch": 69, - "class": 70, - "continue": 72, - "const": 71, - "constructor": 118, - "debugger": 73, - "declare": 119, - "default": 74, - "delete": 75, - "do": 76, - "else": 77, - "enum": 78, - "export": 79, - "extends": 80, - "false": 81, - "finally": 82, - "for": 83, - "from": 130, - "function": 84, - "get": 120, - "if": 85, - "implements": 103, - "import": 86, - "in": 87, - "instanceof": 88, - "interface": 104, - "is": 121, - "let": 105, - "module": 122, - "namespace": 123, - "new": 89, - "null": 90, - "number": 125, - "package": 106, - "private": 107, - "protected": 108, - "public": 109, - "require": 124, - "return": 91, - "set": 126, - "static": 110, - "string": 127, - "super": 92, - "switch": 93, - "symbol": 128, - "this": 94, - "throw": 95, - "true": 96, - "try": 97, - "type": 129, - "typeof": 98, - "var": 99, - "void": 100, - "while": 101, - "with": 102, - "yield": 111, - "async": 115, - "await": 116, - "of": 131, - "{": 14, - "}": 15, - "(": 16, - ")": 17, - "[": 18, - "]": 19, - ".": 20, - "...": 21, - ";": 22, - ",": 23, - "<": 24, - ">": 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, - "=": 54, - "+=": 55, - "-=": 56, - "*=": 57, - "/=": 58, - "%=": 59, - "<<=": 60, - ">>=": 61, - ">>>=": 62, - "&=": 63, - "|=": 64, - "^=": 65, - "@": 53 + "abstract": 113, + "any": 115, + "as": 114, + "boolean": 118, + "break": 68, + "case": 69, + "catch": 70, + "class": 71, + "continue": 73, + "const": 72, + "constructor": 119, + "debugger": 74, + "declare": 120, + "default": 75, + "delete": 76, + "do": 77, + "else": 78, + "enum": 79, + "export": 80, + "extends": 81, + "false": 82, + "finally": 83, + "for": 84, + "from": 131, + "function": 85, + "get": 121, + "if": 86, + "implements": 104, + "import": 87, + "in": 88, + "instanceof": 89, + "interface": 105, + "is": 122, + "let": 106, + "module": 123, + "namespace": 124, + "new": 90, + "null": 91, + "number": 126, + "package": 107, + "private": 108, + "protected": 109, + "public": 110, + "require": 125, + "return": 92, + "set": 127, + "static": 111, + "string": 128, + "super": 93, + "switch": 94, + "symbol": 129, + "this": 95, + "throw": 96, + "true": 97, + "try": 98, + "type": 130, + "typeof": 99, + "var": 100, + "void": 101, + "while": 102, + "with": 103, + "yield": 112, + "async": 116, + "await": 117, + "of": 132, + "{": 15, + "}": 16, + "(": 17, + ")": 18, + "[": 19, + "]": 20, + ".": 21, + "...": 22, + ";": 23, + ",": 24, + "<": 25, + ">": 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, + "=": 55, + "+=": 56, + "-=": 57, + "*=": 58, + "/=": 59, + "%=": 60, + "<<=": 61, + ">>=": 62, + ">>>=": 63, + "&=": 64, + "|=": 65, + "^=": 66, + "@": 54 }; 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,]; @@ -1838,6 +1835,7 @@ var ts; var lineNumber = ts.binarySearch(lineStarts, position); if (lineNumber < 0) { lineNumber = ~lineNumber - 1; + ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); } return { line: lineNumber, @@ -1903,6 +1901,8 @@ var ts; case 61: case 62: return true; + case 35: + return pos === 0; default: return ch > 127; } @@ -1959,6 +1959,12 @@ var ts; continue; } break; + case 35: + if (pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + continue; + } + break; default: if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { pos++; @@ -2010,6 +2016,16 @@ var ts; } return pos; } + var shebangTriviaRegex = /^#!.*/; + function isShebangTrivia(text, pos) { + ts.Debug.assert(pos === 0); + return shebangTriviaRegex.test(text); + } + function scanShebangTrivia(text, pos) { + var shebang = shebangTriviaRegex.exec(text)[0]; + pos = pos + shebang.length; + return pos; + } function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; @@ -2091,6 +2107,12 @@ var ts; return getCommentRanges(text, pos, true); } ts.getTrailingCommentRanges = getTrailingCommentRanges; + function getShebang(text) { + return shebangTriviaRegex.test(text) + ? shebangTriviaRegex.exec(text)[0] + : undefined; + } + ts.getShebang = getShebang; function isIdentifierStart(ch, languageVersion) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || @@ -2124,8 +2146,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 66 || token > 102; }, - isReservedWord: function () { return token >= 67 && token <= 102; }, + isIdentifier: function () { return token === 67 || token > 103; }, + isReservedWord: function () { return token >= 68 && token <= 103; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -2265,20 +2287,20 @@ var ts; contents += text.substring(start, pos); tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 10 : 13; + resultingToken = startedWithBacktick ? 11 : 14; break; } var currChar = text.charCodeAt(pos); if (currChar === 96) { contents += text.substring(start, pos); pos++; - resultingToken = startedWithBacktick ? 10 : 13; + resultingToken = startedWithBacktick ? 11 : 14; break; } if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) { contents += text.substring(start, pos); pos += 2; - resultingToken = startedWithBacktick ? 11 : 12; + resultingToken = startedWithBacktick ? 12 : 13; break; } if (currChar === 92) { @@ -2439,7 +2461,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 66; + return token = 67; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -2471,6 +2493,15 @@ var ts; return token = 1; } var ch = text.charCodeAt(pos); + if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } switch (ch) { case 10: case 13: @@ -2505,66 +2536,66 @@ var ts; case 33: if (text.charCodeAt(pos + 1) === 61) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 32; + return pos += 3, token = 33; } - return pos += 2, token = 30; + return pos += 2, token = 31; } - return pos++, token = 47; + return pos++, token = 48; case 34: case 39: tokenValue = scanString(); - return token = 8; + return token = 9; case 96: return token = scanTemplateAndSetTokenValue(); case 37: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 59; + return pos += 2, token = 60; } - return pos++, token = 38; + return pos++, token = 39; case 38: if (text.charCodeAt(pos + 1) === 38) { - return pos += 2, token = 49; + return pos += 2, token = 50; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 63; + return pos += 2, token = 64; } - return pos++, token = 44; + return pos++, token = 45; case 40: - return pos++, token = 16; - case 41: return pos++, token = 17; + case 41: + return pos++, token = 18; case 42: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 57; + return pos += 2, token = 58; } - return pos++, token = 36; + return pos++, token = 37; case 43: if (text.charCodeAt(pos + 1) === 43) { - return pos += 2, token = 39; + return pos += 2, token = 40; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 55; + return pos += 2, token = 56; } - return pos++, token = 34; + return pos++, token = 35; case 44: - return pos++, token = 23; + return pos++, token = 24; case 45: if (text.charCodeAt(pos + 1) === 45) { - return pos += 2, token = 40; + return pos += 2, token = 41; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 56; + return pos += 2, token = 57; } - return pos++, token = 35; + return pos++, token = 36; case 46: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); - return token = 7; + return token = 8; } if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { - return pos += 3, token = 21; + return pos += 3, token = 22; } - return pos++, token = 20; + return pos++, token = 21; case 47: if (text.charCodeAt(pos + 1) === 47) { pos += 2; @@ -2608,9 +2639,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 58; + return pos += 2, token = 59; } - return pos++, token = 37; + return pos++, token = 38; case 48: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { pos += 2; @@ -2620,7 +2651,7 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7; + return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; @@ -2630,7 +2661,7 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7; + return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; @@ -2640,11 +2671,11 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7; + return token = 8; } if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); - return token = 7; + return token = 8; } case 49: case 50: @@ -2656,11 +2687,11 @@ var ts; case 56: case 57: tokenValue = "" + scanNumber(); - return token = 7; + return token = 8; case 58: - return pos++, token = 52; + return pos++, token = 53; case 59: - return pos++, token = 22; + return pos++, token = 23; case 60: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2668,22 +2699,22 @@ var ts; continue; } else { - return token = 6; + return token = 7; } } if (text.charCodeAt(pos + 1) === 60) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 60; + return pos += 3, token = 61; } - return pos += 2, token = 41; + return pos += 2, token = 42; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 27; + return pos += 2, token = 28; } if (text.charCodeAt(pos + 1) === 47 && languageVariant === 1) { - return pos += 2, token = 25; + return pos += 2, token = 26; } - return pos++, token = 24; + return pos++, token = 25; case 61: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2691,19 +2722,19 @@ var ts; continue; } else { - return token = 6; + return token = 7; } } if (text.charCodeAt(pos + 1) === 61) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 31; + return pos += 3, token = 32; } - return pos += 2, token = 29; + return pos += 2, token = 30; } if (text.charCodeAt(pos + 1) === 62) { - return pos += 2, token = 33; + return pos += 2, token = 34; } - return pos++, token = 54; + return pos++, token = 55; case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2711,37 +2742,37 @@ var ts; continue; } else { - return token = 6; + return token = 7; } } - return pos++, token = 26; + return pos++, token = 27; case 63: - return pos++, token = 51; + return pos++, token = 52; case 91: - return pos++, token = 18; - case 93: return pos++, token = 19; + case 93: + return pos++, token = 20; case 94: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 65; + return pos += 2, token = 66; } - return pos++, token = 46; + return pos++, token = 47; case 123: - return pos++, token = 14; + return pos++, token = 15; case 124: if (text.charCodeAt(pos + 1) === 124) { - return pos += 2, token = 50; + return pos += 2, token = 51; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 64; + return pos += 2, token = 65; } - return pos++, token = 45; + return pos++, token = 46; case 125: - return pos++, token = 15; + return pos++, token = 16; case 126: - return pos++, token = 48; + return pos++, token = 49; case 64: - return pos++, token = 53; + return pos++, token = 54; case 92: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { @@ -2777,27 +2808,27 @@ var ts; } } function reScanGreaterToken() { - if (token === 26) { + if (token === 27) { if (text.charCodeAt(pos) === 62) { if (text.charCodeAt(pos + 1) === 62) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 62; + return pos += 3, token = 63; } - return pos += 2, token = 43; + return pos += 2, token = 44; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 61; + return pos += 2, token = 62; } - return pos++, token = 42; + return pos++, token = 43; } if (text.charCodeAt(pos) === 61) { - return pos++, token = 28; + return pos++, token = 29; } } return token; } function reScanSlashToken() { - if (token === 37 || token === 58) { + if (token === 38 || token === 59) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -2836,12 +2867,12 @@ var ts; } pos = p; tokenValue = text.substring(tokenPos, pos); - token = 9; + token = 10; } return token; } function reScanTemplateToken() { - ts.Debug.assert(token === 15, "'reScanTemplateToken' should only be called on a '}'"); + ts.Debug.assert(token === 16, "'reScanTemplateToken' should only be called on a '}'"); pos = tokenPos; return token = scanTemplateAndSetTokenValue(); } @@ -2858,14 +2889,14 @@ var ts; if (char === 60) { if (text.charCodeAt(pos + 1) === 47) { pos += 2; - return token = 25; + return token = 26; } pos++; - return token = 24; + return token = 25; } if (char === 123) { pos++; - return token = 14; + return token = 15; } while (pos < end) { pos++; @@ -2874,10 +2905,10 @@ var ts; break; } } - return token = 233; + return token = 234; } function scanJsxIdentifier() { - if (token === 66) { + if (token === 67) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); @@ -2949,16 +2980,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 212 || node.kind === 213) { + if (node.kind === 213 || node.kind === 214) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 219 || node.kind === 218) && !(node.flags & 1)) { + else if ((node.kind === 220 || node.kind === 219) && !(node.flags & 1)) { return 0; } - else if (node.kind === 216) { + else if (node.kind === 217) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -2974,7 +3005,7 @@ var ts; }); return state; } - else if (node.kind === 215) { + else if (node.kind === 216) { return getModuleInstanceState(node.body); } else { @@ -3026,10 +3057,10 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 215 && node.name.kind === 8) { - return '"' + node.name.text + '"'; + if (node.kind === 216 && node.name.kind === 9) { + return "\"" + node.name.text + "\""; } - if (node.name.kind === 133) { + if (node.name.kind === 134) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -3037,22 +3068,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 141: + case 142: return "__constructor"; - case 149: - case 144: - return "__call"; case 150: case 145: - return "__new"; + return "__call"; + case 151: case 146: + return "__new"; + case 147: return "__index"; - case 225: + case 226: return "__export"; - case 224: + case 225: return node.isExportEquals ? "export=" : "default"; - case 210: case 211: + case 212: return node.flags & 1024 ? "default" : undefined; } } @@ -3094,7 +3125,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 227 || (node.kind === 218 && hasExportModifier)) { + if (node.kind === 228 || (node.kind === 219 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -3140,37 +3171,37 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 183: - case 211: + case 184: case 212: - case 214: - case 152: - case 162: + case 213: + case 215: + case 153: + case 163: return 1; - case 144: case 145: case 146: - case 140: - case 139: - case 210: + case 147: case 141: + case 140: + case 211: case 142: case 143: - case 149: + case 144: case 150: - case 170: + case 151: case 171: - case 215: - case 245: - case 213: + case 172: + case 216: + case 246: + case 214: return 5; - case 241: - case 196: + case 242: case 197: case 198: - case 217: + case 199: + case 218: return 2; - case 189: + case 190: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -3186,33 +3217,33 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 215: + case 216: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 245: + case 246: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 183: - case 211: + case 184: + case 212: return declareClassMember(node, symbolFlags, symbolExcludes); - case 214: + case 215: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 152: - case 162: - case 212: + case 153: + case 163: + case 213: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 149: case 150: - case 144: + case 151: case 145: case 146: - case 140: - case 139: + case 147: case 141: + case 140: case 142: case 143: - case 210: - case 170: + case 144: + case 211: case 171: - case 213: + case 172: + case 214: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -3236,11 +3267,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 245 ? node : node.body; - if (body.kind === 245 || body.kind === 216) { + var body = node.kind === 246 ? node : node.body; + if (body.kind === 246 || body.kind === 217) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 225 || stat.kind === 224) { + if (stat.kind === 226 || stat.kind === 225) { return true; } } @@ -3257,7 +3288,7 @@ var ts; } function bindModuleDeclaration(node) { setExportContextFlag(node); - if (node.name.kind === 8) { + if (node.name.kind === 9) { declareSymbolAndAddToSymbolTable(node, 512, 106639); } else { @@ -3267,12 +3298,17 @@ var ts; } else { declareSymbolAndAddToSymbolTable(node, 512, 106639); - var currentModuleIsConstEnumOnly = state === 2; - if (node.symbol.constEnumOnlyModule === undefined) { - node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + if (node.symbol.flags & (16 | 32 | 256)) { + node.symbol.constEnumOnlyModule = false; } else { - node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + var currentModuleIsConstEnumOnly = state === 2; + if (node.symbol.constEnumOnlyModule === undefined) { + node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + } + else { + node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + } } } } @@ -3290,11 +3326,11 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 66) { + if (prop.name.kind !== 67) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 242 || prop.kind === 243 || prop.kind === 140 + var currentKind = prop.kind === 243 || prop.kind === 244 || prop.kind === 141 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -3316,10 +3352,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 215: + case 216: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 245: + case 246: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -3337,8 +3373,8 @@ var ts; } function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 103 && - node.originalKeywordKind <= 111 && + node.originalKeywordKind >= 104 && + node.originalKeywordKind <= 112 && !ts.isIdentifierName(node)) { if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); @@ -3365,17 +3401,17 @@ var ts; } } function checkStrictModeDeleteExpression(node) { - if (inStrictMode && node.expression.kind === 66) { + if (inStrictMode && node.expression.kind === 67) { var span = ts.getErrorSpanForNode(file, node.expression); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 66 && + return node.kind === 67 && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 66) { + if (name && name.kind === 67) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { var span = ts.getErrorSpanForNode(file, name); @@ -3409,7 +3445,7 @@ var ts; } function checkStrictModePrefixUnaryExpression(node) { if (inStrictMode) { - if (node.operator === 39 || node.operator === 40) { + if (node.operator === 40 || node.operator === 41) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -3438,17 +3474,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 245: - case 216: + case 246: + case 217: updateStrictModeStatementList(node.statements); return; - case 189: + case 190: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 211: - case 183: + case 212: + case 184: inStrictMode = true; return; } @@ -3467,106 +3503,106 @@ var ts; } function isUseStrictPrologueDirective(node) { var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - return nodeText === '"use strict"' || nodeText === "'use strict'"; + return nodeText === "\"use strict\"" || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { - case 66: + case 67: return checkStrictModeIdentifier(node); - case 178: + case 179: return checkStrictModeBinaryExpression(node); - case 241: + case 242: return checkStrictModeCatchClause(node); - case 172: + case 173: return checkStrictModeDeleteExpression(node); - case 7: + case 8: return checkStrictModeNumericLiteral(node); - case 177: + case 178: return checkStrictModePostfixUnaryExpression(node); - case 176: + case 177: return checkStrictModePrefixUnaryExpression(node); - case 202: + case 203: return checkStrictModeWithStatement(node); - case 134: - return declareSymbolAndAddToSymbolTable(node, 262144, 530912); case 135: + return declareSymbolAndAddToSymbolTable(node, 262144, 530912); + case 136: return bindParameter(node); - case 208: - case 160: + case 209: + case 161: return bindVariableDeclarationOrBindingElement(node); + case 139: case 138: - case 137: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 242: case 243: - return bindPropertyOrMethodOrAccessor(node, 4, 107455); case 244: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 245: return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 144: case 145: case 146: + case 147: return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 141: case 140: - case 139: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 210: + case 211: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16, 106927); - case 141: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 142: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 143: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 144: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 149: case 150: + case 151: return bindFunctionOrConstructorType(node); - case 152: + case 153: return bindAnonymousDeclaration(node, 2048, "__type"); - case 162: + case 163: return bindObjectLiteralExpression(node); - case 170: case 171: + case 172: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16, bindingName); - case 183: - case 211: - return bindClassLikeDeclaration(node); + case 184: case 212: - return bindBlockScopedDeclaration(node, 64, 792960); + return bindClassLikeDeclaration(node); case 213: - return bindBlockScopedDeclaration(node, 524288, 793056); + return bindBlockScopedDeclaration(node, 64, 792960); case 214: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 793056); case 215: + return bindEnumDeclaration(node); + case 216: return bindModuleDeclaration(node); - case 218: - case 221: - case 223: - case 227: + case 219: + case 222: + case 224: + case 228: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 220: + case 221: return bindImportClause(node); - case 225: + case 226: return bindExportDeclaration(node); - case 224: + case 225: return bindExportAssignment(node); - case 245: + case 246: return bindSourceFileIfExternalModule(); } } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512, '"' + ts.removeFileExtension(file.fileName) + '"'); + bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); } } function bindExportAssignment(node) { if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (node.expression.kind === 66) { + else if (node.expression.kind === 67) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { @@ -3587,7 +3623,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 211) { + if (node.kind === 212) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -3637,7 +3673,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 1, 107455); } if (node.flags & 112 && - node.parent.kind === 141 && + node.parent.kind === 142 && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); @@ -3699,6 +3735,37 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; + function arrayIsEqualTo(arr1, arr2, comparer) { + if (!arr1 || !arr2) { + return arr1 === arr2; + } + if (arr1.length !== arr2.length) { + return false; + } + for (var i = 0; i < arr1.length; ++i) { + var equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i]; + if (!equals) { + return false; + } + } + return true; + } + ts.arrayIsEqualTo = arrayIsEqualTo; + function hasResolvedModuleName(sourceFile, moduleNameText) { + return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); + } + ts.hasResolvedModuleName = hasResolvedModuleName; + function getResolvedModuleFileName(sourceFile, moduleNameText) { + return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + } + ts.getResolvedModuleFileName = getResolvedModuleFileName; + function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) { + if (!sourceFile.resolvedModules) { + sourceFile.resolvedModules = {}; + } + sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + } + ts.setResolvedModuleName = setResolvedModuleName; function containsParseError(node) { aggregateChildData(node); return (node.parserContextFlags & 64) !== 0; @@ -3715,7 +3782,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 245) { + while (node && node.kind !== 246) { node = node.parent; } return node; @@ -3791,7 +3858,7 @@ var ts; } ts.unescapeIdentifier = unescapeIdentifier; function makeIdentifierFromModuleName(moduleName) { - return ts.getBaseFileName(moduleName).replace(/\W/g, "_"); + return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { @@ -3806,15 +3873,15 @@ var ts; return current; } switch (current.kind) { - case 245: - case 217: - case 241: - case 215: - case 196: + case 246: + case 218: + case 242: + case 216: case 197: case 198: + case 199: return current; - case 189: + case 190: if (!isFunctionLike(current.parent)) { return current; } @@ -3825,9 +3892,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 208 && + declaration.kind === 209 && declaration.parent && - declaration.parent.kind === 241; + declaration.parent.kind === 242; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3863,22 +3930,22 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 245: + case 246: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 208: - case 160: - case 211: - case 183: + case 209: + case 161: case 212: + case 184: + case 213: + case 216: case 215: - case 214: - case 244: - case 210: - case 170: + case 245: + case 211: + case 171: errorNode = node.name; break; } @@ -3900,11 +3967,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 214 && isConst(node); + return node.kind === 215 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 160 || isBindingPattern(node))) { + while (node && (node.kind === 161 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3912,14 +3979,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 208) { + if (node.kind === 209) { node = node.parent; } - if (node && node.kind === 209) { + if (node && node.kind === 210) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 190) { + if (node && node.kind === 191) { flags |= node.flags; } return flags; @@ -3934,20 +4001,18 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 192 && node.expression.kind === 8; + return node.kind === 193 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { - if (node.kind === 135 || node.kind === 134) { - return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); - } - else { - return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); - } + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); + var commentRanges = (node.kind === 136 || node.kind === 135) ? + ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : + getLeadingCommentRangesOfNode(node, sourceFileOfNode); + return ts.filter(commentRanges, isJsDocComment); function isJsDocComment(comment) { return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && @@ -3957,68 +4022,68 @@ var ts; ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (148 <= node.kind && node.kind <= 157) { + if (149 <= node.kind && node.kind <= 158) { return true; } switch (node.kind) { - case 114: - case 125: - case 127: - case 117: + case 115: + case 126: case 128: + case 118: + case 129: return true; - case 100: - return node.parent.kind !== 174; - case 8: - return node.parent.kind === 135; - case 185: + case 101: + return node.parent.kind !== 175; + case 9: + return node.parent.kind === 136; + case 186: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 66: - if (node.parent.kind === 132 && node.parent.right === node) { + case 67: + if (node.parent.kind === 133 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 163 && node.parent.name === node) { + else if (node.parent.kind === 164 && node.parent.name === node) { node = node.parent; } - case 132: - case 163: - ts.Debug.assert(node.kind === 66 || node.kind === 132 || node.kind === 163, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 133: + case 164: + ts.Debug.assert(node.kind === 67 || node.kind === 133 || node.kind === 164, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_1 = node.parent; - if (parent_1.kind === 151) { + if (parent_1.kind === 152) { return false; } - if (148 <= parent_1.kind && parent_1.kind <= 157) { + if (149 <= parent_1.kind && parent_1.kind <= 158) { return true; } switch (parent_1.kind) { - case 185: + case 186: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 134: + case 135: return node === parent_1.constraint; + case 139: case 138: - case 137: - case 135: - case 208: + case 136: + case 209: return node === parent_1.type; - case 210: - case 170: + case 211: case 171: + case 172: + case 142: case 141: case 140: - case 139: - case 142: case 143: - return node === parent_1.type; case 144: + return node === parent_1.type; case 145: case 146: + case 147: return node === parent_1.type; - case 168: + case 169: return node === parent_1.type; - case 165: case 166: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 167: + return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + case 168: return false; } } @@ -4029,23 +4094,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201: + case 202: return visitor(node); - case 217: - case 189: - case 193: + case 218: + case 190: case 194: case 195: case 196: case 197: case 198: - case 202: + case 199: case 203: - case 238: - case 239: case 204: - case 206: - case 241: + case 239: + case 240: + case 205: + case 207: + case 242: return ts.forEachChild(node, traverse); } } @@ -4055,23 +4120,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 181: + case 182: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 214: - case 212: case 215: case 213: - case 211: - case 183: + case 216: + case 214: + case 212: + case 184: return; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 133) { + if (name_5 && name_5.kind === 134) { traverse(name_5.expression); return; } @@ -4086,14 +4151,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 160: - case 244: - case 135: - case 242: - case 138: - case 137: + case 161: + case 245: + case 136: case 243: - case 208: + case 139: + case 138: + case 244: + case 209: return true; } } @@ -4101,41 +4166,55 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 142 || node.kind === 143); + return node && (node.kind === 143 || node.kind === 144); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 211 || node.kind === 183); + return node && (node.kind === 212 || node.kind === 184); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 141: - case 170: - case 210: + case 142: case 171: + case 211: + case 172: + case 141: case 140: - case 139: - case 142: case 143: case 144: case 145: case 146: - case 149: + case 147: case 150: + case 151: return true; } } return false; } ts.isFunctionLike = isFunctionLike; + function introducesArgumentsExoticObject(node) { + switch (node.kind) { + case 141: + case 140: + case 142: + case 143: + case 144: + case 211: + case 171: + return true; + } + return false; + } + ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 189 && isFunctionLike(node.parent); + return node && node.kind === 190 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 140 && node.parent.kind === 162; + return node && node.kind === 141 && node.parent.kind === 163; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -4163,36 +4242,36 @@ var ts; return undefined; } switch (node.kind) { - case 133: + case 134: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 136: - if (node.parent.kind === 135 && isClassElement(node.parent.parent)) { + case 137: + if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 171: + case 172: if (!includeArrowFunctions) { continue; } - case 210: - case 170: - case 215: - case 138: - case 137: - case 140: + case 211: + case 171: + case 216: case 139: + case 138: case 141: + case 140: case 142: case 143: - case 214: - case 245: + case 144: + case 215: + case 246: return node; } } @@ -4204,33 +4283,33 @@ var ts; if (!node) return node; switch (node.kind) { - case 133: + case 134: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 136: - if (node.parent.kind === 135 && isClassElement(node.parent.parent)) { + case 137: + if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 210: - case 170: + case 211: case 171: + case 172: if (!includeFunctions) { continue; } - case 138: - case 137: - case 140: case 139: + case 138: case 141: + case 140: case 142: case 143: + case 144: return node; } } @@ -4239,12 +4318,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 148: + case 149: return node.typeName; - case 185: + case 186: return node.expression; - case 66: - case 132: + case 67: + case 133: return node; } } @@ -4252,7 +4331,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 167) { + if (node.kind === 168) { return node.tag; } return node.expression; @@ -4260,40 +4339,40 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 211: + case 212: return true; - case 138: - return node.parent.kind === 211; - case 135: - return node.parent.body && node.parent.parent.kind === 211; - case 142: + case 139: + return node.parent.kind === 212; + case 136: + return node.parent.body && node.parent.parent.kind === 212; case 143: - case 140: - return node.body && node.parent.kind === 211; + case 144: + case 141: + return node.body && node.parent.kind === 212; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 211: + case 212: if (node.decorators) { return true; } return false; - case 138: - case 135: + case 139: + case 136: if (node.decorators) { return true; } return false; - case 142: + case 143: if (node.body && node.decorators) { return true; } return false; - case 140: - case 143: + case 141: + case 144: if (node.body && node.decorators) { return true; } @@ -4304,10 +4383,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 211: + case 212: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 140: - case 143: + case 141: + case 144: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -4319,92 +4398,92 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function isExpression(node) { switch (node.kind) { - case 94: - case 92: - case 90: - case 96: - case 81: - case 9: - case 161: + case 95: + case 93: + case 91: + case 97: + case 82: + case 10: case 162: case 163: case 164: case 165: case 166: case 167: - case 186: case 168: + case 187: case 169: case 170: - case 183: case 171: - case 174: + case 184: case 172: + case 175: case 173: - case 176: + case 174: case 177: case 178: case 179: - case 182: case 180: - case 10: - case 184: - case 230: - case 231: + case 183: case 181: + case 11: + case 185: + case 231: + case 232: + case 182: return true; - case 132: - while (node.parent.kind === 132) { + case 133: + while (node.parent.kind === 133) { node = node.parent; } - return node.parent.kind === 151; - case 66: - if (node.parent.kind === 151) { + return node.parent.kind === 152; + case 67: + if (node.parent.kind === 152) { return true; } - case 7: case 8: + case 9: var parent_2 = node.parent; switch (parent_2.kind) { - case 208: - case 135: + case 209: + case 136: + case 139: case 138: - case 137: - case 244: - case 242: - case 160: + case 245: + case 243: + case 161: return parent_2.initializer === node; - case 192: case 193: case 194: case 195: - case 201: + case 196: case 202: case 203: - case 238: - case 205: - case 203: + case 204: + case 239: + case 206: + case 204: return parent_2.expression === node; - case 196: + case 197: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 209) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 210) || forStatement.condition === node || forStatement.incrementor === node; - case 197: case 198: + case 199: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 209) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210) || forInStatement.expression === node; - case 168: - case 186: - return node === parent_2.expression; + case 169: case 187: return node === parent_2.expression; - case 133: + case 188: return node === parent_2.expression; - case 136: + case 134: + return node === parent_2.expression; + case 137: return true; - case 185: + case 186: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -4422,7 +4501,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 218 && node.moduleReference.kind === 229; + return node.kind === 219 && node.moduleReference.kind === 230; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4431,20 +4510,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 218 && node.moduleReference.kind !== 229; + return node.kind === 219 && node.moduleReference.kind !== 230; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 219) { + if (node.kind === 220) { return node.moduleSpecifier; } - if (node.kind === 218) { + if (node.kind === 219) { var reference = node.moduleReference; - if (reference.kind === 229) { + if (reference.kind === 230) { return reference.expression; } } - if (node.kind === 225) { + if (node.kind === 226) { return node.moduleSpecifier; } } @@ -4452,15 +4531,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 135: - return node.questionToken !== undefined; + case 136: + case 141: case 140: - case 139: - return node.questionToken !== undefined; + case 244: case 243: - case 242: + case 139: case 138: - case 137: return node.questionToken !== undefined; } } @@ -4468,9 +4545,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 258 && + return node.kind === 259 && node.parameters.length > 0 && - node.parameters[0].type.kind === 260; + node.parameters[0].type.kind === 261; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -4484,24 +4561,24 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 266); + return getJSDocTag(node, 267); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 265); + return getJSDocTag(node, 266); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 267); + return getJSDocTag(node, 268); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 66) { + if (parameter.name && parameter.name.kind === 67) { var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 264) { + if (t.kind === 265) { var parameterTag = t; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -4520,12 +4597,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32) { - if (node.type && node.type.kind === 259) { + if (node.type && node.type.kind === 260) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 259; + return paramTag.typeExpression.type.kind === 260; } } return node.dotDotDotToken !== undefined; @@ -4534,19 +4611,19 @@ var ts; } ts.isRestParameter = isRestParameter; function isLiteralKind(kind) { - return 7 <= kind && kind <= 10; + return 8 <= kind && kind <= 11; } ts.isLiteralKind = isLiteralKind; function isTextualLiteralKind(kind) { - return kind === 8 || kind === 10; + return kind === 9 || kind === 11; } ts.isTextualLiteralKind = isTextualLiteralKind; function isTemplateLiteralKind(kind) { - return 10 <= kind && kind <= 13; + return 11 <= kind && kind <= 14; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 159 || node.kind === 158); + return !!node && (node.kind === 160 || node.kind === 159); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -4561,34 +4638,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 171: - case 160: + case 172: + case 161: + case 212: + case 184: + case 142: + case 215: + case 245: + case 228: case 211: - case 183: + case 171: + case 143: + case 221: + case 219: + case 224: + case 213: case 141: - case 214: - case 244: - case 227: - case 210: - case 170: - case 142: - case 220: - case 218: - case 223: - case 212: case 140: + case 216: + case 222: + case 136: + case 243: case 139: - case 215: - case 221: - case 135: - case 242: case 138: - case 137: - case 143: - case 243: - case 213: - case 134: - case 208: + case 144: + case 244: + case 214: + case 135: + case 209: return true; } return false; @@ -4596,25 +4673,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { + case 201: case 200: + case 208: + case 195: + case 193: + case 192: + case 198: case 199: - case 207: + case 197: case 194: - case 192: + case 205: + case 202: + case 204: + case 96: + case 207: case 191: - case 197: - case 198: case 196: - case 193: - case 204: - case 201: case 203: - case 95: - case 206: - case 190: - case 195: - case 202: - case 224: + case 225: return true; default: return false; @@ -4623,13 +4700,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 141: - case 138: - case 140: case 142: - case 143: case 139: - case 146: + case 141: + case 143: + case 144: + case 140: + case 147: return true; default: return false; @@ -4637,11 +4714,11 @@ var ts; } ts.isClassElement = isClassElement; function isDeclarationName(name) { - if (name.kind !== 66 && name.kind !== 8 && name.kind !== 7) { + if (name.kind !== 67 && name.kind !== 9 && name.kind !== 8) { return false; } var parent = name.parent; - if (parent.kind === 223 || parent.kind === 227) { + if (parent.kind === 224 || parent.kind === 228) { if (parent.propertyName) { return true; } @@ -4655,54 +4732,54 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { + case 139: case 138: - case 137: + case 141: case 140: - case 139: - case 142: case 143: - case 244: - case 242: - case 163: + case 144: + case 245: + case 243: + case 164: return parent.name === node; - case 132: + case 133: if (parent.right === node) { - while (parent.kind === 132) { + while (parent.kind === 133) { parent = parent.parent; } - return parent.kind === 151; + return parent.kind === 152; } return false; - case 160: - case 223: + case 161: + case 224: return parent.propertyName === node; - case 227: + case 228: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 218 || - node.kind === 220 && !!node.name || - node.kind === 221 || - node.kind === 223 || - node.kind === 227 || - node.kind === 224 && node.expression.kind === 66; + return node.kind === 219 || + node.kind === 221 && !!node.name || + node.kind === 222 || + node.kind === 224 || + node.kind === 228 || + node.kind === 225 && node.expression.kind === 67; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 80); + var heritageClause = getHeritageClause(node.heritageClauses, 81); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 103); + var heritageClause = getHeritageClause(node.heritageClauses, 104); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 80); + var heritageClause = getHeritageClause(node.heritageClauses, 81); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -4771,11 +4848,11 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 67 <= token && token <= 131; + return 68 <= token && token <= 132; } ts.isKeyword = isKeyword; function isTrivia(token) { - return 2 <= token && token <= 6; + return 2 <= token && token <= 7; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { @@ -4784,19 +4861,19 @@ var ts; ts.isAsyncFunctionLike = isAsyncFunctionLike; function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 133 && + declaration.name.kind === 134 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { - return node.kind === 163 && isESSymbolIdentifier(node.expression); + return node.kind === 164 && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 66 || name.kind === 8 || name.kind === 7) { + if (name.kind === 67 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 133) { + if (name.kind === 134) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -4811,21 +4888,21 @@ var ts; } ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; function isESSymbolIdentifier(node) { - return node.kind === 66 && node.text === "Symbol"; + return node.kind === 67 && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 112: - case 115: - case 71: - case 119: - case 74: - case 79: - case 109: - case 107: - case 108: + case 113: + case 116: + case 72: + case 120: + case 75: + case 80: case 110: + case 108: + case 109: + case 111: return true; } return false; @@ -4833,20 +4910,36 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 135; + return root.kind === 136; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 160) { + while (node.kind === 161) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 215 || n.kind === 245; + return isFunctionLike(n) || n.kind === 216 || n.kind === 246; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; + function cloneEntityName(node) { + if (node.kind === 67) { + var clone_1 = createSynthesizedNode(67); + clone_1.text = node.text; + return clone_1; + } + else { + var clone_2 = createSynthesizedNode(133); + clone_2.left = cloneEntityName(node.left); + clone_2.left.parent = clone_2; + clone_2.right = cloneEntityName(node.right); + clone_2.right.parent = clone_2; + return clone_2; + } + } + ts.cloneEntityName = cloneEntityName; function nodeIsSynthesized(node) { return node.pos === -1; } @@ -5071,7 +5164,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 141 && nodeIsPresent(member.body)) { + if (member.kind === 142 && nodeIsPresent(member.body)) { return member; } }); @@ -5083,7 +5176,7 @@ var ts; ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; function shouldEmitToOwnFile(sourceFile, compilerOptions) { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out)) { + if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { return compilerOptions.isolatedModules || !ts.fileExtensionIs(sourceFile.fileName, ".js"); } return false; @@ -5098,10 +5191,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 142) { + if (accessor.kind === 143) { getAccessor = accessor; } - else if (accessor.kind === 143) { + else if (accessor.kind === 144) { setAccessor = accessor; } else { @@ -5110,7 +5203,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 142 || member.kind === 143) + if ((member.kind === 143 || member.kind === 144) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -5121,10 +5214,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 142 && !getAccessor) { + if (member.kind === 143 && !getAccessor) { getAccessor = member; } - if (member.kind === 143 && !setAccessor) { + if (member.kind === 144 && !setAccessor) { setAccessor = member; } } @@ -5203,7 +5296,7 @@ var ts; } function writeTrimmedCurrentLine(pos, nextLineStart) { var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); + var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); if (currentLineText) { writer.write(currentLineText); if (end !== comment.end) { @@ -5230,16 +5323,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 110: return 128; - case 109: return 16; - case 108: return 64; - case 107: return 32; - case 112: return 256; - case 79: return 1; - case 119: return 2; - case 71: return 32768; - case 74: return 1024; - case 115: return 512; + case 111: return 128; + case 110: return 16; + case 109: return 64; + case 108: return 32; + case 113: return 256; + case 80: return 1; + case 120: return 2; + case 72: return 32768; + case 75: return 1024; + case 116: return 512; } return 0; } @@ -5247,29 +5340,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 163: case 164: - case 166: case 165: - case 230: - case 231: case 167: - case 161: - case 169: + case 166: + case 231: + case 232: + case 168: case 162: - case 183: case 170: - case 66: - case 9: - case 7: - case 8: + case 163: + case 184: + case 171: + case 67: case 10: - case 180: - case 81: - case 90: - case 94: - case 96: - case 92: + case 8: + case 9: + case 11: + case 181: + case 82: + case 91: + case 95: + case 97: + case 93: return true; } } @@ -5277,12 +5370,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 54 && token <= 65; + return token >= 55 && token <= 66; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 185 && - node.parent.token === 80 && + return node.kind === 186 && + node.parent.token === 81 && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -5291,10 +5384,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 66) { + if (node.kind === 67) { return true; } - else if (node.kind === 163) { + else if (node.kind === 164) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -5302,10 +5395,21 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 132 && node.parent.right === node) || - (node.parent.kind === 163 && node.parent.name === node); + return (node.parent.kind === 133 && node.parent.right === node) || + (node.parent.kind === 164 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function isEmptyObjectLiteralOrArrayLiteral(expression) { + var kind = expression.kind; + if (kind === 163) { + return expression.properties.length === 0; + } + if (kind === 162) { + return expression.elements.length === 0; + } + return false; + } + ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024) ? symbol.valueDeclaration.localSymbol : undefined; } @@ -5509,9 +5613,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 134) { + if (d && d.kind === 135) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 212) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213) { return current; } } @@ -5523,7 +5627,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(269); + var nodeConstructors = new Array(270); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5561,20 +5665,20 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 132: + case 133: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 134: + case 135: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 135: + case 136: + case 139: case 138: - case 137: - case 242: case 243: - case 208: - case 160: + case 244: + case 209: + case 161: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5583,24 +5687,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 149: case 150: - case 144: + case 151: case 145: case 146: + case 147: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 140: - case 139: case 141: + case 140: case 142: case 143: - case 170: - case 210: + case 144: case 171: + case 211: + case 172: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -5611,290 +5715,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 148: + case 149: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 147: + case 148: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 151: - return visitNode(cbNode, node.exprName); case 152: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 153: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 154: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 155: + return visitNodes(cbNodes, node.elementTypes); case 156: - return visitNodes(cbNodes, node.types); case 157: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); case 158: + return visitNode(cbNode, node.type); case 159: - return visitNodes(cbNodes, node.elements); - case 161: + case 160: return visitNodes(cbNodes, node.elements); case 162: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 163: + return visitNodes(cbNodes, node.properties); + case 164: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 164: + case 165: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 165: case 166: + case 167: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 167: + case 168: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 168: + case 169: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 169: - return visitNode(cbNode, node.expression); - case 172: + case 170: return visitNode(cbNode, node.expression); case 173: return visitNode(cbNode, node.expression); case 174: return visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.operand); - case 181: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 175: return visitNode(cbNode, node.expression); case 177: return visitNode(cbNode, node.operand); + case 182: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 176: + return visitNode(cbNode, node.expression); case 178: + return visitNode(cbNode, node.operand); + case 179: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 186: + case 187: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 179: + case 180: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 182: + case 183: return visitNode(cbNode, node.expression); - case 189: - case 216: + case 190: + case 217: return visitNodes(cbNodes, node.statements); - case 245: + case 246: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 190: + case 191: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 209: + case 210: return visitNodes(cbNodes, node.declarations); - case 192: - return visitNode(cbNode, node.expression); case 193: + return visitNode(cbNode, node.expression); + case 194: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 194: + case 195: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 195: + case 196: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 196: + case 197: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 197: + case 198: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 198: + case 199: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 199: case 200: - return visitNode(cbNode, node.label); case 201: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.label); case 202: + return visitNode(cbNode, node.expression); + case 203: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 203: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 217: + case 218: return visitNodes(cbNodes, node.clauses); - case 238: + case 239: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 239: + case 240: return visitNodes(cbNodes, node.statements); - case 204: + case 205: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 205: - return visitNode(cbNode, node.expression); case 206: + return visitNode(cbNode, node.expression); + case 207: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 241: + case 242: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 136: + case 137: return visitNode(cbNode, node.expression); - case 211: - case 183: + case 212: + case 184: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 212: + case 213: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 213: + case 214: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 214: + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 244: + case 245: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 215: + case 216: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 218: + case 219: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 219: + case 220: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 220: + case 221: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 221: - return visitNode(cbNode, node.name); case 222: - case 226: + return visitNode(cbNode, node.name); + case 223: + case 227: return visitNodes(cbNodes, node.elements); - case 225: + case 226: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 223: - case 227: + case 224: + case 228: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 224: + case 225: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 180: + case 181: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 187: + case 188: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 133: + case 134: return visitNode(cbNode, node.expression); - case 240: + case 241: return visitNodes(cbNodes, node.types); - case 185: + case 186: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 229: + case 230: return visitNode(cbNode, node.expression); - case 228: + case 229: return visitNodes(cbNodes, node.decorators); - case 230: + case 231: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 231: case 232: + case 233: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 235: + case 236: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 236: - return visitNode(cbNode, node.expression); case 237: return visitNode(cbNode, node.expression); - case 234: + case 238: + return visitNode(cbNode, node.expression); + case 235: return visitNode(cbNode, node.tagName); - case 246: + case 247: return visitNode(cbNode, node.type); - case 250: - return visitNodes(cbNodes, node.types); case 251: return visitNodes(cbNodes, node.types); - case 249: + case 252: + return visitNodes(cbNodes, node.types); + case 250: return visitNode(cbNode, node.elementType); - case 253: + case 254: return visitNode(cbNode, node.type); - case 252: + case 253: return visitNode(cbNode, node.type); - case 254: + case 255: return visitNodes(cbNodes, node.members); - case 256: + case 257: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 257: - return visitNode(cbNode, node.type); case 258: + return visitNode(cbNode, node.type); + case 259: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 259: - return visitNode(cbNode, node.type); case 260: return visitNode(cbNode, node.type); case 261: return visitNode(cbNode, node.type); - case 255: + case 262: + return visitNode(cbNode, node.type); + case 256: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 262: + case 263: return visitNodes(cbNodes, node.tags); - case 264: + case 265: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 265: - return visitNode(cbNode, node.typeExpression); case 266: return visitNode(cbNode, node.typeExpression); case 267: + return visitNode(cbNode, node.typeExpression); + case 268: return visitNodes(cbNodes, node.typeParameters); } } @@ -5990,9 +6094,9 @@ var ts; return; function visit(node) { switch (node.kind) { - case 190: - case 210: - case 135: + case 191: + case 211: + case 136: addJSDocComment(node); } forEachChild(node, visit); @@ -6030,7 +6134,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(245, 0); + var sourceFile = createNode(246, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6163,6 +6267,9 @@ var ts; function scanJsxIdentifier() { return token = scanner.scanJsxIdentifier(); } + function scanJsxText() { + return token = scanner.scanJsxToken(); + } function speculationHelper(callback, isLookAhead) { var saveToken = token; var saveParseDiagnosticsLength = parseDiagnostics.length; @@ -6186,20 +6293,23 @@ var ts; return speculationHelper(callback, false); } function isIdentifier() { - if (token === 66) { + if (token === 67) { return true; } - if (token === 111 && inYieldContext()) { + if (token === 112 && inYieldContext()) { return false; } - if (token === 116 && inAwaitContext()) { + if (token === 117 && inAwaitContext()) { return false; } - return token > 102; + return token > 103; } - function parseExpected(kind, diagnosticMessage) { + function parseExpected(kind, diagnosticMessage, shouldAdvance) { + if (shouldAdvance === void 0) { shouldAdvance = true; } if (token === kind) { - nextToken(); + if (shouldAdvance) { + nextToken(); + } return true; } if (diagnosticMessage) { @@ -6233,20 +6343,20 @@ var ts; return finishNode(node); } function canParseSemicolon() { - if (token === 22) { + if (token === 23) { return true; } - return token === 15 || token === 1 || scanner.hasPrecedingLineBreak(); + return token === 16 || token === 1 || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 22) { + if (token === 23) { nextToken(); } return true; } else { - return parseExpected(22); + return parseExpected(23); } } function createNode(kind, pos) { @@ -6288,15 +6398,15 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(66); - if (token !== 66) { + var node = createNode(67); + if (token !== 67) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(66, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(67, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -6306,14 +6416,14 @@ var ts; } function isLiteralPropertyName() { return isIdentifierOrKeyword() || - token === 8 || - token === 7; + token === 9 || + token === 8; } function parsePropertyNameWorker(allowComputedPropertyNames) { - if (token === 8 || token === 7) { + if (token === 9 || token === 8) { return parseLiteralNode(true); } - if (allowComputedPropertyNames && token === 18) { + if (allowComputedPropertyNames && token === 19) { return parseComputedPropertyName(); } return parseIdentifierName(); @@ -6325,30 +6435,30 @@ var ts; return parsePropertyNameWorker(false); } function isSimplePropertyName() { - return token === 8 || token === 7 || isIdentifierOrKeyword(); + return token === 9 || token === 8 || isIdentifierOrKeyword(); } function parseComputedPropertyName() { - var node = createNode(133); - parseExpected(18); - node.expression = allowInAnd(parseExpression); + var node = createNode(134); parseExpected(19); + node.expression = allowInAnd(parseExpression); + parseExpected(20); return finishNode(node); } function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 71) { - return nextToken() === 78; + if (token === 72) { + return nextToken() === 79; } - if (token === 79) { + if (token === 80) { nextToken(); - if (token === 74) { + if (token === 75) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 36 && token !== 14 && canFollowModifier(); + return token !== 37 && token !== 15 && canFollowModifier(); } - if (token === 74) { + if (token === 75) { return nextTokenIsClassOrFunction(); } nextToken(); @@ -6358,14 +6468,14 @@ var ts; return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { - return token === 18 - || token === 14 - || token === 36 + return token === 19 + || token === 15 + || token === 37 || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); - return token === 70 || token === 84; + return token === 71 || token === 85; } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -6376,21 +6486,21 @@ var ts; case 0: case 1: case 3: - return !(token === 22 && inErrorRecovery) && isStartOfStatement(); + return !(token === 23 && inErrorRecovery) && isStartOfStatement(); case 2: - return token === 68 || token === 74; + return token === 69 || token === 75; case 4: return isStartOfTypeMember(); case 5: - return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); + return lookAhead(isClassMemberStart) || (token === 23 && !inErrorRecovery); case 6: - return token === 18 || isLiteralPropertyName(); + return token === 19 || isLiteralPropertyName(); case 12: - return token === 18 || token === 36 || isLiteralPropertyName(); + return token === 19 || token === 37 || isLiteralPropertyName(); case 9: return isLiteralPropertyName(); case 7: - if (token === 14) { + if (token === 15) { return lookAhead(isValidHeritageClauseObjectLiteral); } if (!inErrorRecovery) { @@ -6402,23 +6512,23 @@ var ts; case 8: return isIdentifierOrPattern(); case 10: - return token === 23 || token === 21 || isIdentifierOrPattern(); + return token === 24 || token === 22 || isIdentifierOrPattern(); case 17: return isIdentifier(); case 11: case 15: - return token === 23 || token === 21 || isStartOfExpression(); + return token === 24 || token === 22 || isStartOfExpression(); case 16: return isStartOfParameter(); case 18: case 19: - return token === 23 || isStartOfType(); + return token === 24 || isStartOfType(); case 20: return isHeritageClause(); case 21: return isIdentifierOrKeyword(); case 13: - return isIdentifierOrKeyword() || token === 14; + return isIdentifierOrKeyword() || token === 15; case 14: return true; case 22: @@ -6431,10 +6541,10 @@ var ts; ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } function isValidHeritageClauseObjectLiteral() { - ts.Debug.assert(token === 14); - if (nextToken() === 15) { + ts.Debug.assert(token === 15); + if (nextToken() === 16) { var next = nextToken(); - return next === 23 || next === 14 || next === 80 || next === 103; + return next === 24 || next === 15 || next === 81 || next === 104; } return true; } @@ -6447,8 +6557,8 @@ var ts; return isIdentifierOrKeyword(); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 103 || - token === 80) { + if (token === 104 || + token === 81) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -6470,39 +6580,39 @@ var ts; case 12: case 9: case 21: - return token === 15; + return token === 16; case 3: - return token === 15 || token === 68 || token === 74; + return token === 16 || token === 69 || token === 75; case 7: - return token === 14 || token === 80 || token === 103; + return token === 15 || token === 81 || token === 104; case 8: return isVariableDeclaratorListTerminator(); case 17: - return token === 26 || token === 16 || token === 14 || token === 80 || token === 103; + return token === 27 || token === 17 || token === 15 || token === 81 || token === 104; case 11: - return token === 17 || token === 22; + return token === 18 || token === 23; case 15: case 19: case 10: - return token === 19; + return token === 20; case 16: - return token === 17 || token === 19; + return token === 18 || token === 20; case 18: - return token === 26 || token === 16; + return token === 27 || token === 17; case 20: - return token === 14 || token === 15; + return token === 15 || token === 16; case 13: - return token === 26 || token === 37; + return token === 27 || token === 38; case 14: - return token === 24 && lookAhead(nextTokenIsSlash); + return token === 25 && lookAhead(nextTokenIsSlash); case 22: - return token === 17 || token === 52 || token === 15; + return token === 18 || token === 53 || token === 16; case 23: - return token === 26 || token === 15; + return token === 27 || token === 16; case 25: - return token === 19 || token === 15; + return token === 20 || token === 16; case 24: - return token === 15; + return token === 16; } } function isVariableDeclaratorListTerminator() { @@ -6512,7 +6622,7 @@ var ts; if (isInOrOfKeyword(token)) { return true; } - if (token === 33) { + if (token === 34) { return true; } return false; @@ -6617,17 +6727,17 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 141: - case 146: case 142: + case 147: case 143: - case 138: - case 188: + case 144: + case 139: + case 189: return true; - case 140: + case 141: var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 66 && - methodDeclaration.name.originalKeywordKind === 118; + var nameIsConstructor = methodDeclaration.name.kind === 67 && + methodDeclaration.name.originalKeywordKind === 119; return !nameIsConstructor; } } @@ -6636,8 +6746,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 238: case 239: + case 240: return true; } } @@ -6646,65 +6756,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 210: + case 211: + case 191: case 190: - case 189: + case 194: case 193: - case 192: - case 205: + case 206: + case 202: + case 204: case 201: - case 203: case 200: + case 198: case 199: case 197: - case 198: case 196: - case 195: - case 202: - case 191: - case 206: - case 204: - case 194: + case 203: + case 192: case 207: + case 205: + case 195: + case 208: + case 220: case 219: - case 218: + case 226: case 225: - case 224: - case 215: - case 211: + case 216: case 212: - case 214: case 213: + case 215: + case 214: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 244; + return node.kind === 245; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 145: - case 139: case 146: - case 137: - case 144: + case 140: + case 147: + case 138: + case 145: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 208) { + if (node.kind !== 209) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 135) { + if (node.kind !== 136) { return false; } var parameter = node; @@ -6759,15 +6869,15 @@ var ts; if (isListElement(kind, false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); - if (parseOptional(23)) { + if (parseOptional(24)) { continue; } commaStart = -1; if (isListTerminator(kind)) { break; } - parseExpected(23); - if (considerSemicolonAsDelimeter && token === 22 && !scanner.hasPrecedingLineBreak()) { + parseExpected(24); + if (considerSemicolonAsDelimeter && token === 23 && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -6803,8 +6913,8 @@ var ts; } function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); - while (parseOptional(20)) { - var node = createNode(132, entity.pos); + while (parseOptional(21)) { + var node = createNode(133, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -6815,34 +6925,34 @@ var ts; if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { - return createMissingNode(66, true, ts.Diagnostics.Identifier_expected); + return createMissingNode(67, true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(180); + var template = createNode(181); template.head = parseLiteralNode(); - ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); + ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); do { templateSpans.push(parseTemplateSpan()); - } while (ts.lastOrUndefined(templateSpans).literal.kind === 12); + } while (ts.lastOrUndefined(templateSpans).literal.kind === 13); templateSpans.end = getNodeEnd(); template.templateSpans = templateSpans; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(187); + var span = createNode(188); span.expression = allowInAnd(parseExpression); var literal; - if (token === 15) { + if (token === 16) { reScanTemplateToken(); literal = parseLiteralNode(); } else { - literal = parseExpectedToken(13, false, ts.Diagnostics._0_expected, ts.tokenToString(15)); + literal = parseExpectedToken(14, false, ts.Diagnostics._0_expected, ts.tokenToString(16)); } span.literal = literal; return finishNode(span); @@ -6860,7 +6970,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 + if (node.kind === 8 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 65536; @@ -6869,30 +6979,30 @@ var ts; } function parseTypeReferenceOrTypePredicate() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 66 && token === 121 && !scanner.hasPrecedingLineBreak()) { + if (typeName.kind === 67 && token === 122 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(147, typeName.pos); + var node_1 = createNode(148, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(148, typeName.pos); + var node = createNode(149, typeName.pos); node.typeName = typeName; - if (!scanner.hasPrecedingLineBreak() && token === 24) { - node.typeArguments = parseBracketedList(18, parseType, 24, 26); + if (!scanner.hasPrecedingLineBreak() && token === 25) { + node.typeArguments = parseBracketedList(18, parseType, 25, 27); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(151); - parseExpected(98); + var node = createNode(152); + parseExpected(99); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(134); + var node = createNode(135); node.name = parseIdentifier(); - if (parseOptional(80)) { + if (parseOptional(81)) { if (isStartOfType() || !isStartOfExpression()) { node.constraint = parseType(); } @@ -6903,20 +7013,20 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 24) { - return parseBracketedList(17, parseTypeParameter, 24, 26); + if (token === 25) { + return parseBracketedList(17, parseTypeParameter, 25, 27); } } function parseParameterType() { - if (parseOptional(52)) { - return token === 8 + if (parseOptional(53)) { + return token === 9 ? parseLiteralNode(true) : parseType(); } return undefined; } function isStartOfParameter() { - return token === 21 || isIdentifierOrPattern() || ts.isModifier(token) || token === 53; + return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 54; } function setModifiers(node, modifiers) { if (modifiers) { @@ -6925,15 +7035,15 @@ var ts; } } function parseParameter() { - var node = createNode(135); + var node = createNode(136); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); - node.dotDotDotToken = parseOptionalToken(21); + node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { nextToken(); } - node.questionToken = parseOptionalToken(51); + node.questionToken = parseOptionalToken(52); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(true); return finishNode(node); @@ -6945,7 +7055,7 @@ var ts; return parseInitializer(true); } function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) { - var returnTokenRequired = returnToken === 33; + var returnTokenRequired = returnToken === 34; signature.typeParameters = parseTypeParameters(); signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { @@ -6957,7 +7067,7 @@ var ts; } } function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) { - if (parseExpected(16)) { + if (parseExpected(17)) { var savedYieldContext = inYieldContext(); var savedAwaitContext = inAwaitContext(); setYieldContext(yieldContext); @@ -6965,7 +7075,7 @@ var ts; var result = parseDelimitedList(16, parseParameter); setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); - if (!parseExpected(17) && requireCompleteParameterList) { + if (!parseExpected(18) && requireCompleteParameterList) { return undefined; } return result; @@ -6973,29 +7083,29 @@ var ts; return requireCompleteParameterList ? undefined : createMissingList(); } function parseTypeMemberSemicolon() { - if (parseOptional(23)) { + if (parseOptional(24)) { return; } parseSemicolon(); } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 145) { - parseExpected(89); + if (kind === 146) { + parseExpected(90); } - fillSignature(52, false, false, false, node); + fillSignature(53, false, false, false, node); parseTypeMemberSemicolon(); return finishNode(node); } function isIndexSignature() { - if (token !== 18) { + if (token !== 19) { return false; } return lookAhead(isUnambiguouslyIndexSignature); } function isUnambiguouslyIndexSignature() { nextToken(); - if (token === 21 || token === 19) { + if (token === 22 || token === 20) { return true; } if (ts.isModifier(token)) { @@ -7010,20 +7120,20 @@ var ts; else { nextToken(); } - if (token === 52 || token === 23) { + if (token === 53 || token === 24) { return true; } - if (token !== 51) { + if (token !== 52) { return false; } nextToken(); - return token === 52 || token === 23 || token === 19; + return token === 53 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(146, fullStart); + var node = createNode(147, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.parameters = parseBracketedList(16, parseParameter, 18, 19); + node.parameters = parseBracketedList(16, parseParameter, 19, 20); node.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); return finishNode(node); @@ -7031,17 +7141,17 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(51); - if (token === 16 || token === 24) { - var method = createNode(139, fullStart); + var questionToken = parseOptionalToken(52); + if (token === 17 || token === 25) { + var method = createNode(140, fullStart); method.name = name; method.questionToken = questionToken; - fillSignature(52, false, false, false, method); + fillSignature(53, false, false, false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(137, fullStart); + var property = createNode(138, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -7051,9 +7161,9 @@ var ts; } function isStartOfTypeMember() { switch (token) { - case 16: - case 24: - case 18: + case 17: + case 25: + case 19: return true; default: if (ts.isModifier(token)) { @@ -7073,27 +7183,27 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || - token === 24 || - token === 51 || + return token === 17 || + token === 25 || token === 52 || + token === 53 || canParseSemicolon(); } function parseTypeMember() { switch (token) { - case 16: - case 24: - return parseSignatureMember(144); - case 18: + case 17: + case 25: + return parseSignatureMember(145); + case 19: return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); - case 89: + case 90: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(145); + return parseSignatureMember(146); } + case 9: case 8: - case 7: return parsePropertyOrMethodSignature(); default: if (ts.isModifier(token)) { @@ -7117,18 +7227,18 @@ var ts; } function isStartOfConstructSignature() { nextToken(); - return token === 16 || token === 24; + return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(152); + var node = createNode(153); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseObjectTypeMembers() { var members; - if (parseExpected(14)) { + if (parseExpected(15)) { members = parseList(4, parseTypeMember); - parseExpected(15); + parseExpected(16); } else { members = createMissingList(); @@ -7136,47 +7246,47 @@ var ts; return members; } function parseTupleType() { - var node = createNode(154); - node.elementTypes = parseBracketedList(19, parseType, 18, 19); + var node = createNode(155); + node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(157); - parseExpected(16); - node.type = parseType(); + var node = createNode(158); parseExpected(17); + node.type = parseType(); + parseExpected(18); return finishNode(node); } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 150) { - parseExpected(89); + if (kind === 151) { + parseExpected(90); } - fillSignature(33, false, false, false, node); + fillSignature(34, false, false, false, node); return finishNode(node); } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 20 ? undefined : node; + return token === 21 ? undefined : node; } function parseNonArrayType() { switch (token) { - case 114: - case 127: - case 125: - case 117: + case 115: case 128: + case 126: + case 118: + case 129: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 100: + case 101: return parseTokenNode(); - case 98: + case 99: return parseTypeQuery(); - case 14: + case 15: return parseTypeLiteral(); - case 18: + case 19: return parseTupleType(); - case 16: + case 17: return parseParenthesizedType(); default: return parseTypeReferenceOrTypePredicate(); @@ -7184,19 +7294,19 @@ var ts; } function isStartOfType() { switch (token) { - case 114: - case 127: - case 125: - case 117: + case 115: case 128: - case 100: - case 98: - case 14: - case 18: - case 24: - case 89: + case 126: + case 118: + case 129: + case 101: + case 99: + case 15: + case 19: + case 25: + case 90: return true; - case 16: + case 17: return lookAhead(isStartOfParenthesizedOrFunctionType); default: return isIdentifier(); @@ -7204,13 +7314,13 @@ var ts; } function isStartOfParenthesizedOrFunctionType() { nextToken(); - return token === 17 || isStartOfParameter() || isStartOfType(); + return token === 18 || isStartOfParameter() || isStartOfType(); } function parseArrayTypeOrHigher() { var type = parseNonArrayType(); - while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { - parseExpected(19); - var node = createNode(153, type.pos); + while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { + parseExpected(20); + var node = createNode(154, type.pos); node.elementType = type; type = finishNode(node); } @@ -7232,32 +7342,32 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(156, parseArrayTypeOrHigher, 44); + return parseUnionOrIntersectionType(157, parseArrayTypeOrHigher, 45); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(155, parseIntersectionTypeOrHigher, 45); + return parseUnionOrIntersectionType(156, parseIntersectionTypeOrHigher, 46); } function isStartOfFunctionType() { - if (token === 24) { + if (token === 25) { return true; } - return token === 16 && lookAhead(isUnambiguouslyStartOfFunctionType); + return token === 17 && lookAhead(isUnambiguouslyStartOfFunctionType); } function isUnambiguouslyStartOfFunctionType() { nextToken(); - if (token === 17 || token === 21) { + if (token === 18 || token === 22) { return true; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 52 || token === 23 || - token === 51 || token === 54 || + if (token === 53 || token === 24 || + token === 52 || token === 55 || isIdentifier() || ts.isModifier(token)) { return true; } - if (token === 17) { + if (token === 18) { nextToken(); - if (token === 33) { + if (token === 34) { return true; } } @@ -7269,36 +7379,36 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(149); - } - if (token === 89) { return parseFunctionOrConstructorType(150); } + if (token === 90) { + return parseFunctionOrConstructorType(151); + } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(52) ? parseType() : undefined; + return parseOptional(53) ? parseType() : undefined; } function isStartOfLeftHandSideExpression() { switch (token) { - case 94: - case 92: - case 90: - case 96: - case 81: - case 7: + case 95: + case 93: + case 91: + case 97: + case 82: case 8: - case 10: + case 9: case 11: - case 16: - case 18: - case 14: - case 84: - case 70: - case 89: - case 37: - case 58: - case 66: + case 12: + case 17: + case 19: + case 15: + case 85: + case 71: + case 90: + case 38: + case 59: + case 67: return true; default: return isIdentifier(); @@ -7309,18 +7419,18 @@ var ts; return true; } switch (token) { - case 34: case 35: + case 36: + case 49: case 48: - case 47: - case 75: - case 98: - case 100: - case 39: + case 76: + case 99: + case 101: case 40: - case 24: - case 116: - case 111: + case 41: + case 25: + case 117: + case 112: return true; default: if (isBinaryOperator()) { @@ -7330,10 +7440,10 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && - token !== 84 && - token !== 70 && - token !== 53 && + return token !== 15 && + token !== 85 && + token !== 71 && + token !== 54 && isStartOfExpression(); } function allowInAndParseExpression() { @@ -7349,7 +7459,7 @@ var ts; } var expr = parseAssignmentExpressionOrHigher(); var operatorToken; - while ((operatorToken = parseOptionalToken(23))) { + while ((operatorToken = parseOptionalToken(24))) { expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } if (saveDecoratorContext) { @@ -7358,12 +7468,12 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 54) { - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 14) || !isStartOfExpression()) { + if (token !== 55) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 15) || !isStartOfExpression()) { return undefined; } } - parseExpected(54); + parseExpected(55); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -7384,7 +7494,7 @@ var ts; return arrowExpression; } var expr = parseBinaryExpressionOrHigher(0); - if (expr.kind === 66 && token === 33) { + if (expr.kind === 67 && token === 34) { return parseSimpleArrowFunctionExpression(expr); } if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) { @@ -7393,7 +7503,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 111) { + if (token === 112) { if (inYieldContext()) { return true; } @@ -7406,11 +7516,11 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(181); + var node = createNode(182); nextToken(); if (!scanner.hasPrecedingLineBreak() && - (token === 36 || isStartOfExpression())) { - node.asteriskToken = parseOptionalToken(36); + (token === 37 || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(37); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -7419,15 +7529,15 @@ var ts; } } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 33, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(171, identifier.pos); - var parameter = createNode(135, identifier.pos); + ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(172, identifier.pos); + var parameter = createNode(136, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - node.equalsGreaterThanToken = parseExpectedToken(33, false, ts.Diagnostics._0_expected, "=>"); + node.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); node.body = parseArrowFunctionExpressionBody(false); return finishNode(node); } @@ -7444,78 +7554,78 @@ var ts; } var isAsync = !!(arrowFunction.flags & 512); var lastToken = token; - arrowFunction.equalsGreaterThanToken = parseExpectedToken(33, false, ts.Diagnostics._0_expected, "=>"); - arrowFunction.body = (lastToken === 33 || lastToken === 14) + arrowFunction.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); + arrowFunction.body = (lastToken === 34 || lastToken === 15) ? parseArrowFunctionExpressionBody(isAsync) : parseIdentifier(); return finishNode(arrowFunction); } function isParenthesizedArrowFunctionExpression() { - if (token === 16 || token === 24 || token === 115) { + if (token === 17 || token === 25 || token === 116) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } - if (token === 33) { + if (token === 34) { return 1; } return 0; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 115) { + if (token === 116) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0; } - if (token !== 16 && token !== 24) { + if (token !== 17 && token !== 25) { return 0; } } var first = token; var second = nextToken(); - if (first === 16) { - if (second === 17) { + if (first === 17) { + if (second === 18) { var third = nextToken(); switch (third) { - case 33: - case 52: - case 14: + case 34: + case 53: + case 15: return 1; default: return 0; } } - if (second === 18 || second === 14) { + if (second === 19 || second === 15) { return 2; } - if (second === 21) { + if (second === 22) { return 1; } if (!isIdentifier()) { return 0; } - if (nextToken() === 52) { + if (nextToken() === 53) { return 1; } return 2; } else { - ts.Debug.assert(first === 24); + ts.Debug.assert(first === 25); if (!isIdentifier()) { return 0; } if (sourceFile.languageVariant === 1) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 80) { + if (third === 81) { var fourth = nextToken(); switch (fourth) { - case 54: - case 26: + case 55: + case 27: return false; default: return true; } } - else if (third === 23) { + else if (third === 24) { return true; } return false; @@ -7532,25 +7642,25 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(171); + var node = createNode(172); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512); - fillSignature(52, false, isAsync, !allowAmbiguity, node); + fillSignature(53, false, isAsync, !allowAmbiguity, node); if (!node.parameters) { return undefined; } - if (!allowAmbiguity && token !== 33 && token !== 14) { + if (!allowAmbiguity && token !== 34 && token !== 15) { return undefined; } return node; } function parseArrowFunctionExpressionBody(isAsync) { - if (token === 14) { + if (token === 15) { return parseFunctionBlock(false, isAsync, false); } - if (token !== 22 && - token !== 84 && - token !== 70 && + if (token !== 23 && + token !== 85 && + token !== 71 && isStartOfStatement() && !isStartOfExpressionStatement()) { return parseFunctionBlock(false, isAsync, true); @@ -7560,15 +7670,15 @@ var ts; : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher); } function parseConditionalExpressionRest(leftOperand) { - var questionToken = parseOptionalToken(51); + var questionToken = parseOptionalToken(52); if (!questionToken) { return leftOperand; } - var node = createNode(179, leftOperand.pos); + var node = createNode(180, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(52, false, ts.Diagnostics._0_expected, ts.tokenToString(52)); + node.colonToken = parseExpectedToken(53, false, ts.Diagnostics._0_expected, ts.tokenToString(53)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -7577,7 +7687,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 87 || t === 131; + return t === 88 || t === 132; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -7586,10 +7696,10 @@ var ts; if (newPrecedence <= precedence) { break; } - if (token === 87 && inDisallowInContext()) { + if (token === 88 && inDisallowInContext()) { break; } - if (token === 113) { + if (token === 114) { if (scanner.hasPrecedingLineBreak()) { break; } @@ -7605,90 +7715,90 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 87) { + if (inDisallowInContext() && token === 88) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 50: + case 51: return 1; - case 49: + case 50: return 2; - case 45: - return 3; case 46: + return 3; + case 47: return 4; - case 44: + case 45: return 5; - case 29: case 30: case 31: case 32: + case 33: return 6; - case 24: - case 26: + case 25: case 27: case 28: + case 29: + case 89: case 88: - case 87: - case 113: + case 114: return 7; - case 41: case 42: case 43: + case 44: return 8; - case 34: case 35: - return 9; case 36: + return 9; case 37: case 38: + case 39: return 10; } return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(178, left.pos); + var node = createNode(179, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(186, left.pos); + var node = createNode(187, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(176); + var node = createNode(177); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(172); + var node = createNode(173); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(173); + var node = createNode(174); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(174); + var node = createNode(175); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function isAwaitExpression() { - if (token === 116) { + if (token === 117) { if (inAwaitContext()) { return true; } @@ -7697,7 +7807,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(175); + var node = createNode(176); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -7707,25 +7817,25 @@ var ts; return parseAwaitExpression(); } switch (token) { - case 34: case 35: + case 36: + case 49: case 48: - case 47: - case 39: case 40: + case 41: return parsePrefixUnaryExpression(); - case 75: + case 76: return parseDeleteExpression(); - case 98: + case 99: return parseTypeOfExpression(); - case 100: + case 101: return parseVoidExpression(); - case 24: + case 25: if (sourceFile.languageVariant !== 1) { return parseTypeAssertion(); } if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(); + return parseJsxElementOrSelfClosingElement(true); } default: return parsePostfixExpressionOrHigher(); @@ -7734,8 +7844,8 @@ var ts; function parsePostfixExpressionOrHigher() { var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 39 || token === 40) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(177, expression.pos); + if ((token === 40 || token === 41) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(178, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -7744,7 +7854,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 92 + var expression = token === 93 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); @@ -7755,44 +7865,44 @@ var ts; } function parseSuperExpression() { var expression = parseTokenNode(); - if (token === 16 || token === 20) { + if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(163, expression.pos); + var node = createNode(164, expression.pos); node.expression = expression; - node.dotToken = parseExpectedToken(20, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); return finishNode(node); } - function parseJsxElementOrSelfClosingElement() { - var opening = parseJsxOpeningOrSelfClosingElement(); - if (opening.kind === 232) { - var node = createNode(230, opening.pos); + function parseJsxElementOrSelfClosingElement(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + if (opening.kind === 233) { + var node = createNode(231, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); - node.closingElement = parseJsxClosingElement(); + node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 231); + ts.Debug.assert(opening.kind === 232); return opening; } } function parseJsxText() { - var node = createNode(233, scanner.getStartPos()); + var node = createNode(234, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 233: + case 234: return parseJsxText(); - case 14: - return parseJsxExpression(); - case 24: - return parseJsxElementOrSelfClosingElement(); + case 15: + return parseJsxExpression(false); + case 25: + return parseJsxElementOrSelfClosingElement(false); } - ts.Debug.fail('Unknown JSX child kind ' + token); + ts.Debug.fail("Unknown JSX child kind " + token); } function parseJsxChildren(openingTagName) { var result = []; @@ -7801,7 +7911,7 @@ var ts; parsingContext |= 1 << 14; while (true) { token = scanner.reScanJsxToken(); - if (token === 25) { + if (token === 26) { break; } else if (token === 1) { @@ -7814,19 +7924,26 @@ var ts; parsingContext = saveParsingContext; return result; } - function parseJsxOpeningOrSelfClosingElement() { + function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); - parseExpected(24); + parseExpected(25); var tagName = parseJsxElementName(); var attributes = parseList(13, parseJsxAttribute); var node; - if (parseOptional(26)) { - node = createNode(232, fullStart); + if (token === 27) { + node = createNode(233, fullStart); + scanJsxText(); } else { - parseExpected(37); - parseExpected(26); - node = createNode(231, fullStart); + parseExpected(38); + if (inExpressionContext) { + parseExpected(27); + } + else { + parseExpected(27, undefined, false); + scanJsxText(); + } + node = createNode(232, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -7835,95 +7952,107 @@ var ts; function parseJsxElementName() { scanJsxIdentifier(); var elementName = parseIdentifierName(); - while (parseOptional(20)) { + while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(132, elementName.pos); + var node = createNode(133, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); } return elementName; } - function parseJsxExpression() { - var node = createNode(237); - parseExpected(14); - if (token !== 15) { + function parseJsxExpression(inExpressionContext) { + var node = createNode(238); + parseExpected(15); + if (token !== 16) { node.expression = parseExpression(); } - parseExpected(15); + if (inExpressionContext) { + parseExpected(16); + } + else { + parseExpected(16, undefined, false); + scanJsxText(); + } return finishNode(node); } function parseJsxAttribute() { - if (token === 14) { + if (token === 15) { return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(235); + var node = createNode(236); node.name = parseIdentifierName(); - if (parseOptional(54)) { + if (parseOptional(55)) { switch (token) { - case 8: + case 9: node.initializer = parseLiteralNode(); break; default: - node.initializer = parseJsxExpression(); + node.initializer = parseJsxExpression(true); break; } } return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(236); - parseExpected(14); - parseExpected(21); - node.expression = parseExpression(); + var node = createNode(237); parseExpected(15); + parseExpected(22); + node.expression = parseExpression(); + parseExpected(16); return finishNode(node); } - function parseJsxClosingElement() { - var node = createNode(234); - parseExpected(25); - node.tagName = parseJsxElementName(); + function parseJsxClosingElement(inExpressionContext) { + var node = createNode(235); parseExpected(26); + node.tagName = parseJsxElementName(); + if (inExpressionContext) { + parseExpected(27); + } + else { + parseExpected(27, undefined, false); + scanJsxText(); + } return finishNode(node); } function parseTypeAssertion() { - var node = createNode(168); - parseExpected(24); + var node = createNode(169); + parseExpected(25); node.type = parseType(); - parseExpected(26); + parseExpected(27); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { - var dotToken = parseOptionalToken(20); + var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(163, expression.pos); + var propertyAccess = createNode(164, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } - if (!inDecoratorContext() && parseOptional(18)) { - var indexedAccess = createNode(164, expression.pos); + if (!inDecoratorContext() && parseOptional(19)) { + var indexedAccess = createNode(165, expression.pos); indexedAccess.expression = expression; - if (token !== 19) { + if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); - if (indexedAccess.argumentExpression.kind === 8 || indexedAccess.argumentExpression.kind === 7) { + if (indexedAccess.argumentExpression.kind === 9 || indexedAccess.argumentExpression.kind === 8) { var literal = indexedAccess.argumentExpression; literal.text = internIdentifier(literal.text); } } - parseExpected(19); + parseExpected(20); expression = finishNode(indexedAccess); continue; } - if (token === 10 || token === 11) { - var tagExpression = createNode(167, expression.pos); + if (token === 11 || token === 12) { + var tagExpression = createNode(168, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 + tagExpression.template = token === 11 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); @@ -7935,20 +8064,20 @@ var ts; function parseCallExpressionRest(expression) { while (true) { expression = parseMemberExpressionRest(expression); - if (token === 24) { + if (token === 25) { var typeArguments = tryParse(parseTypeArgumentsInExpression); if (!typeArguments) { return expression; } - var callExpr = createNode(165, expression.pos); + var callExpr = createNode(166, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); continue; } - else if (token === 16) { - var callExpr = createNode(165, expression.pos); + else if (token === 17) { + var callExpr = createNode(166, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -7958,17 +8087,17 @@ var ts; } } function parseArgumentList() { - parseExpected(16); - var result = parseDelimitedList(11, parseArgumentExpression); parseExpected(17); + var result = parseDelimitedList(11, parseArgumentExpression); + parseExpected(18); return result; } function parseTypeArgumentsInExpression() { - if (!parseOptional(24)) { + if (!parseOptional(25)) { return undefined; } var typeArguments = parseDelimitedList(18, parseType); - if (!parseExpected(26)) { + if (!parseExpected(27)) { return undefined; } return typeArguments && canFollowTypeArgumentsInExpression() @@ -7977,108 +8106,108 @@ var ts; } function canFollowTypeArgumentsInExpression() { switch (token) { - case 16: - case 20: case 17: - case 19: + case 21: + case 18: + case 20: + case 53: + case 23: case 52: - case 22: - case 51: - case 29: - case 31: case 30: case 32: - case 49: + case 31: + case 33: case 50: - case 46: - case 44: + case 51: + case 47: case 45: - case 15: + case 46: + case 16: case 1: return true; - case 23: - case 14: + case 24: + case 15: default: return false; } } function parsePrimaryExpression() { switch (token) { - case 7: case 8: - case 10: + case 9: + case 11: return parseLiteralNode(); - case 94: - case 92: - case 90: - case 96: - case 81: + case 95: + case 93: + case 91: + case 97: + case 82: return parseTokenNode(); - case 16: + case 17: return parseParenthesizedExpression(); - case 18: + case 19: return parseArrayLiteralExpression(); - case 14: + case 15: return parseObjectLiteralExpression(); - case 115: + case 116: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { break; } return parseFunctionExpression(); - case 70: + case 71: return parseClassExpression(); - case 84: + case 85: return parseFunctionExpression(); - case 89: + case 90: return parseNewExpression(); - case 37: - case 58: - if (reScanSlashToken() === 9) { + case 38: + case 59: + if (reScanSlashToken() === 10) { return parseLiteralNode(); } break; - case 11: + case 12: return parseTemplateExpression(); } return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(169); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(170); parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(182); - parseExpected(21); + var node = createNode(183); + parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(184) : + return token === 22 ? parseSpreadElement() : + token === 24 ? createNode(185) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(161); - parseExpected(18); + var node = createNode(162); + parseExpected(19); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048; node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); - parseExpected(19); + parseExpected(20); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(120)) { - return parseAccessorDeclaration(142, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(126)) { + if (parseContextualModifier(121)) { return parseAccessorDeclaration(143, fullStart, decorators, modifiers); } + else if (parseContextualModifier(127)) { + return parseAccessorDeclaration(144, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { @@ -8089,37 +8218,37 @@ var ts; if (accessor) { return accessor; } - var asteriskToken = parseOptionalToken(36); + var asteriskToken = parseOptionalToken(37); var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); - var questionToken = parseOptionalToken(51); - if (asteriskToken || token === 16 || token === 24) { + var questionToken = parseOptionalToken(52); + if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } - if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(243, fullStart); + if ((token === 24 || token === 16) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(244, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(242, fullStart); + var propertyAssignment = createNode(243, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(52); + parseExpected(53); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(162); - parseExpected(14); + var node = createNode(163); + parseExpected(15); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048; } node.properties = parseDelimitedList(12, parseObjectLiteralElement, true); - parseExpected(15); + parseExpected(16); return finishNode(node); } function parseFunctionExpression() { @@ -8127,10 +8256,10 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(170); + var node = createNode(171); setModifiers(node, parseModifiers()); - parseExpected(84); - node.asteriskToken = parseOptionalToken(36); + parseExpected(85); + node.asteriskToken = parseOptionalToken(37); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); node.name = @@ -8138,7 +8267,7 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(52, isGenerator, isAsync, false, node); + fillSignature(53, isGenerator, isAsync, false, node); node.body = parseFunctionBlock(isGenerator, isAsync, false); if (saveDecoratorContext) { setDecoratorContext(true); @@ -8149,20 +8278,20 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(166); - parseExpected(89); + var node = createNode(167); + parseExpected(90); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); - if (node.typeArguments || token === 16) { + if (node.typeArguments || token === 17) { node.arguments = parseArgumentList(); } return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(189); - if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { + var node = createNode(190); + if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); - parseExpected(15); + parseExpected(16); } else { node.statements = createMissingList(); @@ -8187,47 +8316,47 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(191); - parseExpected(22); + var node = createNode(192); + parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(193); - parseExpected(85); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(194); + parseExpected(86); parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(77) ? parseStatement() : undefined; + node.elseStatement = parseOptional(78) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(194); - parseExpected(76); + var node = createNode(195); + parseExpected(77); node.statement = parseStatement(); - parseExpected(101); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + parseExpected(102); parseExpected(17); - parseOptional(22); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + parseOptional(23); return finishNode(node); } function parseWhileStatement() { - var node = createNode(195); - parseExpected(101); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(196); + parseExpected(102); parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); node.statement = parseStatement(); return finishNode(node); } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(83); - parseExpected(16); + parseExpected(84); + parseExpected(17); var initializer = undefined; - if (token !== 22) { - if (token === 99 || token === 105 || token === 71) { + if (token !== 23) { + if (token === 100 || token === 106 || token === 72) { initializer = parseVariableDeclarationList(true); } else { @@ -8235,32 +8364,32 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(87)) { - var forInStatement = createNode(197, pos); + if (parseOptional(88)) { + var forInStatement = createNode(198, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); - parseExpected(17); + parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(131)) { - var forOfStatement = createNode(198, pos); + else if (parseOptional(132)) { + var forOfStatement = createNode(199, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); - parseExpected(17); + parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(196, pos); + var forStatement = createNode(197, pos); forStatement.initializer = initializer; - parseExpected(22); - if (token !== 22 && token !== 17) { + parseExpected(23); + if (token !== 23 && token !== 18) { forStatement.condition = allowInAnd(parseExpression); } - parseExpected(22); - if (token !== 17) { + parseExpected(23); + if (token !== 18) { forStatement.incrementor = allowInAnd(parseExpression); } - parseExpected(17); + parseExpected(18); forOrForInOrForOfStatement = forStatement; } forOrForInOrForOfStatement.statement = parseStatement(); @@ -8268,7 +8397,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 200 ? 67 : 72); + parseExpected(kind === 201 ? 68 : 73); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8276,8 +8405,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(201); - parseExpected(91); + var node = createNode(202); + parseExpected(92); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -8285,99 +8414,99 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(202); - parseExpected(102); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(203); + parseExpected(103); parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); node.statement = parseStatement(); return finishNode(node); } function parseCaseClause() { - var node = createNode(238); - parseExpected(68); + var node = createNode(239); + parseExpected(69); node.expression = allowInAnd(parseExpression); - parseExpected(52); + parseExpected(53); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(239); - parseExpected(74); - parseExpected(52); + var node = createNode(240); + parseExpected(75); + parseExpected(53); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 68 ? parseCaseClause() : parseDefaultClause(); + return token === 69 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(203); - parseExpected(93); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(204); + parseExpected(94); parseExpected(17); - var caseBlock = createNode(217, scanner.getStartPos()); - parseExpected(14); - caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + var caseBlock = createNode(218, scanner.getStartPos()); parseExpected(15); + caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); + parseExpected(16); node.caseBlock = finishNode(caseBlock); return finishNode(node); } function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(205); - parseExpected(95); + var node = createNode(206); + parseExpected(96); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(206); - parseExpected(97); + var node = createNode(207); + parseExpected(98); node.tryBlock = parseBlock(false); - node.catchClause = token === 69 ? parseCatchClause() : undefined; - if (!node.catchClause || token === 82) { - parseExpected(82); + node.catchClause = token === 70 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 83) { + parseExpected(83); node.finallyBlock = parseBlock(false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(241); - parseExpected(69); - if (parseExpected(16)) { + var result = createNode(242); + parseExpected(70); + if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); } - parseExpected(17); + parseExpected(18); result.block = parseBlock(false); return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(207); - parseExpected(73); + var node = createNode(208); + parseExpected(74); parseSemicolon(); return finishNode(node); } function parseExpressionOrLabeledStatement() { var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 66 && parseOptional(52)) { - var labeledStatement = createNode(204, fullStart); + if (expression.kind === 67 && parseOptional(53)) { + var labeledStatement = createNode(205, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(192, fullStart); + var expressionStatement = createNode(193, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); } } function isIdentifierOrKeyword() { - return token >= 66; + return token >= 67; } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); @@ -8385,51 +8514,51 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 84 && !scanner.hasPrecedingLineBreak(); + return token === 85 && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 7) && !scanner.hasPrecedingLineBreak(); + return (isIdentifierOrKeyword() || token === 8) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { switch (token) { - case 99: - case 105: + case 100: + case 106: + case 72: + case 85: case 71: - case 84: - case 70: - case 78: + case 79: return true; - case 104: - case 129: + case 105: + case 130: return nextTokenIsIdentifierOnSameLine(); - case 122: case 123: + case 124: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 115: - case 119: + case 116: + case 120: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 86: + case 87: nextToken(); - return token === 8 || token === 36 || - token === 14 || isIdentifierOrKeyword(); - case 79: + return token === 9 || token === 37 || + token === 15 || isIdentifierOrKeyword(); + case 80: nextToken(); - if (token === 54 || token === 36 || - token === 14 || token === 74) { + if (token === 55 || token === 37 || + token === 15 || token === 75) { return true; } continue; - case 109: - case 107: - case 108: case 110: - case 112: + case 108: + case 109: + case 111: + case 113: nextToken(); continue; default: @@ -8442,44 +8571,44 @@ var ts; } function isStartOfStatement() { switch (token) { - case 53: - case 22: - case 14: - case 99: - case 105: - case 84: - case 70: - case 78: + case 54: + case 23: + case 15: + case 100: + case 106: case 85: - case 76: - case 101: - case 83: - case 72: - case 67: - case 91: - case 102: - case 93: - case 95: - case 97: - case 73: - case 69: - case 82: - return true; case 71: case 79: case 86: + case 77: + case 102: + case 84: + case 73: + case 68: + case 92: + case 103: + case 94: + case 96: + case 98: + case 74: + case 70: + case 83: + return true; + case 72: + case 80: + case 87: return isStartOfDeclaration(); - case 115: - case 119: - case 104: - case 122: + case 116: + case 120: + case 105: case 123: - case 129: + case 124: + case 130: return true; - case 109: - case 107: - case 108: case 110: + case 108: + case 109: + case 111: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -8487,71 +8616,71 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuring() { nextToken(); - return isIdentifier() || token === 14 || token === 18; + return isIdentifier() || token === 15 || token === 19; } function isLetDeclaration() { return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring); } function parseStatement() { switch (token) { - case 22: + case 23: return parseEmptyStatement(); - case 14: + case 15: return parseBlock(false); - case 99: + case 100: return parseVariableStatement(scanner.getStartPos(), undefined, undefined); - case 105: + case 106: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), undefined, undefined); } break; - case 84: + case 85: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); - case 70: + case 71: return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); - case 85: + case 86: return parseIfStatement(); - case 76: + case 77: return parseDoStatement(); - case 101: + case 102: return parseWhileStatement(); - case 83: - return parseForOrForInOrForOfStatement(); - case 72: - return parseBreakOrContinueStatement(199); - case 67: + case 84: + return parseForOrForInOrForOfStatement(); + case 73: return parseBreakOrContinueStatement(200); - case 91: + case 68: + return parseBreakOrContinueStatement(201); + case 92: return parseReturnStatement(); - case 102: + case 103: return parseWithStatement(); - case 93: + case 94: return parseSwitchStatement(); - case 95: + case 96: return parseThrowStatement(); - case 97: - case 69: - case 82: + case 98: + case 70: + case 83: return parseTryStatement(); - case 73: + case 74: return parseDebuggerStatement(); - case 53: + case 54: return parseDeclaration(); - case 115: - case 104: - case 129: - case 122: + case 116: + case 105: + case 130: case 123: - case 119: - case 71: - case 78: + case 124: + case 120: + case 72: case 79: - case 86: - case 107: + case 80: + case 87: case 108: case 109: - case 112: case 110: + case 113: + case 111: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -8564,33 +8693,33 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 99: - case 105: - case 71: + case 100: + case 106: + case 72: return parseVariableStatement(fullStart, decorators, modifiers); - case 84: + case 85: return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 70: + case 71: return parseClassDeclaration(fullStart, decorators, modifiers); - case 104: + case 105: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 129: + case 130: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 78: + case 79: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 122: case 123: + case 124: return parseModuleDeclaration(fullStart, decorators, modifiers); - case 86: + case 87: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 79: + case 80: nextToken(); - return token === 74 || token === 54 ? + return token === 75 || token === 55 ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { - var node = createMissingNode(228, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(229, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8600,34 +8729,34 @@ var ts; } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 8); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 9); } function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) { - if (token !== 14 && canParseSemicolon()) { + if (token !== 15 && canParseSemicolon()) { parseSemicolon(); return; } return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage); } function parseArrayBindingElement() { - if (token === 23) { - return createNode(184); + if (token === 24) { + return createNode(185); } - var node = createNode(160); - node.dotDotDotToken = parseOptionalToken(21); + var node = createNode(161); + node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(160); + var node = createNode(161); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 52) { + if (tokenIsIdentifier && token !== 53) { node.name = propertyName; } else { - parseExpected(52); + parseExpected(53); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } @@ -8635,33 +8764,33 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(158); - parseExpected(14); - node.elements = parseDelimitedList(9, parseObjectBindingElement); + var node = createNode(159); parseExpected(15); + node.elements = parseDelimitedList(9, parseObjectBindingElement); + parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(159); - parseExpected(18); - node.elements = parseDelimitedList(10, parseArrayBindingElement); + var node = createNode(160); parseExpected(19); + node.elements = parseDelimitedList(10, parseArrayBindingElement); + parseExpected(20); return finishNode(node); } function isIdentifierOrPattern() { - return token === 14 || token === 18 || isIdentifier(); + return token === 15 || token === 19 || isIdentifier(); } function parseIdentifierOrPattern() { - if (token === 18) { + if (token === 19) { return parseArrayBindingPattern(); } - if (token === 14) { + if (token === 15) { return parseObjectBindingPattern(); } return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(208); + var node = createNode(209); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8670,21 +8799,21 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(209); + var node = createNode(210); switch (token) { - case 99: + case 100: break; - case 105: + case 106: node.flags |= 16384; break; - case 71: + case 72: node.flags |= 32768; break; default: ts.Debug.fail(); } nextToken(); - if (token === 131 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 132 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -8696,10 +8825,10 @@ var ts; return finishNode(node); } function canFollowContextualOfKeyword() { - return nextTokenIsIdentifier() && nextToken() === 17; + return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(190, fullStart); + var node = createNode(191, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8707,29 +8836,29 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(210, fullStart); + var node = createNode(211, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(84); - node.asteriskToken = parseOptionalToken(36); + parseExpected(85); + node.asteriskToken = parseOptionalToken(37); node.name = node.flags & 1024 ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); - fillSignature(52, isGenerator, isAsync, false, node); + fillSignature(53, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(141, pos); + var node = createNode(142, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(118); - fillSignature(52, false, false, false, node); + parseExpected(119); + fillSignature(53, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(140, fullStart); + var method = createNode(141, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -8737,12 +8866,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512); - fillSignature(52, isGenerator, isAsync, false, method); + fillSignature(53, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(138, fullStart); + var property = createNode(139, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -8755,10 +8884,10 @@ var ts; return finishNode(property); } function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { - var asteriskToken = parseOptionalToken(36); + var asteriskToken = parseOptionalToken(37); var name = parsePropertyName(); - var questionToken = parseOptionalToken(51); - if (asteriskToken || token === 16 || token === 24) { + var questionToken = parseOptionalToken(52); + if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { @@ -8773,16 +8902,16 @@ var ts; node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(52, false, false, false, node); + fillSignature(53, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { - case 109: - case 107: - case 108: case 110: + case 108: + case 109: + case 111: return true; default: return false; @@ -8790,7 +8919,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 53) { + if (token === 54) { return true; } while (ts.isModifier(token)) { @@ -8800,26 +8929,26 @@ var ts; } nextToken(); } - if (token === 36) { + if (token === 37) { return true; } if (isLiteralPropertyName()) { idToken = token; nextToken(); } - if (token === 18) { + if (token === 19) { return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 126 || idToken === 120) { + if (!ts.isKeyword(idToken) || idToken === 127 || idToken === 121) { return true; } switch (token) { - case 16: - case 24: + case 17: + case 25: + case 53: + case 55: case 52: - case 54: - case 51: return true; default: return canParseSemicolon(); @@ -8831,14 +8960,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(53)) { + if (!parseOptional(54)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(136, decoratorStart); + var decorator = createNode(137, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -8872,7 +9001,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 115) { + if (token === 116) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -8886,8 +9015,8 @@ var ts; return modifiers; } function parseClassElement() { - if (token === 22) { - var result = createNode(188); + if (token === 23) { + var result = createNode(189); nextToken(); return finishNode(result); } @@ -8898,42 +9027,42 @@ var ts; if (accessor) { return accessor; } - if (token === 118) { + if (token === 119) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(fullStart, decorators, modifiers); } if (isIdentifierOrKeyword() || + token === 9 || token === 8 || - token === 7 || - token === 36 || - token === 18) { + token === 37 || + token === 19) { return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_7 = createMissingNode(66, true, ts.Diagnostics.Declaration_expected); + var name_7 = createMissingNode(67, true, ts.Diagnostics.Declaration_expected); return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 183); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 184); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 211); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(70); + parseExpected(71); node.name = parseOptionalIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); - if (parseExpected(14)) { + if (parseExpected(15)) { node.members = parseClassMembers(); - parseExpected(15); + parseExpected(16); } else { node.members = createMissingList(); @@ -8952,8 +9081,8 @@ var ts; return parseList(20, parseHeritageClause); } function parseHeritageClause() { - if (token === 80 || token === 103) { - var node = createNode(240); + if (token === 81 || token === 104) { + var node = createNode(241); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -8962,24 +9091,24 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(185); + var node = createNode(186); node.expression = parseLeftHandSideExpressionOrHigher(); - if (token === 24) { - node.typeArguments = parseBracketedList(18, parseType, 24, 26); + if (token === 25) { + node.typeArguments = parseBracketedList(18, parseType, 25, 27); } return finishNode(node); } function isHeritageClause() { - return token === 80 || token === 103; + return token === 81 || token === 104; } function parseClassMembers() { return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(213, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(104); + parseExpected(105); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(false); @@ -8987,32 +9116,32 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(129); + parseExpected(130); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(54); + parseExpected(55); node.type = parseType(); parseSemicolon(); return finishNode(node); } function parseEnumMember() { - var node = createNode(244, scanner.getStartPos()); + var node = createNode(245, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(78); + parseExpected(79); node.name = parseIdentifier(); - if (parseExpected(14)) { + if (parseExpected(15)) { node.members = parseDelimitedList(6, parseEnumMember); - parseExpected(15); + parseExpected(16); } else { node.members = createMissingList(); @@ -9020,10 +9149,10 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(216, scanner.getStartPos()); - if (parseExpected(14)) { + var node = createNode(217, scanner.getStartPos()); + if (parseExpected(15)) { node.statements = parseList(1, parseStatement); - parseExpected(15); + parseExpected(16); } else { node.statements = createMissingList(); @@ -9031,18 +9160,18 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(215, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) + node.body = parseOptional(21) ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -9051,57 +9180,57 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(123)) { + if (parseOptional(124)) { flags |= 131072; } else { - parseExpected(122); - if (token === 8) { + parseExpected(123); + if (token === 9) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } } return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 124 && + return token === 125 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { - return nextToken() === 16; + return nextToken() === 17; } function nextTokenIsSlash() { - return nextToken() === 37; + return nextToken() === 38; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || - token === 130; + return token === 24 || + token === 131; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(86); + parseExpected(87); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 23 && token !== 130) { - var importEqualsDeclaration = createNode(218, fullStart); + if (token !== 24 && token !== 131) { + var importEqualsDeclaration = createNode(219, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(54); + parseExpected(55); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(219, fullStart); + var importDeclaration = createNode(220, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || - token === 36 || - token === 14) { + token === 37 || + token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(130); + parseExpected(131); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -9114,13 +9243,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(220, fullStart); + var importClause = createNode(221, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || - parseOptional(23)) { - importClause.namedBindings = token === 36 ? parseNamespaceImport() : parseNamedImportsOrExports(222); + parseOptional(24)) { + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(223); } return finishNode(importClause); } @@ -9130,37 +9259,37 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(229); - parseExpected(124); - parseExpected(16); - node.expression = parseModuleSpecifier(); + var node = createNode(230); + parseExpected(125); parseExpected(17); + node.expression = parseModuleSpecifier(); + parseExpected(18); return finishNode(node); } function parseModuleSpecifier() { var result = parseExpression(); - if (result.kind === 8) { + if (result.kind === 9) { internIdentifier(result.text); } return result; } function parseNamespaceImport() { - var namespaceImport = createNode(221); - parseExpected(36); - parseExpected(113); + var namespaceImport = createNode(222); + parseExpected(37); + parseExpected(114); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 222 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(21, kind === 223 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(227); + return parseImportOrExportSpecifier(228); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(223); + return parseImportOrExportSpecifier(224); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -9168,9 +9297,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 113) { + if (token === 114) { node.propertyName = identifierName; - parseExpected(113); + parseExpected(114); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -9179,23 +9308,23 @@ var ts; else { node.name = identifierName; } - if (kind === 223 && checkIdentifierIsKeyword) { + if (kind === 224 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(226, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(36)) { - parseExpected(130); + if (parseOptional(37)) { + parseExpected(131); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(226); - if (token === 130 || (token === 8 && !scanner.hasPrecedingLineBreak())) { - parseExpected(130); + node.exportClause = parseNamedImportsOrExports(227); + if (token === 131 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(131); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -9203,14 +9332,14 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(224, fullStart); + var node = createNode(225, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(54)) { + if (parseOptional(55)) { node.isExportEquals = true; } else { - parseExpected(74); + parseExpected(75); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -9273,10 +9402,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 218 && node.moduleReference.kind === 229 - || node.kind === 219 - || node.kind === 224 + || node.kind === 219 && node.moduleReference.kind === 230 + || node.kind === 220 || node.kind === 225 + || node.kind === 226 ? node : undefined; }); @@ -9285,16 +9414,16 @@ var ts; (function (JSDocParser) { function isJSDocType() { switch (token) { - case 36: - case 51: - case 16: - case 18: - case 47: - case 14: - case 84: - case 21: - case 89: - case 94: + case 37: + case 52: + case 17: + case 19: + case 48: + case 15: + case 85: + case 22: + case 90: + case 95: return true; } return isIdentifierOrKeyword(); @@ -9311,23 +9440,23 @@ var ts; function parseJSDocTypeExpression(start, length) { scanner.setText(sourceText, start, length); token = nextToken(); - var result = createNode(246); - parseExpected(14); - result.type = parseJSDocTopLevelType(); + var result = createNode(247); parseExpected(15); + result.type = parseJSDocTopLevelType(); + parseExpected(16); fixupParentReferences(result); return finishNode(result); } JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 45) { - var unionType = createNode(250, type.pos); + if (token === 46) { + var unionType = createNode(251, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 54) { - var optionalType = createNode(257, type.pos); + if (token === 55) { + var optionalType = createNode(258, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -9337,21 +9466,21 @@ var ts; function parseJSDocType() { var type = parseBasicTypeExpression(); while (true) { - if (token === 18) { - var arrayType = createNode(249, type.pos); + if (token === 19) { + var arrayType = createNode(250, type.pos); arrayType.elementType = type; nextToken(); - parseExpected(19); + parseExpected(20); type = finishNode(arrayType); } - else if (token === 51) { - var nullableType = createNode(252, type.pos); + else if (token === 52) { + var nullableType = createNode(253, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 47) { - var nonNullableType = createNode(253, type.pos); + else if (token === 48) { + var nonNullableType = createNode(254, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -9364,85 +9493,85 @@ var ts; } function parseBasicTypeExpression() { switch (token) { - case 36: + case 37: return parseJSDocAllType(); - case 51: + case 52: return parseJSDocUnknownOrNullableType(); - case 16: + case 17: return parseJSDocUnionType(); - case 18: + case 19: return parseJSDocTupleType(); - case 47: + case 48: return parseJSDocNonNullableType(); - case 14: + case 15: return parseJSDocRecordType(); - case 84: + case 85: return parseJSDocFunctionType(); - case 21: + case 22: return parseJSDocVariadicType(); - case 89: + case 90: return parseJSDocConstructorType(); - case 94: + case 95: return parseJSDocThisType(); - case 114: - case 127: - case 125: - case 117: + case 115: case 128: - case 100: + case 126: + case 118: + case 129: + case 101: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(261); + var result = createNode(262); nextToken(); - parseExpected(52); + parseExpected(53); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(260); + var result = createNode(261); nextToken(); - parseExpected(52); + parseExpected(53); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(259); + var result = createNode(260); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(258); + var result = createNode(259); nextToken(); - parseExpected(16); + parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); checkForTrailingComma(result.parameters); - parseExpected(17); - if (token === 52) { + parseExpected(18); + if (token === 53) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(135); + var parameter = createNode(136); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(257, type.pos); + var result = createNode(258, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(256); + var result = createNode(257); result.name = parseSimplePropertyName(); - while (parseOptional(20)) { - if (token === 24) { + while (parseOptional(21)) { + if (token === 25) { result.typeArguments = parseTypeArguments(); break; } @@ -9457,7 +9586,7 @@ var ts; var typeArguments = parseDelimitedList(23, parseJSDocType); checkForTrailingComma(typeArguments); checkForEmptyTypeArgumentList(typeArguments); - parseExpected(26); + parseExpected(27); return typeArguments; } function checkForEmptyTypeArgumentList(typeArguments) { @@ -9468,40 +9597,40 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(132, left.pos); + var result = createNode(133, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(254); + var result = createNode(255); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); - parseExpected(15); + parseExpected(16); return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(255); + var result = createNode(256); result.name = parseSimplePropertyName(); - if (token === 52) { + if (token === 53) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(253); + var result = createNode(254); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(251); + var result = createNode(252); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); - parseExpected(19); + parseExpected(20); return finishNode(result); } function checkForTrailingComma(list) { @@ -9511,10 +9640,10 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(250); + var result = createNode(251); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); - parseExpected(17); + parseExpected(18); return finishNode(result); } function parseJSDocTypeList(firstType) { @@ -9522,31 +9651,31 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(45)) { + while (parseOptional(46)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(247); + var result = createNode(248); nextToken(); return finishNode(result); } function parseJSDocUnknownOrNullableType() { var pos = scanner.getStartPos(); nextToken(); - if (token === 23 || - token === 15 || - token === 17 || - token === 26 || - token === 54 || - token === 45) { - var result = createNode(248, pos); + if (token === 24 || + token === 16 || + token === 18 || + token === 27 || + token === 55 || + token === 46) { + var result = createNode(249, pos); return finishNode(result); } else { - var result = createNode(252, pos); + var result = createNode(253, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -9617,7 +9746,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(262, start); + var result = createNode(263, start); result.tags = tags; return finishNode(result, end); } @@ -9628,7 +9757,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64); - var atToken = createNode(53, pos - 1); + var atToken = createNode(54, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -9654,7 +9783,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(263, atToken.pos); + var result = createNode(264, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -9706,7 +9835,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(264, atToken.pos); + var result = createNode(265, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -9716,27 +9845,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 265; })) { + if (ts.forEach(tags, function (t) { return t.kind === 266; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(265, atToken.pos); + var result = createNode(266, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266; })) { + if (ts.forEach(tags, function (t) { return t.kind === 267; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266, atToken.pos); + var result = createNode(267, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -9749,7 +9878,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(134, name_8.pos); + var typeParameter = createNode(135, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -9760,7 +9889,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(267, atToken.pos); + var result = createNode(268, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -9781,7 +9910,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(66, startPos); + var result = createNode(67, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -9825,7 +9954,7 @@ var ts; } return; function visitNode(node) { - var text = ''; + var text = ""; if (aggressiveChecks && shouldCheckNode(node)) { text = oldText.substring(node.pos, node.end); } @@ -9855,9 +9984,9 @@ var ts; } function shouldCheckNode(node) { switch (node.kind) { + case 9: case 8: - case 7: - case 66: + case 67: return true; } return false; @@ -10113,17 +10242,18 @@ var ts; isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, + getBaseTypes: getBaseTypes, getReturnTypeOfSignature: getReturnTypeOfSignature, getSymbolsInScope: getSymbolsInScope, getSymbolAtLocation: getSymbolAtLocation, getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getTypeAtLocation: getTypeAtLocation, + getTypeAtLocation: getTypeOfNode, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -10140,7 +10270,8 @@ var ts; getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, getJsxElementAttributesType: getJsxElementAttributesType, - getJsxIntrinsicTagNames: getJsxIntrinsicTagNames + getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, + isOptionalParameter: isOptionalParameter }; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); @@ -10148,16 +10279,17 @@ var ts; var stringType = createIntrinsicType(2, "string"); var numberType = createIntrinsicType(4, "number"); var booleanType = createIntrinsicType(8, "boolean"); - var esSymbolType = createIntrinsicType(4194304, "symbol"); + var esSymbolType = createIntrinsicType(16777216, "symbol"); var voidType = createIntrinsicType(16, "void"); - var undefinedType = createIntrinsicType(32 | 1048576, "undefined"); - var nullType = createIntrinsicType(64 | 1048576, "null"); + var undefinedType = createIntrinsicType(32 | 2097152, "undefined"); + var nullType = createIntrinsicType(64 | 2097152, "null"); var unknownType = createIntrinsicType(1, "unknown"); var circularType = createIntrinsicType(1, "__circular__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); @@ -10201,6 +10333,7 @@ var ts; var emitGenerator = false; var resolutionTargets = []; var resolutionResults = []; + var resolutionPropertyNames = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -10222,7 +10355,7 @@ var ts; }, "symbol": { type: esSymbolType, - flags: 4194304 + flags: 16777216 } }; var JsxNames = { @@ -10235,6 +10368,7 @@ var ts; var subtypeRelation = {}; var assignableRelation = {}; var identityRelation = {}; + var _displayBuilder; initializeTypeChecker(); return checker; function getEmitResolver(sourceFile, cancellationToken) { @@ -10376,10 +10510,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 245); + return ts.getAncestor(node, 246); } function isGlobalSourceFile(node) { - return node.kind === 245 && !ts.isExternalModule(node); + return node.kind === 246 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -10402,7 +10536,7 @@ var ts; if (file1 === file2) { return node1.pos <= node2.pos; } - if (!compilerOptions.out) { + if (!compilerOptions.outFile && !compilerOptions.out) { return true; } var sourceFiles = host.getSourceFiles(); @@ -10427,16 +10561,16 @@ var ts; } } switch (location.kind) { - case 245: + case 246: if (!ts.isExternalModule(location)) break; - case 215: + case 216: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 245 || - (location.kind === 215 && location.name.kind === 8)) { + if (location.kind === 246 || + (location.kind === 216 && location.name.kind === 9)) { if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 227)) { + ts.getDeclarationOfKind(moduleExports[name], 228)) { break; } result = moduleExports["default"]; @@ -10450,13 +10584,13 @@ var ts; break loop; } break; - case 214: + case 215: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 139: case 138: - case 137: if (ts.isClassLike(location.parent) && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -10466,9 +10600,9 @@ var ts; } } break; - case 211: - case 183: case 212: + case 184: + case 213: 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); @@ -10476,7 +10610,7 @@ var ts; } break loop; } - if (location.kind === 183 && meaning & 32) { + if (location.kind === 184 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -10484,28 +10618,28 @@ var ts; } } break; - case 133: + case 134: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 212) { + if (ts.isClassLike(grandparent) || grandparent.kind === 213) { 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 140: - case 139: case 141: + case 140: case 142: case 143: - case 210: - case 171: + case 144: + case 211: + case 172: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 170: + case 171: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -10518,8 +10652,8 @@ var ts; } } break; - case 136: - if (location.parent && location.parent.kind === 135) { + case 137: + if (location.parent && location.parent.kind === 136) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -10545,7 +10679,7 @@ 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) { + if (meaning & 2 && result.flags & 2) { checkResolvedBlockScopedVariable(result, errorLocation); } } @@ -10557,14 +10691,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 208); + var variableDeclaration = ts.getAncestor(declaration, 209); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 190 || - variableDeclaration.parent.parent.kind === 196) { + if (variableDeclaration.parent.parent.kind === 191 || + variableDeclaration.parent.parent.kind === 197) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 198 || - variableDeclaration.parent.parent.kind === 197) { + else if (variableDeclaration.parent.parent.kind === 199 || + variableDeclaration.parent.parent.kind === 198) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -10586,10 +10720,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 218) { + if (node.kind === 219) { return node; } - while (node && node.kind !== 219) { + while (node && node.kind !== 220) { node = node.parent; } return node; @@ -10599,7 +10733,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 229) { + if (node.moduleReference.kind === 230) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -10688,17 +10822,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 218: + case 219: return getTargetOfImportEqualsDeclaration(node); - case 220: - return getTargetOfImportClause(node); case 221: + return getTargetOfImportClause(node); + case 222: return getTargetOfNamespaceImport(node); - case 223: + case 224: return getTargetOfImportSpecifier(node); - case 227: + case 228: return getTargetOfExportSpecifier(node); - case 224: + case 225: return getTargetOfExportAssignment(node); } } @@ -10740,10 +10874,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 224) { + if (node.kind === 225) { checkExpressionCached(node.expression); } - else if (node.kind === 227) { + else if (node.kind === 228) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -10753,17 +10887,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 218); + importDeclaration = ts.getAncestor(entityName, 219); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 66 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 67 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 66 || entityName.parent.kind === 132) { + if (entityName.kind === 67 || entityName.parent.kind === 133) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 218); + ts.Debug.assert(entityName.parent.kind === 219); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -10775,16 +10909,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 66) { + if (name.kind === 67) { var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 132 || name.kind === 163) { - var left = name.kind === 132 ? name.left : name.expression; - var right = name.kind === 132 ? name.right : name.name; + else if (name.kind === 133 || name.kind === 164) { + var left = name.kind === 133 ? name.left : name.expression; + var right = name.kind === 133 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -10807,35 +10941,24 @@ var ts; 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) { + if (moduleReferenceExpression.kind !== 9) { return; } var moduleReferenceLiteral = moduleReferenceExpression; var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) + if (!moduleName) { return; + } var isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', 512); + var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); if (symbol) { return symbol; } } - var fileName; - var sourceFile; - while (true) { - fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); - if (sourceFile || isRelative) { - break; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } + var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); + var sourceFile = fileName && host.getSourceFile(fileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -10931,7 +11054,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 141 && ts.nodeIsPresent(member.body)) { + if (member.kind === 142 && ts.nodeIsPresent(member.body)) { return member; } } @@ -10996,17 +11119,17 @@ var ts; } } switch (location_1.kind) { - case 245: + case 246: if (!ts.isExternalModule(location_1)) { break; } - case 215: + case 216: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 211: case 212: + case 213: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -11039,7 +11162,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 227)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -11068,7 +11191,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 227)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -11123,8 +11246,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 215 && declaration.name.kind === 8) || - (declaration.kind === 245 && ts.isExternalModule(declaration)); + return (declaration.kind === 216 && declaration.name.kind === 9) || + (declaration.kind === 246 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -11156,11 +11279,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 151) { + if (entityName.parent.kind === 152) { meaning = 107455 | 1048576; } - else if (entityName.kind === 132 || entityName.kind === 163 || - entityName.parent.kind === 218) { + else if (entityName.kind === 133 || entityName.kind === 164 || + entityName.parent.kind === 219) { meaning = 1536; } else { @@ -11211,16 +11334,15 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 157) { + while (node.kind === 158) { node = node.parent; } - if (node.kind === 213) { + if (node.kind === 214) { return getSymbolOfNode(node); } } return undefined; } - var _displayBuilder; function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -11229,10 +11351,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 183: + case 184: return "(Anonymous class)"; - case 170: case 171: + case 172: return "(Anonymous function)"; } } @@ -11253,7 +11375,7 @@ var ts; buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 20); + writePunctuation(writer, 21); } parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); @@ -11295,7 +11417,7 @@ var ts; var globalFlagsToPass = globalFlags & 16; return writeType(type, globalFlags); function writeType(type, flags) { - if (type.flags & 4194431) { + if (type.flags & 16777343) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -11319,23 +11441,23 @@ var ts; writer.writeStringLiteral(type.text); } else { - writePunctuation(writer, 14); + writePunctuation(writer, 15); writeSpace(writer); - writePunctuation(writer, 21); + writePunctuation(writer, 22); writeSpace(writer); - writePunctuation(writer, 15); + writePunctuation(writer, 16); } } function writeTypeList(types, delimiter) { for (var i = 0; i < types.length; i++) { if (i > 0) { - if (delimiter !== 23) { + if (delimiter !== 24) { writeSpace(writer); } writePunctuation(writer, delimiter); writeSpace(writer); } - writeType(types[i], delimiter === 23 ? 0 : 64); + writeType(types[i], delimiter === 24 ? 0 : 64); } } function writeSymbolTypeReference(symbol, typeArguments, pos, end) { @@ -11343,22 +11465,22 @@ var ts; buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056); } if (pos < end) { - writePunctuation(writer, 24); + writePunctuation(writer, 25); writeType(typeArguments[pos++], 0); while (pos < end) { - writePunctuation(writer, 23); + writePunctuation(writer, 24); writeSpace(writer); writeType(typeArguments[pos++], 0); } - writePunctuation(writer, 26); + writePunctuation(writer, 27); } } function writeTypeReference(type, flags) { var typeArguments = type.typeArguments; if (type.target === globalArrayType && !(flags & 1)) { writeType(typeArguments[0], 64); - writePunctuation(writer, 18); writePunctuation(writer, 19); + writePunctuation(writer, 20); } else { var outerTypeParameters = type.target.outerTypeParameters; @@ -11373,7 +11495,7 @@ var ts; } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { writeSymbolTypeReference(parent_3, typeArguments, start, i); - writePunctuation(writer, 20); + writePunctuation(writer, 21); } } } @@ -11381,17 +11503,17 @@ var ts; } } function writeTupleType(type) { - writePunctuation(writer, 18); - writeTypeList(type.elementTypes, 23); writePunctuation(writer, 19); + writeTypeList(type.elementTypes, 24); + writePunctuation(writer, 20); } function writeUnionOrIntersectionType(type, flags) { if (flags & 64) { - writePunctuation(writer, 16); + writePunctuation(writer, 17); } - writeTypeList(type.types, type.flags & 16384 ? 45 : 44); + writeTypeList(type.types, type.flags & 16384 ? 46 : 45); if (flags & 64) { - writePunctuation(writer, 17); + writePunctuation(writer, 18); } } function writeAnonymousType(type, flags) { @@ -11409,7 +11531,7 @@ var ts; buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); } else { - writeKeyword(writer, 114); + writeKeyword(writer, 115); } } else { @@ -11430,7 +11552,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 245 || declaration.parent.kind === 216; + return declaration.parent.kind === 246 || declaration.parent.kind === 217; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -11439,7 +11561,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 98); + writeKeyword(writer, 99); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } @@ -11455,74 +11577,74 @@ var ts; var resolved = resolveStructuredTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { - writePunctuation(writer, 14); writePunctuation(writer, 15); + writePunctuation(writer, 16); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { if (flags & 64) { - writePunctuation(writer, 16); + writePunctuation(writer, 17); } buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); if (flags & 64) { - writePunctuation(writer, 17); + writePunctuation(writer, 18); } return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { if (flags & 64) { - writePunctuation(writer, 16); + writePunctuation(writer, 17); } - writeKeyword(writer, 89); + writeKeyword(writer, 90); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); if (flags & 64) { - writePunctuation(writer, 17); + writePunctuation(writer, 18); } return; } } - writePunctuation(writer, 14); + writePunctuation(writer, 15); writer.writeLine(); writer.increaseIndent(); for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 89); + writeKeyword(writer, 90); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } if (resolved.stringIndexType) { - writePunctuation(writer, 18); + writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); - writePunctuation(writer, 52); + writePunctuation(writer, 53); writeSpace(writer); - writeKeyword(writer, 127); - writePunctuation(writer, 19); - writePunctuation(writer, 52); + writeKeyword(writer, 128); + writePunctuation(writer, 20); + writePunctuation(writer, 53); writeSpace(writer); writeType(resolved.stringIndexType, 0); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } if (resolved.numberIndexType) { - writePunctuation(writer, 18); + writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); - writePunctuation(writer, 52); + writePunctuation(writer, 53); writeSpace(writer); - writeKeyword(writer, 125); - writePunctuation(writer, 19); - writePunctuation(writer, 52); + writeKeyword(writer, 126); + writePunctuation(writer, 20); + writePunctuation(writer, 53); writeSpace(writer); writeType(resolved.numberIndexType, 0); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { @@ -11534,27 +11656,27 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 51); + writePunctuation(writer, 52); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } } else { buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 51); + writePunctuation(writer, 52); } - writePunctuation(writer, 52); + writePunctuation(writer, 53); writeSpace(writer); writeType(t, 0); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } } writer.decreaseIndent(); - writePunctuation(writer, 15); + writePunctuation(writer, 16); } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -11568,7 +11690,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 80); + writeKeyword(writer, 81); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -11576,67 +11698,67 @@ var ts; function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; if (ts.isRestParameter(parameterNode)) { - writePunctuation(writer, 21); + writePunctuation(writer, 22); } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 51); + writePunctuation(writer, 52); } - writePunctuation(writer, 52); + writePunctuation(writer, 53); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24); + writePunctuation(writer, 25); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23); + writePunctuation(writer, 24); writeSpace(writer); } buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 26); + writePunctuation(writer, 27); } } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24); + writePunctuation(writer, 25); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23); + writePunctuation(writer, 24); writeSpace(writer); } buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0); } - writePunctuation(writer, 26); + writePunctuation(writer, 27); } } function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { - writePunctuation(writer, 16); + writePunctuation(writer, 17); for (var i = 0; i < parameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23); + writePunctuation(writer, 24); writeSpace(writer); } buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 17); + writePunctuation(writer, 18); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8) { writeSpace(writer); - writePunctuation(writer, 33); + writePunctuation(writer, 34); } else { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 121); + writeKeyword(writer, 122); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -11656,15 +11778,12 @@ var ts; buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } 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 @@ -11673,12 +11792,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 215) { - if (node.name.kind === 8) { + if (node.kind === 216) { + if (node.name.kind === 9) { return node; } } - else if (node.kind === 245) { + else if (node.kind === 246) { return ts.isExternalModule(node) ? node : undefined; } } @@ -11721,59 +11840,59 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 160: + case 161: return isDeclarationVisible(node.parent.parent); - case 208: + case 209: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 215: - case 211: + case 216: case 212: case 213: - case 210: case 214: - case 218: + case 211: + case 215: + case 219: var parent_4 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 218 && parent_4.kind !== 245 && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 219 && parent_4.kind !== 246 && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } return isDeclarationVisible(parent_4); + case 139: case 138: - case 137: - case 142: case 143: + case 144: + case 141: case 140: - case 139: if (node.flags & (32 | 64)) { return false; } - case 141: - case 145: - case 144: + case 142: case 146: - case 135: - case 216: - case 149: + case 145: + case 147: + case 136: + case 217: case 150: - case 152: - case 148: + case 151: case 153: + case 149: case 154: case 155: case 156: case 157: + case 158: return isDeclarationVisible(node.parent); - case 220: case 221: - case 223: + case 222: + case 224: return false; - case 134: - case 245: + case 135: + case 246: return true; - case 224: + case 225: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -11789,11 +11908,14 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 224) { - exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); + if (node.parent && node.parent.kind === 225) { + exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 227) { - exportSymbol = getTargetOfExportSpecifier(node.parent); + else if (node.parent.kind === 228) { + var exportSpecifier = node.parent; + exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? + getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : + resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, 107455 | 793056 | 1536 | 8388608); } var result = []; if (exportSymbol) { @@ -11816,29 +11938,55 @@ var ts; }); } } - function pushTypeResolution(target) { - var i = 0; - var count = resolutionTargets.length; - while (i < count && resolutionTargets[i] !== target) { - i++; - } - if (i < count) { - do { - resolutionResults[i++] = false; - } while (i < count); + function pushTypeResolution(target, propertyName) { + var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); + if (resolutionCycleStartIndex >= 0) { + var length_2 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_2; i++) { + resolutionResults[i] = false; + } return false; } resolutionTargets.push(target); resolutionResults.push(true); + resolutionPropertyNames.push(propertyName); return true; } + function findResolutionCycleStartIndex(target, propertyName) { + for (var i = resolutionTargets.length - 1; i >= 0; i--) { + if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) { + return -1; + } + if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) { + return i; + } + } + return -1; + } + function hasType(target, propertyName) { + if (propertyName === 0) { + return getSymbolLinks(target).type; + } + if (propertyName === 2) { + return getSymbolLinks(target).declaredType; + } + if (propertyName === 1) { + ts.Debug.assert(!!(target.flags & 1024)); + return target.resolvedBaseConstructorType; + } + if (propertyName === 3) { + return target.resolvedReturnType; + } + ts.Debug.fail("Unhandled TypeSystemPropertyName " + propertyName); + } function popTypeResolution() { resolutionTargets.pop(); + resolutionPropertyNames.pop(); return resolutionResults.pop(); } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - return node.kind === 208 ? node.parent.parent.parent : node.parent; + return node.kind === 209 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -11864,7 +12012,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 158) { + if (pattern.kind === 159) { var name_10 = declaration.propertyName || declaration.name; type = getTypeOfPropertyOfType(parentType, name_10.text) || isNumericLiteralName(name_10.text) && getIndexTypeOfType(parentType, 1) || @@ -11877,9 +12025,6 @@ var ts; else { var elementType = checkIteratedTypeOrElementType(parentType, pattern, false); if (!declaration.dotDotDotToken) { - if (isTypeAny(elementType)) { - return elementType; - } var propName = "" + ts.indexOf(pattern.elements, declaration); type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) @@ -11901,10 +12046,10 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 197) { + if (declaration.parent.parent.kind === 198) { return anyType; } - if (declaration.parent.parent.kind === 198) { + if (declaration.parent.parent.kind === 199) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -11913,10 +12058,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 135) { + if (declaration.kind === 136) { var func = declaration.parent; - if (func.kind === 143 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 142); + if (func.kind === 144 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -11929,9 +12074,12 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 243) { + if (declaration.kind === 244) { return checkIdentifier(declaration.name); } + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name); + } return undefined; } function getTypeFromBindingElement(element) { @@ -11958,7 +12106,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 184 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 185 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -11973,7 +12121,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 158 + return pattern.kind === 159 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } @@ -11983,15 +12131,12 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 242 ? getWidenedType(type) : type; - } - if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return declaration.kind !== 243 ? getWidenedType(type) : type; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 135 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 136 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -12004,13 +12149,13 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 241) { + if (declaration.parent.kind === 242) { return links.type = anyType; } - if (declaration.kind === 224) { + if (declaration.kind === 225) { return links.type = checkExpression(declaration.expression); } - if (!pushTypeResolution(symbol)) { + if (!pushTypeResolution(symbol, 0)) { return unknownType; } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); @@ -12032,7 +12177,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 142) { + if (accessor.kind === 143) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -12045,11 +12190,11 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (!pushTypeResolution(symbol)) { + if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 142); - var setter = ts.getDeclarationOfKind(symbol, 143); + var getter = ts.getDeclarationOfKind(symbol, 143); + var setter = ts.getDeclarationOfKind(symbol, 144); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -12075,7 +12220,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 142); + var getter_1 = ts.getDeclarationOfKind(symbol, 143); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -12164,9 +12309,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 211 || node.kind === 183 || - node.kind === 210 || node.kind === 170 || - node.kind === 140 || node.kind === 171) { + if (node.kind === 212 || node.kind === 184 || + node.kind === 211 || node.kind === 171 || + node.kind === 141 || node.kind === 172) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -12175,15 +12320,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 212); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 212 || node.kind === 211 || - node.kind === 183 || node.kind === 213) { + if (node.kind === 213 || node.kind === 212 || + node.kind === 184 || node.kind === 214) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -12219,7 +12364,7 @@ var ts; if (!baseTypeNode) { return type.resolvedBaseConstructorType = undefinedType; } - if (!pushTypeResolution(type)) { + if (!pushTypeResolution(type, 1)) { return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); @@ -12288,7 +12433,7 @@ var ts; type.resolvedBaseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 212 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 213 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -12332,10 +12477,10 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - if (!pushTypeResolution(links)) { + if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 213); + var declaration = ts.getDeclarationOfKind(symbol, 214); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -12366,7 +12511,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 134).constraint) { + if (!ts.getDeclarationOfKind(symbol, 135).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -12533,39 +12678,60 @@ var ts; 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; + function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + for (var _i = 0; _i < signatureList.length; _i++) { + var s = signatureList[_i]; + if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { + return s; } } - 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++) { - var signature = signatures[_i]; - if (signature.typeParameters) { - return emptyArray; + function findMatchingSignatures(signatureLists, signature, listIndex) { + if (signature.typeParameters) { + if (listIndex > 0) { + return undefined; } - } - for (var i_1 = 1; i_1 < signatureLists.length; i_1++) { - if (!signatureListsIdentical(signatures, signatureLists[i_1])) { - return emptyArray; + for (var i = 1; i < signatureLists.length; i++) { + if (!findMatchingSignature(signatureLists[i], signature, false, false)) { + return undefined; + } } + return [signature]; } - 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]; }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true); + if (!match) { + return undefined; + } + if (!ts.contains(result, match)) { + (result || (result = [])).push(match); + } } return result; } + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { + var signature = _a[_i]; + if (!result || !findMatchingSignature(result, signature, false, true)) { + var unionSignatures = findMatchingSignatures(signatureLists, signature, i); + if (unionSignatures) { + var s = signature; + if (unionSignatures.length > 1) { + s = cloneSignature(signature); + s.resolvedReturnType = undefined; + s.unionSignatures = unionSignatures; + } + (result || (result = [])).push(s); + } + } + } + } + return result || emptyArray; + } function getUnionIndexType(types, kind) { var indexTypes = []; for (var _i = 0; _i < types.length; _i++) { @@ -12701,9 +12867,6 @@ var ts; return type.flags & 49152 ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } function getApparentType(type) { - if (type.flags & 16384) { - type = getReducedTypeOfUnionType(type); - } if (type.flags & 512) { do { type = getConstraintOfTypeParameter(type); @@ -12721,7 +12884,7 @@ var ts; else if (type.flags & 8) { type = globalBooleanType; } - else if (type.flags & 4194304) { + else if (type.flags & 16777216) { type = globalESSymbolType; } return type; @@ -12802,6 +12965,25 @@ var ts; } return undefined; } + function isKnownProperty(type, name) { + if (type.flags & 80896 && type !== globalObjectType) { + var resolved = resolveStructuredTypeMembers(type); + return !!(resolved.properties.length === 0 || + resolved.stringIndexType || + resolved.numberIndexType || + getPropertyOfType(type, name)); + } + if (type.flags & 49152) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } function getSignaturesOfStructuredType(type, kind) { if (type.flags & 130048) { var resolved = resolveStructuredTypeMembers(type); @@ -12857,12 +13039,22 @@ var ts; return result; } function isOptionalParameter(node) { - return ts.hasQuestionToken(node) || !!node.initializer; + if (ts.hasQuestionToken(node)) { + return true; + } + if (node.initializer) { + var signatureDeclaration = node.parent; + var signature = getSignatureFromDeclaration(signatureDeclaration); + var parameterIndex = signatureDeclaration.parameters.indexOf(node); + ts.Debug.assert(parameterIndex >= 0); + return parameterIndex >= signature.minArgumentCount; + } + return false; } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 141 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 142 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -12871,14 +13063,17 @@ 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) { + if (param.type && param.type.kind === 9) { hasStringLiterals = true; } - if (minArgumentCount < 0) { - if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (minArgumentCount < 0) { minArgumentCount = i; } } + else { + minArgumentCount = -1; + } } if (minArgumentCount < 0) { minArgumentCount = declaration.parameters.length; @@ -12890,7 +13085,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 147) { + if (declaration.type.kind === 148) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -12900,8 +13095,8 @@ var ts; } } else { - if (declaration.kind === 142 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 143); + if (declaration.kind === 143 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 144); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -12919,19 +13114,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 149: case 150: - case 210: - case 140: - case 139: + case 151: + case 211: case 141: - case 144: + case 140: + case 142: case 145: case 146: - case 142: + case 147: case 143: - case 170: + case 144: case 171: + case 172: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -12945,7 +13140,7 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - if (!pushTypeResolution(signature)) { + if (!pushTypeResolution(signature, 3)) { return unknownType; } var type; @@ -13001,7 +13196,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 141 || signature.declaration.kind === 145; + var isConstructor = signature.declaration.kind === 142 || signature.declaration.kind === 146; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -13015,7 +13210,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 125 : 127; + var syntaxKind = kind === 1 ? 126 : 128; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -13044,13 +13239,13 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 134).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 134).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135).parent); } function getTypeListId(types) { switch (types.length) { @@ -13069,19 +13264,19 @@ var ts; return result; } } - function getWideningFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types) { var result = 0; for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } - return result & 3145728; + return result & 14680064; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | getWideningFlagsOfTypes(typeArguments); + var flags = 4096 | getPropagatingFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -13097,13 +13292,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 134; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 148 && n.typeName.kind === 66) { + if (n.kind === 149 && n.typeName.kind === 67) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -13170,7 +13365,7 @@ var ts; function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var typeNameOrExpression = node.kind === 148 ? node.typeName : + var typeNameOrExpression = node.kind === 149 ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; @@ -13196,9 +13391,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 211: case 212: - case 214: + case 213: + case 215: return declaration; } } @@ -13271,7 +13466,7 @@ var ts; var id = getTypeListId(elementTypes); var type = tupleTypes[id]; if (!type) { - type = tupleTypes[id] = createObjectType(8192 | getWideningFlagsOfTypes(elementTypes)); + type = tupleTypes[id] = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); type.elementTypes = elementTypes; } return type; @@ -13297,20 +13492,68 @@ var ts; addTypeToSet(typeSet, type, typeSetKind); } } - function isSubtypeOfAny(candidate, types) { + function isObjectLiteralTypeDuplicateOf(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return false; + } + for (var _i = 0; _i < sourceProperties.length; _i++) { + var sourceProp = sourceProperties[_i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp || + getDeclarationFlagsFromSymbol(targetProp) & (32 | 64) || + !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { + return false; + } + } + return true; + } + function isTupleTypeDuplicateOf(source, target) { + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + if (sourceTypes.length !== targetTypes.length) { + return false; + } + for (var i = 0; i < sourceTypes.length; i++) { + if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { + return false; + } + } + return true; + } + function isTypeDuplicateOf(source, target) { + if (source === target) { + return true; + } + if (source.flags & 32 || source.flags & 64 && !(target.flags & 32)) { + return true; + } + if (source.flags & 524288 && target.flags & 80896) { + return isObjectLiteralTypeDuplicateOf(source, target); + } + if (isArrayType(source) && isArrayType(target)) { + return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]); + } + if (isTupleType(source) && isTupleType(target)) { + return isTupleTypeDuplicateOf(source, target); + } + return isTypeIdenticalTo(source, target); + } + function isTypeDuplicateOfSomeType(candidate, types) { for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; - if (candidate !== type && isTypeSubtypeOf(candidate, type)) { + if (candidate !== type && isTypeDuplicateOf(candidate, type)) { return true; } } return false; } - function removeSubtypes(types) { + function removeDuplicateTypes(types) { var i = types.length; while (i > 0) { i--; - if (isSubtypeOfAny(types[i], types)) { + if (isTypeDuplicateOfSomeType(types[i], types)) { types.splice(i, 1); } } @@ -13333,25 +13576,21 @@ var ts; } } } - function compareTypeIds(type1, type2) { - return type1.id - type2.id; - } - function getUnionType(types, noSubtypeReduction) { + function getUnionType(types, noDeduplication) { if (types.length === 0) { return emptyObjectType; } var typeSet = []; addTypesToSet(typeSet, types, 16384); - typeSet.sort(compareTypeIds); - if (noSubtypeReduction) { - if (containsTypeAny(typeSet)) { - return anyType; - } + if (containsTypeAny(typeSet)) { + return anyType; + } + if (noDeduplication) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeSubtypes(typeSet); + removeDuplicateTypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -13359,25 +13598,11 @@ var ts; var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 | getWideningFlagsOfTypes(typeSet)); + type = unionTypes[id] = createObjectType(16384 | getPropagatingFlagsOfTypes(typeSet)); type.types = typeSet; - type.reducedType = noSubtypeReduction ? undefined : type; } return type; } - function getReducedTypeOfUnionType(type) { - if (!type.reducedType) { - type.reducedType = circularType; - var reducedType = getUnionType(type.types, false); - if (type.reducedType === circularType) { - type.reducedType = reducedType; - } - } - else if (type.reducedType === circularType) { - type.reducedType = type; - } - return type.reducedType; - } function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -13400,7 +13625,7 @@ var ts; var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 | getWideningFlagsOfTypes(typeSet)); + type = intersectionTypes[id] = createObjectType(32768 | getPropagatingFlagsOfTypes(typeSet)); type.types = typeSet; } return type; @@ -13436,45 +13661,45 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 114: + case 115: return anyType; - case 127: + case 128: return stringType; - case 125: + case 126: return numberType; - case 117: + case 118: return booleanType; - case 128: + case 129: return esSymbolType; - case 100: + case 101: return voidType; - case 8: + case 9: return getTypeFromStringLiteral(node); - case 148: + case 149: return getTypeFromTypeReference(node); - case 147: + case 148: return booleanType; - case 185: + case 186: return getTypeFromTypeReference(node); - case 151: + case 152: return getTypeFromTypeQueryNode(node); - case 153: - return getTypeFromArrayTypeNode(node); case 154: - return getTypeFromTupleTypeNode(node); + return getTypeFromArrayTypeNode(node); case 155: - return getTypeFromUnionTypeNode(node); + return getTypeFromTupleTypeNode(node); case 156: - return getTypeFromIntersectionTypeNode(node); + return getTypeFromUnionTypeNode(node); case 157: + return getTypeFromIntersectionTypeNode(node); + case 158: return getTypeFromTypeNode(node.type); - case 149: case 150: - case 152: + case 151: + case 153: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 66: - case 132: - var symbol = getSymbolInfo(node); + case 67: + case 133: + var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType; @@ -13533,7 +13758,7 @@ var ts; }; } function createInferenceMapper(context) { - return function (t) { + var mapper = function (t) { for (var i = 0; i < context.typeParameters.length; i++) { if (t === context.typeParameters[i]) { context.inferences[i].isFixed = true; @@ -13542,6 +13767,8 @@ var ts; } return t; }; + mapper.context = context; + return mapper; } function identityMapper(type) { return type; @@ -13635,27 +13862,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 140 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 170: case 171: + case 172: return isContextSensitiveFunctionLikeDeclaration(node); - case 162: + case 163: return ts.forEach(node.properties, isContextSensitive); - case 161: + case 162: return ts.forEach(node.elements, isContextSensitive); - case 179: + case 180: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 178: - return node.operatorToken.kind === 50 && + case 179: + return node.operatorToken.kind === 51 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 242: + case 243: return isContextSensitive(node.initializer); + case 141: case 140: - case 139: return isContextSensitiveFunctionLikeDeclaration(node); - case 169: + case 170: return isContextSensitive(node.expression); } return false; @@ -13729,98 +13956,134 @@ var ts; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } + function reportRelationError(message, source, target) { + var sourceType = typeToString(source); + var targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, undefined, 128); + targetType = typeToString(target, undefined, 128); + } + reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + } function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source === target) return -1; - if (relation !== identityRelation) { - if (isTypeAny(target)) - return -1; - if (source === undefinedType) - return -1; - if (source === nullType && target !== undefinedType) - return -1; - if (source.flags & 128 && target === numberType) + if (relation === identityRelation) { + return isIdenticalTo(source, target); + } + if (isTypeAny(target)) + 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 (isTypeAny(source)) return -1; - if (source.flags & 256 && target === stringType) + if (source === numberType && target.flags & 128) return -1; - if (relation === assignableRelation) { - if (isTypeAny(source)) - return -1; - if (source === numberType && target.flags & 128) - return -1; + } + if (source.flags & 1048576) { + if (hasExcessProperties(source, target, reportErrors)) { + if (reportErrors) { + reportRelationError(headMessage, source, target); + } + return 0; } + source = getRegularTypeOfObjectLiteral(source); } var saveErrorInfo = errorInfo; - if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + if (source.flags & 16384) { + if (result = eachTypeRelatedToType(source, target, reportErrors)) { return result; } } - else if (source.flags & 512 && target.flags & 512) { - if (result = typeParameterRelatedTo(source, target, reportErrors)) { + else if (target.flags & 32768) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - else if (relation !== identityRelation) { - if (source.flags & 16384) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + else { + if (source.flags & 32768) { + if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384))) { return result; } } - else if (target.flags & 32768) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + if (target.flags & 16384) { + if (result = typeRelatedToSomeType(source, target, reportErrors)) { return result; } } - else { - if (source.flags & 32768) { - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384))) { - return result; - } + } + if (source.flags & 512) { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; + } + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { + errorInfo = saveErrorInfo; + return result; + } + } + else { + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; } - if (target.flags & 16384) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { - return result; - } + } + var apparentType = getApparentType(source); + if (apparentType.flags & (80896 | 32768) && target.flags & 80896) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; + if (result = objectTypeRelatedTo(apparentType, target, reportStructuralErrors)) { + errorInfo = saveErrorInfo; + return result; } } } - else { - if (source.flags & 16384 && target.flags & 16384 || - source.flags & 32768 && target.flags & 32768) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { - return result; - } + if (reportErrors) { + reportRelationError(headMessage, source, target); + } + return 0; + } + function isIdenticalTo(source, target) { + var result; + if (source.flags & 80896 && target.flags & 80896) { + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, false)) { + return result; } } + return objectTypeRelatedTo(source, target, false); } - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & (80896 | 32768) && target.flags & 80896) { - if (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors)) { - errorInfo = saveErrorInfo; - return result; - } + if (source.flags & 512 && target.flags & 512) { + return typeParameterIdenticalTo(source, target); } - else if (source.flags & 512 && sourceOrApparentType.flags & 49152) { - errorInfo = saveErrorInfo; - if (result = isRelatedTo(sourceOrApparentType, target, reportErrors)) { - return result; + if (source.flags & 16384 && target.flags & 16384 || + source.flags & 32768 && target.flags & 32768) { + if (result = eachTypeRelatedToSomeType(source, target)) { + if (result &= eachTypeRelatedToSomeType(target, source)) { + 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); + return 0; + } + function hasExcessProperties(source, target, reportErrors) { + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (!isKnownProperty(target, prop.name)) { + if (reportErrors) { + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } + return true; } - reportError(headMessage, sourceType, targetType); } - return 0; } function eachTypeRelatedToSomeType(source, target) { var result = -1; @@ -13892,30 +14155,17 @@ var ts; } 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); + function typeParameterIdenticalTo(source, target) { + if (source.symbol.name !== target.symbol.name) { + return 0; } - else { - while (true) { - var constraint = getConstraintOfTypeParameter(source); - if (constraint === target) - return -1; - if (!(constraint && constraint.flags & 512)) - break; - source = constraint; - } + if (source.constraint === target.constraint) { + return -1; + } + if (source.constraint === noConstraintType || target.constraint === noConstraintType) { return 0; } + return isIdenticalTo(source.constraint, target.constraint); } function objectTypeRelatedTo(source, target, reportErrors) { if (overflow) { @@ -14092,22 +14342,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1; var saveErrorInfo = errorInfo; - var sourceSig = sourceSignatures[0]; - var targetSig = targetSignatures[0]; - if (sourceSig && targetSig) { - var sourceErasedSignature = getErasedSignature(sourceSig); - var targetErasedSignature = getErasedSignature(targetSig); - var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); - var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; - if (sourceIsAbstract && !targetIsAbstract) { - if (reportErrors) { - reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - } - return 0; + if (kind === 1) { + var sourceSig = sourceSignatures[0]; + var targetSig = targetSignatures[0]; + result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig); + if (result !== -1) { + return result; } } outer: for (var _i = 0; _i < targetSignatures.length; _i++) { @@ -14131,6 +14371,30 @@ var ts; } } return result; + function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { + if (sourceSig && targetSig) { + var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212); + var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212); + if (!sourceDecl) { + return -1; + } + var sourceErasedSignature = getErasedSignature(sourceSig); + var targetErasedSignature = getErasedSignature(targetSig); + var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); + var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212); + var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; + var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; + if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0; + } + } + return -1; + } } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -14219,7 +14483,7 @@ var ts; } var result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], false, false, isRelatedTo); if (!related) { return 0; } @@ -14232,7 +14496,7 @@ var ts; return indexTypesIdenticalTo(0, source, target); } var targetType = getIndexTypeOfType(target, 0); - if (targetType) { + if (targetType && !(targetType.flags & 1)) { var sourceType = getIndexTypeOfType(source, 0); if (!sourceType) { if (reportErrors) { @@ -14256,7 +14520,7 @@ var ts; return indexTypesIdenticalTo(1, source, target); } var targetType = getIndexTypeOfType(target, 1); - if (targetType) { + if (targetType && !(targetType.flags & 1)) { var sourceStringType = getIndexTypeOfType(source, 0); var sourceNumberType = getIndexTypeOfType(source, 1); if (!(sourceStringType || sourceNumberType)) { @@ -14333,14 +14597,18 @@ var ts; } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } - function compareSignatures(source, target, compareReturnTypes, compareTypes) { + function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { if (source === target) { return -1; } if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { - return 0; + if (!partialMatch || + source.parameters.length < target.parameters.length && !source.hasRestParameter || + source.minArgumentCount > target.minArgumentCount) { + return 0; + } } var result = -1; if (source.typeParameters && target.typeParameters) { @@ -14360,16 +14628,18 @@ var ts; } 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 sourceLen = source.parameters.length; + var targetLen = target.parameters.length; + for (var i = 0; i < targetLen; i++) { + var s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0; } result &= related; } - if (compareReturnTypes) { + if (!ignoreReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } return result; @@ -14424,6 +14694,23 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192); } + function getRegularTypeOfObjectLiteral(type) { + if (type.flags & 1048576) { + var regularType = type.regularType; + if (!regularType) { + regularType = createType(type.flags & ~1048576); + regularType.symbol = type.symbol; + regularType.members = type.members; + regularType.properties = type.properties; + regularType.callSignatures = type.callSignatures; + regularType.constructSignatures = type.constructSignatures; + regularType.stringIndexType = type.stringIndexType; + regularType.numberIndexType = type.numberIndexType; + } + return regularType; + } + return type; + } function getWidenedTypeOfObjectLiteral(type) { var properties = getPropertiesOfObjectType(type); var members = {}; @@ -14451,7 +14738,7 @@ var ts; return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); } function getWidenedType(type) { - if (type.flags & 3145728) { + if (type.flags & 6291456) { if (type.flags & (32 | 64)) { return anyType; } @@ -14495,7 +14782,7 @@ var ts; for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); - if (t.flags & 1048576) { + if (t.flags & 2097152) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -14509,22 +14796,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 139: case 138: - case 137: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 135: + case 136: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 210: + case 211: + case 141: case 140: - case 139: - case 142: case 143: - case 170: + case 144: case 171: + case 172: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -14537,7 +14824,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 1048576) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152) { if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); } @@ -14573,7 +14860,9 @@ var ts; var inferences = []; for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; - inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); + inferences.push({ + primary: undefined, secondary: undefined, isFixed: false + }); } return { typeParameters: typeParameters, @@ -14597,10 +14886,10 @@ var ts; return false; } function inferFromTypes(source, target) { - if (source === anyFunctionType) { - return; - } if (target.flags & 512) { + if (source.flags & 8388608) { + return; + } var typeParameters = context.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { @@ -14624,6 +14913,13 @@ var ts; inferFromTypes(sourceTypes[i], targetTypes[i]); } } + else if (source.flags & 8192 && target.flags & 8192 && source.elementTypes.length === target.elementTypes.length) { + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } else if (target.flags & 49152) { var targetTypes = target.types; var typeParameterCount = 0; @@ -14767,10 +15063,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 151: + case 152: return true; - case 66: - case 132: + case 67: + case 133: node = node.parent; continue; default: @@ -14810,12 +15106,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 54 && node.operatorToken.kind <= 65) { + if (node.operatorToken.kind >= 55 && node.operatorToken.kind <= 66) { var n = node.left; - while (n.kind === 169) { + while (n.kind === 170) { n = n.expression; } - if (n.kind === 66 && getResolvedSymbol(n) === symbol) { + if (n.kind === 67 && getResolvedSymbol(n) === symbol) { return true; } } @@ -14829,82 +15125,60 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 178: + case 179: return isAssignedInBinaryExpression(node); - case 208: - case 160: + case 209: + case 161: return isAssignedInVariableDeclaration(node); - case 158: case 159: - case 161: + case 160: case 162: case 163: case 164: case 165: case 166: - case 168: - case 186: + case 167: case 169: - case 176: - case 172: - case 175: + case 187: + case 170: + case 177: case 173: + case 176: case 174: - case 177: - case 181: - case 179: + case 175: + case 178: case 182: - case 189: + case 180: + case 183: case 190: - case 192: + case 191: case 193: case 194: case 195: case 196: case 197: case 198: - case 201: + case 199: case 202: case 203: - case 238: - case 239: case 204: + case 239: + case 240: case 205: case 206: - case 241: - case 230: + case 207: + case 242: case 231: - case 235: - case 236: case 232: + case 236: case 237: + case 233: + case 238: return ts.forEachChild(node, isAssignedIn); } return false; } } - function resolveLocation(node) { - var containerNodes = []; - for (var parent_5 = node.parent; parent_5; parent_5 = parent_5.parent) { - if ((ts.isExpression(parent_5) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(parent_5)) { - containerNodes.unshift(parent_5); - } - } - 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) { @@ -14914,34 +15188,34 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 193: + case 194: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 179: + case 180: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 178: + case 179: if (child === node.right) { - if (node.operatorToken.kind === 49) { + if (node.operatorToken.kind === 50) { narrowedType = narrowType(type, node.left, true); } - else if (node.operatorToken.kind === 50) { + else if (node.operatorToken.kind === 51) { narrowedType = narrowType(type, node.left, false); } } break; - case 245: - case 215: - case 210: + case 246: + case 216: + case 211: + case 141: case 140: - case 139: - case 142: case 143: - case 141: + case 144: + case 142: break loop; } if (narrowedType !== type) { @@ -14955,21 +15229,21 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 173 || expr.right.kind !== 8) { + if (expr.left.kind !== 174 || expr.right.kind !== 9) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 66 || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 67 || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operatorToken.kind === 32) { + if (expr.operatorToken.kind === 33) { assumeTrue = !assumeTrue; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8 | 4194304, true, false); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 16777216, true, false); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; @@ -15006,7 +15280,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 66 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -15039,11 +15313,14 @@ var ts; return type; } function getNarrowedType(originalType, narrowedTypeCandidate) { - if (isTypeSubtypeOf(narrowedTypeCandidate, originalType)) { - return narrowedTypeCandidate; - } if (originalType.flags & 16384) { - return getUnionType(ts.filter(originalType.types, function (t) { return isTypeSubtypeOf(t, narrowedTypeCandidate); })); + var assignableConstituents = ts.filter(originalType.types, function (t) { return isTypeAssignableTo(t, narrowedTypeCandidate); }); + if (assignableConstituents.length) { + return getUnionType(assignableConstituents); + } + } + if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { + return narrowedTypeCandidate; } return originalType; } @@ -15067,27 +15344,27 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 165: + case 166: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 169: + case 170: return narrowType(type, expr.expression, assumeTrue); - case 178: + case 179: var operator = expr.operatorToken.kind; - if (operator === 31 || operator === 32) { + if (operator === 32 || operator === 33) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 49) { + else if (operator === 50) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 50) { + else if (operator === 51) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 88) { + else if (operator === 89) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 176: - if (expr.operator === 47) { + case 177: + if (expr.operator === 48) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -15099,7 +15376,7 @@ var ts; var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 171) { + if (container.kind === 172) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -15130,15 +15407,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 241) { + symbol.valueDeclaration.parent.kind === 242) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 209) { + while (container.kind !== 210) { container = container.parent; } container = container.parent; - if (container.kind === 190) { + if (container.kind === 191) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -15156,7 +15433,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 138 || container.kind === 141) { + if (container.kind === 139 || container.kind === 142) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -15167,29 +15444,29 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 171) { + if (container.kind === 172) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 215: + case 216: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 214: + case 215: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 141: + case 142: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 139: case 138: - case 137: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 133: + case 134: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -15204,86 +15481,92 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 135) { + if (n.kind === 136) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 165 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 166 && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; + var container = ts.getSuperContainer(node, true); + var needToCaptureLexicalThis = false; + if (!isCallExpression) { + while (container && container.kind === 172) { + container = ts.getSuperContainer(container, true); + needToCaptureLexicalThis = languageVersion < 2; + } + } + var canUseSuperExpression = isLegalUsageOfSuperExpression(container); + var nodeCheckFlag = 0; + if (canUseSuperExpression) { + if ((container.flags & 128) || isCallExpression) { + nodeCheckFlag = 512; + } + else { + nodeCheckFlag = 256; + } + getNodeLinks(node).flags |= nodeCheckFlag; + if (needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + } if (!baseClassType) { if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) { 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; - var needToCaptureLexicalThis; + if (!canUseSuperExpression) { + if (container && container.kind === 134) { + 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; + } + if (container.kind === 142 && isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + return unknownType; + } + return nodeCheckFlag === 512 + ? getBaseConstructorTypeOfClass(classType) + : baseClassType; + function isLegalUsageOfSuperExpression(container) { + if (!container) { + return false; + } if (isCallExpression) { - canUseSuperExpression = container.kind === 141; + return container.kind === 142; } else { - needToCaptureLexicalThis = false; - while (container && container.kind === 171) { - container = ts.getSuperContainer(container, true); - needToCaptureLexicalThis = languageVersion < 2; - } if (container && ts.isClassLike(container.parent)) { if (container.flags & 128) { - canUseSuperExpression = + return container.kind === 141 || container.kind === 140 || - container.kind === 139 || - container.kind === 142 || - container.kind === 143; + container.kind === 143 || + container.kind === 144; } else { - canUseSuperExpression = + return container.kind === 141 || container.kind === 140 || - container.kind === 139 || - container.kind === 142 || - container.kind === 143 || - container.kind === 138 || - container.kind === 137 || - container.kind === 141; + container.kind === 143 || + container.kind === 144 || + container.kind === 139 || + container.kind === 138 || + container.kind === 142; } } } - if (canUseSuperExpression) { - var returnType; - if ((container.flags & 128) || isCallExpression) { - getNodeLinks(node).flags |= 512; - returnType = getBaseConstructorTypeOfClass(classType); - } - else { - getNodeLinks(node).flags |= 256; - returnType = baseClassType; - } - if (container.kind === 141 && 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 && container.kind === 133) { - 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 false; } - return unknownType; } function getContextuallyTypedParameterType(parameter) { if (isFunctionExpressionOrArrowFunction(parameter.parent)) { @@ -15312,7 +15595,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 135) { + if (declaration.kind === 136) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -15345,7 +15628,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 135 && node.parent.initializer === node) { + if (node.parent.kind === 136 && node.parent.initializer === node) { return true; } node = node.parent; @@ -15354,8 +15637,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 141 || - functionDecl.kind === 142 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 143))) { + functionDecl.kind === 142 || + functionDecl.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -15374,7 +15657,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 167) { + if (template.parent.kind === 168) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -15382,12 +15665,12 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 54 && operator <= 65) { + if (operator >= 55 && operator <= 66) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 50) { + else if (operator === 51) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -15474,7 +15757,7 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxExpression(expr) { - if (expr.parent.kind === 235) { + if (expr.parent.kind === 236) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -15484,7 +15767,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 236) { + if (expr.kind === 237) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -15502,38 +15785,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 208: - case 135: + case 209: + case 136: + case 139: case 138: - case 137: - case 160: + case 161: return getContextualTypeForInitializerExpression(node); - case 171: - case 201: + case 172: + case 202: return getContextualTypeForReturnExpression(node); - case 181: + case 182: return getContextualTypeForYieldOperand(parent); - case 165: case 166: + case 167: return getContextualTypeForArgument(parent, node); - case 168: - case 186: + case 169: + case 187: return getTypeFromTypeNode(parent.type); - case 178: + case 179: return getContextualTypeForBinaryOperand(node); - case 242: + case 243: return getContextualTypeForObjectLiteralElement(parent); - case 161: + case 162: return getContextualTypeForElementExpression(node); - case 179: + case 180: return getContextualTypeForConditionalOperand(node); - case 187: - ts.Debug.assert(parent.parent.kind === 180); + case 188: + ts.Debug.assert(parent.parent.kind === 181); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 169: + case 170: return getContextualType(parent); + case 238: case 237: - case 236: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -15548,7 +15831,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 170 || node.kind === 171; + return node.kind === 171 || node.kind === 172; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -15556,7 +15839,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 140 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -15570,16 +15853,12 @@ var ts; var types = type.types; for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; - if (signatureList && - getSignaturesOfStructuredType(current, 0).length > 1) { - return undefined; - } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { + else if (!compareSignatures(signatureList[0], signature, false, true, compareTypes)) { return undefined; } else { @@ -15596,17 +15875,17 @@ var ts; return result; } function isInferentialContext(mapper) { - return mapper && mapper !== identityMapper; + return mapper && mapper.context; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 178 && parent.operatorToken.kind === 54 && parent.left === node) { + if (parent.kind === 179 && parent.operatorToken.kind === 55 && parent.left === node) { return true; } - if (parent.kind === 242) { + if (parent.kind === 243) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 161) { + if (parent.kind === 162) { return isAssignmentTarget(parent); } return false; @@ -15625,7 +15904,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 182) { + if (inDestructuringPattern && e.kind === 183) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -15637,7 +15916,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 182; + hasSpreadElement = hasSpreadElement || e.kind === 183; } if (!hasSpreadElement) { var contextualType = getContextualType(node); @@ -15648,7 +15927,7 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 133 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 134 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); @@ -15663,7 +15942,7 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 | 258 | 4194304)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 | 258 | 16777216)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -15681,18 +15960,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 242 || - memberDecl.kind === 243 || + if (memberDecl.kind === 243 || + memberDecl.kind === 244 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 242) { + if (memberDecl.kind === 243) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 140) { + else if (memberDecl.kind === 141) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 243); + ts.Debug.assert(memberDecl.kind === 244); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -15707,7 +15986,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 142 || memberDecl.kind === 143); + ts.Debug.assert(memberDecl.kind === 143 || memberDecl.kind === 144); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -15718,7 +15997,7 @@ var ts; var stringIndexType = getIndexType(0); var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 524288 | 2097152 | (typeFlags & 1048576); + result.flags |= 524288 | 1048576 | 4194304 | (typeFlags & 14680064); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -15747,31 +16026,34 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 66) { + if (lhs.kind === 67) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && tagNamesAreEquivalent(lhs.left, rhs.left); } function checkJsxElement(node) { + checkJsxOpeningLikeElement(node.openingElement); if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { error(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNode(node.openingElement.tagName)); } - checkJsxOpeningLikeElement(node.openingElement); + else { + getJsxElementTagSymbol(node.closingElement); + } for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 237: + case 238: checkJsxExpression(child); break; - case 230: + case 231: checkJsxElement(child); break; - case 231: + case 232: checkJsxSelfClosingElement(child); break; default: - ts.Debug.assert(child.kind === 233); + ts.Debug.assert(child.kind === 234); } } return jsxElementType || anyType; @@ -15780,7 +16062,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 132) { + if (tagName.kind === 133) { return false; } else { @@ -15795,9 +16077,17 @@ var ts; else if (elementAttributesType && !isTypeAny(elementAttributesType)) { var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - if (!correspondingPropType && isUnhyphenatedJsxName(node.name.text)) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; + if (isUnhyphenatedJsxName(node.name.text)) { + var indexerType = getIndexTypeOfType(elementAttributesType, 0); + if (indexerType) { + correspondingPropType = indexerType; + } + else { + if (!correspondingPropType) { + error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); + return unknownType; + } + } } } var exprType; @@ -15860,7 +16150,7 @@ var ts; links.jsxFlags |= 2; return intrinsicElementsType.symbol; } - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, 'JSX.' + JsxNames.IntrinsicElements); + error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); return unknownSymbol; } else { @@ -15870,26 +16160,26 @@ var ts; } } function lookupClassTag(node) { - var valueSymbol; - if (node.tagName.kind === 66) { - var tag = node.tagName; - var sym = getResolvedSymbol(tag); - valueSymbol = sym.exportSymbol || sym; - } - else { - valueSymbol = checkQualifiedName(node.tagName).symbol; - } + var valueSymbol = resolveJsxTagName(node); if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4; getSymbolLinks(valueSymbol).referenced = true; } return valueSymbol || unknownSymbol; } + function resolveJsxTagName(node) { + if (node.tagName.kind === 67) { + var tag = node.tagName; + var sym = getResolvedSymbol(tag); + return sym.exportSymbol || sym; + } + else { + return checkQualifiedName(node.tagName).symbol; + } + } } function getJsxElementInstanceType(node) { - if (!(getNodeLinks(node).jsxFlags & 4)) { - return undefined; - } + ts.Debug.assert(!!(getNodeLinks(node).jsxFlags & 4), "Should not call getJsxElementInstanceType on non-class Element"); var classSymbol = getJsxElementTagSymbol(node); if (classSymbol === unknownSymbol) { return anyType; @@ -15903,14 +16193,10 @@ var ts; signatures = getSignaturesOfType(valueType, 0); if (signatures.length === 0) { error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return undefined; + return unknownType; } } - var returnType = getUnionType(signatures.map(function (s) { return getReturnTypeOfSignature(s); })); - if (!isTypeAny(returnType) && !(returnType.flags & 80896)) { - error(node.tagName, ts.Diagnostics.The_return_type_of_a_JSX_element_constructor_must_return_an_object_type); - return undefined; - } + var returnType = getUnionType(signatures.map(getReturnTypeOfSignature)); var elemClassType = getJsxGlobalElementClassType(); if (elemClassType) { checkTypeRelatedTo(returnType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); @@ -15945,7 +16231,7 @@ var ts; if (links.jsxFlags & 4) { var elemInstanceType = getJsxElementInstanceType(node); if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = anyType; + return links.resolvedJsxType = elemInstanceType; } var propsName = getJsxElementPropertiesName(); if (propsName === undefined) { @@ -16013,7 +16299,7 @@ var ts; checkGrammarJsxElement(node); checkJsxPreconditions(node); if (compilerOptions.jsx === 2) { - var reactSym = resolveName(node.tagName, 'React', 107455, ts.Diagnostics.Cannot_find_name_0, 'React'); + var reactSym = resolveName(node.tagName, "React", 107455, ts.Diagnostics.Cannot_find_name_0, "React"); if (reactSym) { getSymbolLinks(reactSym).referenced = true; } @@ -16022,11 +16308,11 @@ var ts; var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 235) { + if (node.attributes[i].kind === 236) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 236); + ts.Debug.assert(node.attributes[i].kind === 237); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -16052,7 +16338,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 138; + return s.valueDeclaration ? s.valueDeclaration.kind : 139; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -16060,11 +16346,11 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 92) { - var errorNode = node.kind === 163 ? + if (left.kind === 93) { + var errorNode = node.kind === 164 ? node.name : node.right; - if (getDeclarationKindFromSymbol(prop) !== 140) { + if (getDeclarationKindFromSymbol(prop) !== 141) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -16085,7 +16371,7 @@ var ts; } return true; } - if (left.kind === 92) { + if (left.kind === 93) { return true; } if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { @@ -16130,7 +16416,7 @@ var ts; return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 163 + var left = node.kind === 164 ? node.expression : node.left; var type = checkExpression(left); @@ -16145,7 +16431,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 166 && node.parent.expression === node) { + if (node.parent.kind === 167 && 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); @@ -16163,7 +16449,7 @@ var ts; } var isConstEnum = isConstEnumObjectType(objectType); if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + (!node.argumentExpression || node.argumentExpression.kind !== 9)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -16181,7 +16467,7 @@ var ts; } } } - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 | 132 | 4194304)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 | 132 | 16777216)) { if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132)) { var numberIndexType = getIndexTypeOfType(objectType, 1); if (numberIndexType) { @@ -16201,7 +16487,7 @@ var ts; return unknownType; } function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { - if (indexArgumentExpression.kind === 8 || indexArgumentExpression.kind === 7) { + if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { @@ -16217,7 +16503,7 @@ var ts; if (!ts.isWellKnownSymbolSyntactically(expression)) { return false; } - if ((expressionType.flags & 4194304) === 0) { + if ((expressionType.flags & 16777216) === 0) { if (reportError) { error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); } @@ -16241,10 +16527,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 167) { + if (node.kind === 168) { checkExpression(node.template); } - else if (node.kind !== 136) { + else if (node.kind !== 137) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -16266,19 +16552,19 @@ var ts; for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_6 = signature.declaration && signature.declaration.parent; + var parent_5 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_6 === lastParent) { + if (lastParent && parent_5 === lastParent) { index++; } else { - lastParent = parent_6; + lastParent = parent_5; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_6; + lastParent = parent_5; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -16295,7 +16581,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 182) { + if (arg && arg.kind === 183) { return i; } } @@ -16307,11 +16593,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 167) { + if (node.kind === 168) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 180) { + if (tagExpression.template.kind === 181) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -16319,11 +16605,11 @@ var ts; } else { var templateLiteral = tagExpression.template; - ts.Debug.assert(templateLiteral.kind === 10); + ts.Debug.assert(templateLiteral.kind === 11); callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 136) { + else if (node.kind === 137) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -16331,7 +16617,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 166); + ts.Debug.assert(callExpression.kind === 167); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -16384,7 +16670,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 184) { + if (arg === undefined || arg.kind !== 185) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -16431,11 +16717,11 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 184) { + if (arg === undefined || arg.kind !== 185) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { - argType = arg.kind === 8 && !reportErrors + argType = arg.kind === 9 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } @@ -16450,16 +16736,16 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 167) { + if (node.kind === 168) { var template = node.template; args = [undefined]; - if (template.kind === 180) { + if (template.kind === 181) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 136) { + else if (node.kind === 137) { return undefined; } else { @@ -16468,18 +16754,18 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 136) { + if (node.kind === 137) { switch (node.parent.kind) { - case 211: - case 183: + case 212: + case 184: return 1; - case 138: + case 139: return 2; - case 140: - case 142: + case 141: case 143: + case 144: return signature.parameters.length >= 3 ? 3 : 2; - case 135: + case 136: return 3; } } @@ -16489,20 +16775,20 @@ var ts; } function getEffectiveDecoratorFirstArgumentType(node) { switch (node.kind) { - case 211: - case 183: + case 212: + case 184: var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 135: + case 136: node = node.parent; - if (node.kind === 141) { + if (node.kind === 142) { var classSymbol_1 = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol_1); } - case 138: - case 140: - case 142: + case 139: + case 141: case 143: + case 144: return getParentTypeOfClassElement(node); default: ts.Debug.fail("Unsupported decorator target."); @@ -16511,27 +16797,27 @@ var ts; } function getEffectiveDecoratorSecondArgumentType(node) { switch (node.kind) { - case 211: + case 212: ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; - case 135: + case 136: node = node.parent; - if (node.kind === 141) { + if (node.kind === 142) { return anyType; } - case 138: - case 140: - case 142: + case 139: + case 141: case 143: + case 144: var element = node; switch (element.name.kind) { - case 66: - case 7: + case 67: case 8: + case 9: return getStringLiteralType(element.name); - case 133: + case 134: var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 4194304)) { + if (allConstituentTypesHaveKind(nameType, 16777216)) { return nameType; } else { @@ -16548,17 +16834,17 @@ var ts; } function getEffectiveDecoratorThirdArgumentType(node) { switch (node.kind) { - case 211: + case 212: ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; - case 135: + case 136: return numberType; - case 138: + case 139: ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; - case 140: - case 142: + case 141: case 143: + case 144: var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); default: @@ -16580,26 +16866,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 136) { + if (node.kind === 137) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 167) { + else if (argIndex === 0 && node.kind === 168) { return globalTemplateStringsArrayType; } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 136 || - (argIndex === 0 && node.kind === 167)) { + if (node.kind === 137 || + (argIndex === 0 && node.kind === 168)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 136) { + if (node.kind === 137) { return node.expression; } - else if (argIndex === 0 && node.kind === 167) { + else if (argIndex === 0 && node.kind === 168) { return node.template; } else { @@ -16607,12 +16893,12 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 167; - var isDecorator = node.kind === 136; + var isTaggedTemplate = node.kind === 168; + var isDecorator = node.kind === 137; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; - if (node.expression.kind !== 92) { + if (node.expression.kind !== 93) { ts.forEach(typeArguments, checkSourceElement); } } @@ -16675,6 +16961,9 @@ var ts; for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { + if (candidate.typeParameters && typeArguments) { + candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); + } return candidate; } } @@ -16747,7 +17036,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 92) { + if (node.expression.kind === 93) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); @@ -16792,7 +17081,7 @@ var ts; if (expressionType === unknownType) { return resolveErrorCall(node); } - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 211); + var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212); if (valueDecl && valueDecl.flags & 256) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -16836,16 +17125,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 211: - case 183: + case 212: + case 184: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 135: + case 136: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 138: + case 139: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 140: - case 142: + case 141: case 143: + case 144: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -16873,16 +17162,16 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 165) { + if (node.kind === 166) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 166) { + else if (node.kind === 167) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 167) { + else if (node.kind === 168) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 136) { + else if (node.kind === 137) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -16894,15 +17183,15 @@ var ts; function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 92) { + if (node.expression.kind === 93) { return voidType; } - if (node.kind === 166) { + if (node.kind === 167) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 141 && - declaration.kind !== 145 && - declaration.kind !== 150) { + declaration.kind !== 142 && + declaration.kind !== 146 && + declaration.kind !== 151) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -16915,7 +17204,7 @@ var ts; return getReturnTypeOfSignature(getResolvedSignature(node)); } function checkAssertion(node) { - var exprType = checkExpression(node.expression); + var exprType = getRegularTypeOfObjectLiteral(checkExpression(node.expression)); var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); @@ -16934,13 +17223,22 @@ var ts; 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); + var contextualParameterType = getTypeAtPosition(context, i); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { var parameter = ts.lastOrUndefined(signature.parameters); - var links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(ts.lastOrUndefined(context.parameters)), mapper); + var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + } + } + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + var links = getSymbolLinks(parameter); + if (!links.type) { + links.type = instantiateType(contextualType, mapper); + } + else if (isInferentialContext(mapper)) { + inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function createPromiseType(promisedType) { @@ -16958,7 +17256,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 189) { + if (func.body.kind !== 190) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -17062,7 +17360,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 205); + return (body.statements.length === 1) && (body.statements[0].kind === 206); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -17071,7 +17369,7 @@ var ts; if (returnType === voidType || isTypeAny(returnType)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 189) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 190) { return; } var bodyBlock = func.body; @@ -17084,9 +17382,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 !== 140 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 170) { + if (!hasGrammarError && node.kind === 171) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -17098,33 +17396,38 @@ var ts; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); - if (!(links.flags & 1024)) { + var contextSensitive = isContextSensitive(node); + var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + if (mightFixTypeParameters || !(links.flags & 1024)) { var contextualSignature = getContextualSignature(node); - if (!(links.flags & 1024)) { + var contextChecked = !!(links.flags & 1024); + if (mightFixTypeParameters || !contextChecked) { links.flags |= 1024; if (contextualSignature) { var signature = getSignaturesOfType(type, 0)[0]; - if (isContextSensitive(node)) { + if (contextSensitive) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type && !signature.resolvedReturnType) { + if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } } - checkSignatureDeclaration(node); + if (!contextChecked) { + checkSignatureDeclaration(node); + } } } - if (produceDiagnostics && node.kind !== 140 && node.kind !== 139) { + if (produceDiagnostics && node.kind !== 141 && node.kind !== 140) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 140 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -17141,7 +17444,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 189) { + if (node.body.kind === 190) { checkSourceElement(node.body); } else { @@ -17173,17 +17476,17 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 66: { + case 67: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; } - case 163: { + case 164: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; } - case 164: + case 165: return true; - case 169: + case 170: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -17191,22 +17494,22 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 66: - case 163: { + case 67: + case 164: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768) !== 0; } - case 164: { + case 165: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8) { + if (symbol && index && index.kind === 9) { var name_12 = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 32768) !== 0; } return false; } - case 169: + case 170: return isConstVariableReference(n.expression); default: return false; @@ -17249,17 +17552,17 @@ var ts; function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); switch (node.operator) { - case 34: case 35: - case 48: - if (someConstituentTypeHasKind(operandType, 4194304)) { + case 36: + case 49: + if (someConstituentTypeHasKind(operandType, 16777216)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 47: + case 48: return booleanType; - case 39: case 40: + case 41: 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); @@ -17315,7 +17618,7 @@ var ts; return (symbol.flags & 128) !== 0; } function checkInstanceOfExpression(node, leftType, rightType) { - if (allConstituentTypesHaveKind(leftType, 4194814)) { + if (allConstituentTypesHaveKind(leftType, 16777726)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -17324,7 +17627,7 @@ var ts; return booleanType; } function checkInExpression(node, leftType, rightType) { - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 | 132 | 4194304)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 | 132 | 16777216)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { @@ -17336,7 +17639,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 242 || p.kind === 243) { + if (p.kind === 243 || p.kind === 244) { var name_13 = p.name; var type = isTypeAny(sourceType) ? sourceType @@ -17361,8 +17664,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 184) { - if (e.kind !== 182) { + if (e.kind !== 185) { + if (e.kind !== 183) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -17387,7 +17690,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 178 && restExpression.operatorToken.kind === 54) { + if (restExpression.kind === 179 && restExpression.operatorToken.kind === 55) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -17400,14 +17703,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 178 && target.operatorToken.kind === 54) { + if (target.kind === 179 && target.operatorToken.kind === 55) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 162) { + if (target.kind === 163) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 161) { + if (target.kind === 162) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -17421,32 +17724,32 @@ var ts; } function checkBinaryExpression(node, contextualMapper) { var operator = node.operatorToken.kind; - if (operator === 54 && (node.left.kind === 162 || node.left.kind === 161)) { + if (operator === 55 && (node.left.kind === 163 || node.left.kind === 162)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 36: - case 57: case 37: case 58: case 38: case 59: - case 35: - case 56: - case 41: + case 39: case 60: + case 36: + case 57: case 42: case 61: case 43: case 62: - case 45: - case 64: - case 46: - case 65: case 44: case 63: + case 46: + case 65: + case 47: + case 66: + case 45: + case 64: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -17465,8 +17768,8 @@ var ts; } } return numberType; - case 34: - case 55: + case 35: + case 56: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -17490,42 +17793,42 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 55) { + if (operator === 56) { checkAssignmentOperator(resultType); } return resultType; - case 24: - case 26: + case 25: case 27: case 28: + case 29: if (!checkForDisallowedESSymbolOperand(operator)) { return booleanType; } - case 29: case 30: case 31: case 32: + case 33: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 88: + case 89: return checkInstanceOfExpression(node, leftType, rightType); - case 87: + case 88: return checkInExpression(node, leftType, rightType); - case 49: - return rightType; case 50: + return rightType; + case 51: return getUnionType([leftType, rightType]); - case 54: + case 55: checkAssignmentOperator(rightType); - return rightType; - case 23: + return getRegularTypeOfObjectLiteral(rightType); + case 24: return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 4194304) ? node.left : - someConstituentTypeHasKind(rightType, 4194304) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? node.left : + someConstituentTypeHasKind(rightType, 16777216) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -17535,21 +17838,21 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { + case 46: + case 65: + return 51; + case 47: + case 66: + return 33; case 45: case 64: return 50; - case 46: - case 65: - return 32; - case 44: - case 63: - return 49; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 54 && operator <= 65) { + if (produceDiagnostics && operator >= 55 && operator <= 66) { var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); if (ok) { checkTypeAssignableTo(valueType, leftType, node.left, undefined); @@ -17633,21 +17936,21 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 133) { + if (node.name.kind === 134) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 133) { + if (node.name.kind === 134) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (contextualMapper && contextualMapper !== identityMapper) { + if (isInferentialContext(contextualMapper)) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getContextualType(node); @@ -17663,7 +17966,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 132) { + if (node.kind === 133) { type = checkQualifiedName(node); } else { @@ -17671,9 +17974,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 163 && node.parent.expression === node) || - (node.parent.kind === 164 && node.parent.expression === node) || - ((node.kind === 66 || node.kind === 132) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 164 && node.parent.expression === node) || + (node.parent.kind === 165 && node.parent.expression === node) || + ((node.kind === 67 || node.kind === 133) && isInRightSideOfImportOrExportAssignment(node)); 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); } @@ -17686,78 +17989,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 66: + case 67: return checkIdentifier(node); - case 94: + case 95: return checkThisExpression(node); - case 92: + case 93: return checkSuperExpression(node); - case 90: + case 91: return nullType; - case 96: - case 81: + case 97: + case 82: return booleanType; - case 7: + case 8: return checkNumericLiteral(node); - case 180: + case 181: return checkTemplateExpression(node); - case 8: - case 10: - return stringType; case 9: + case 11: + return stringType; + case 10: return globalRegExpType; - case 161: - return checkArrayLiteral(node, contextualMapper); case 162: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 163: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 164: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 165: + return checkIndexedAccess(node); case 166: - return checkCallExpression(node); case 167: + return checkCallExpression(node); + case 168: return checkTaggedTemplateExpression(node); - case 169: + case 170: return checkExpression(node.expression, contextualMapper); - case 183: + case 184: return checkClassExpression(node); - case 170: case 171: + case 172: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 173: + case 174: return checkTypeOfExpression(node); - case 168: - case 186: + case 169: + case 187: return checkAssertion(node); - case 172: + case 173: return checkDeleteExpression(node); - case 174: - return checkVoidExpression(node); case 175: - return checkAwaitExpression(node); + return checkVoidExpression(node); case 176: - return checkPrefixUnaryExpression(node); + return checkAwaitExpression(node); case 177: - return checkPostfixUnaryExpression(node); + return checkPrefixUnaryExpression(node); case 178: - return checkBinaryExpression(node, contextualMapper); + return checkPostfixUnaryExpression(node); case 179: + return checkBinaryExpression(node, contextualMapper); + case 180: return checkConditionalExpression(node, contextualMapper); - case 182: + case 183: return checkSpreadElementExpression(node, contextualMapper); - case 184: + case 185: return undefinedType; - case 181: + case 182: return checkYieldExpression(node); - case 237: + case 238: return checkJsxExpression(node); - case 230: - return checkJsxElement(node); case 231: - return checkJsxSelfClosingElement(node); + return checkJsxElement(node); case 232: + return checkJsxSelfClosingElement(node); + case 233: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -17782,7 +18085,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 141 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 142 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -17797,15 +18100,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 140 || - node.kind === 210 || - node.kind === 170; + return node.kind === 141 || + node.kind === 211 || + node.kind === 171; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 66 && + if (param.name.kind === 67 && param.name.text === parameter.text) { return i; } @@ -17815,30 +18118,30 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { + case 172: + case 145: + case 211: case 171: - case 144: - case 210: - case 170: - case 149: + case 150: + case 141: case 140: - case 139: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { - if (node.kind === 146) { + if (node.kind === 147) { checkGrammarIndexSignature(node); } - else if (node.kind === 149 || node.kind === 210 || node.kind === 150 || - node.kind === 144 || node.kind === 141 || - node.kind === 145) { + else if (node.kind === 150 || node.kind === 211 || node.kind === 151 || + node.kind === 145 || node.kind === 142 || + node.kind === 146) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 147) { + if (node.type.kind === 148) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -17847,7 +18150,7 @@ var ts; error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - checkTypeAssignableTo(typePredicate.type, getTypeAtLocation(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); } } else if (typePredicateNode.parameterName) { @@ -17857,19 +18160,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 158 || - param.name.kind === 159) { + if (param.name.kind === 159 || + param.name.kind === 160) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 66 && + if (element.name.kind === 67 && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 159 || - element.name.kind === 158) { + else if (element.name.kind === 160 || + element.name.kind === 159) { checkBindingPattern(element.name); } } @@ -17893,10 +18196,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 145: + case 146: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 144: + case 145: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -17918,7 +18221,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 212) { + if (node.kind === 213) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -17933,7 +18236,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 127: + case 128: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -17941,7 +18244,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 125: + case 126: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -17981,48 +18284,69 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 165 && n.expression.kind === 92; + return n.kind === 166 && n.expression.kind === 93; + } + function containsSuperCallAsComputedPropertyName(n) { + return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } - switch (n.kind) { - case 170: - case 210: - case 171: - case 162: return false; - default: return ts.forEachChild(n, containsSuperCall); + else if (ts.isFunctionLike(n)) { + return false; + } + else if (ts.isClassLike(n)) { + return ts.forEach(n.members, containsSuperCallAsComputedPropertyName); } + return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 94) { + if (n.kind === 95) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 170 && n.kind !== 210) { + else if (n.kind !== 171 && n.kind !== 211) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 138 && + return n.kind === 139 && !(n.flags & 128) && !!n.initializer; } - if (ts.getClassExtendsHeritageClauseElement(node.parent)) { + var containingClassDecl = node.parent; + if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { + var containingClassSymbol = getSymbolOfNode(containingClassDecl); + var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); if (containsSuperCall(node.body)) { + if (baseConstructorType === nullType) { + error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + } 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 !== 192 || !isSuperCallExpression(statements[0].expression)) { + var superCallStatement; + for (var _i = 0; _i < statements.length; _i++) { + var statement = statements[_i]; + if (statement.kind === 193 && isSuperCallExpression(statement.expression)) { + superCallStatement = statement; + break; + } + if (!ts.isPrologueDirective(statement)) { + break; + } + } + if (!superCallStatement) { 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); + markThisReferencesAsErrors(superCallStatement.expression); } } } - else { + else if (baseConstructorType !== nullType) { error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -18030,13 +18354,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 142) { + if (node.kind === 143) { 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 === 142 ? 143 : 142; + var otherKind = node.kind === 143 ? 144 : 143; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -18121,9 +18445,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 212) { - ts.Debug.assert(signatureDeclarationNode.kind === 144 || signatureDeclarationNode.kind === 145); - var signatureKind = signatureDeclarationNode.kind === 144 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213) { + ts.Debug.assert(signatureDeclarationNode.kind === 145 || signatureDeclarationNode.kind === 146); + var signatureKind = signatureDeclarationNode.kind === 145 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -18141,7 +18465,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 212 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 213 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -18217,7 +18541,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 140 || node.kind === 139); + ts.Debug.assert(node.kind === 141 || node.kind === 140); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -18249,11 +18573,11 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 212 || node.parent.kind === 152 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 213 || node.parent.kind === 153 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 210 || node.kind === 140 || node.kind === 139 || node.kind === 141) { + if (node.kind === 211 || node.kind === 141 || node.kind === 140 || node.kind === 142) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -18332,35 +18656,50 @@ var ts; } var exportedDeclarationSpaces = 0; var nonExportedDeclarationSpaces = 0; - ts.forEach(symbol.declarations, function (d) { + var defaultExportedDeclarationSpaces = 0; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - if (getEffectiveDeclarationFlags(d, 1)) { - exportedDeclarationSpaces |= declarationSpaces; + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 1024); + if (effectiveDeclarationFlags & 1) { + if (effectiveDeclarationFlags & 1024) { + defaultExportedDeclarationSpaces |= declarationSpaces; + } + else { + exportedDeclarationSpaces |= declarationSpaces; + } } else { nonExportedDeclarationSpaces |= declarationSpaces; } - }); - var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; - if (commonDeclarationSpace) { - ts.forEach(symbol.declarations, function (d) { - if (getDeclarationSpaces(d) & commonDeclarationSpace) { + } + var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; + var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; + if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var d = _c[_b]; + var declarationSpaces = getDeclarationSpaces(d); + if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { + error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name)); + } + else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) { 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 212: + case 213: return 2097152; - case 215: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 + case 216: + return d.name.kind === 9 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 211: - case 214: + case 212: + case 215: return 2097152 | 1048576; - case 218: + case 219: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -18495,22 +18834,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 211: + case 212: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 135: + case 136: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 138: + case 139: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 140: - case 142: + case 141: case 143: + case 144: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -18519,7 +18858,7 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 148) { + if (node && node.kind === 149) { var root = getFirstIdentifier(node.typeName); var rootSymbol = resolveName(root, root.text, 107455, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { @@ -18529,19 +18868,19 @@ var ts; } function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 138: + case 139: checkTypeNodeAsExpression(node.type); break; - case 135: + case 136: checkTypeNodeAsExpression(node.type); break; - case 140: + case 141: checkTypeNodeAsExpression(node.type); break; - case 142: + case 143: checkTypeNodeAsExpression(node.type); break; - case 143: + case 144: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -18564,24 +18903,24 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 211: + case 212: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 140: + case 141: checkParameterTypeAnnotationsAsExpressions(node); + case 144: case 143: - case 142: - case 138: - case 135: + case 139: + case 136: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 135) { + if (node.kind === 136) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -18604,7 +18943,7 @@ var ts; } emitAwaiter = true; } - if (node.name && node.name.kind === 133) { + if (node.name && node.name.kind === 134) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -18639,11 +18978,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 189) { + if (node.kind === 190) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 216) { + if (ts.isFunctionBlock(node) || node.kind === 217) { checkFunctionAndClassExpressionBodies(node); } } @@ -18661,19 +19000,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 138 || - node.kind === 137 || + if (node.kind === 139 || + node.kind === 138 || + node.kind === 141 || node.kind === 140 || - node.kind === 139 || - node.kind === 142 || - node.kind === 143) { + node.kind === 143 || + node.kind === 144) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 135 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 136 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -18687,7 +19026,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration_1 = node.kind !== 66; + var isDeclaration_1 = node.kind !== 67; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -18708,7 +19047,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 66; + var isDeclaration_2 = node.kind !== 67; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -18721,11 +19060,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 215 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 216 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 245 && ts.isExternalModule(parent)) { + if (parent.kind === 246 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -18736,7 +19075,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 208 && !node.initializer) { + if (node.kind === 209 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -18746,15 +19085,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 209); - var container = varDeclList.parent.kind === 190 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210); + var container = varDeclList.parent.kind === 191 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 189 && ts.isFunctionLike(container.parent) || + (container.kind === 190 && ts.isFunctionLike(container.parent) || + container.kind === 217 || container.kind === 216 || - container.kind === 215 || - container.kind === 245); + container.kind === 246); if (!namesShareScope) { var name_14 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_14, name_14); @@ -18764,16 +19103,16 @@ var ts; } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 135) { + if (ts.getRootDeclaration(node).kind !== 136) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 66) { + if (n.kind === 67) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 135) { + if (referencedSymbol.valueDeclaration.kind === 136) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -18793,7 +19132,7 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 133) { + if (node.name.kind === 134) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -18802,7 +19141,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 135 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 136 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -18830,9 +19169,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 138 && node.kind !== 137) { + if (node.kind !== 139 && node.kind !== 138) { checkExportsOnMergedDeclarations(node); - if (node.kind === 208 || node.kind === 160) { + if (node.kind === 209 || node.kind === 161) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -18853,7 +19192,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 162) { + if (node.modifiers && node.parent.kind === 163) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -18886,12 +19225,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 209) { + if (node.initializer && node.initializer.kind === 210) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 209) { + if (node.initializer.kind === 210) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -18906,13 +19245,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 209) { + if (node.initializer.kind === 210) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 161 || varExpr.kind === 162) { + if (varExpr.kind === 162 || varExpr.kind === 163) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -18927,7 +19266,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 209) { + if (node.initializer.kind === 210) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -18937,7 +19276,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 161 || varExpr.kind === 162) { + if (varExpr.kind === 162 || varExpr.kind === 163) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { @@ -19099,7 +19438,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 142 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 143))); + return !!(node.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144))); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -19117,10 +19456,10 @@ var ts; if (func.asteriskToken) { return; } - if (func.kind === 143) { + if (func.kind === 144) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 141) { + else if (func.kind === 142) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -19153,7 +19492,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 239 && !hasDuplicateDefaultClause) { + if (clause.kind === 240 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -19165,7 +19504,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 238) { + if (produceDiagnostics && clause.kind === 239) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -19182,7 +19521,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 204 && current.label.text === node.label.text) { + if (current.kind === 205 && 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; @@ -19208,7 +19547,7 @@ var ts; var catchClause = node.catchClause; if (catchClause) { if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 66) { + if (catchClause.variableDeclaration.name.kind !== 67) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -19276,7 +19615,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 133 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 134 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -19429,7 +19768,7 @@ var ts; ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { if (derived === base) { - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 211); + var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212); if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); } @@ -19470,7 +19809,7 @@ var ts; } } function isAccessor(kind) { - return kind === 142 || kind === 143; + return kind === 143 || kind === 144; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -19536,7 +19875,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 212); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213); 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); @@ -19554,7 +19893,7 @@ var ts; if (symbol && symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 211 && !ts.isInAmbientContext(declaration)) { + if (declaration.kind === 212 && !ts.isInAmbientContext(declaration)) { error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); break; } @@ -19586,28 +19925,12 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 133 && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 134 && 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); - 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); - } - } + autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); } else if (ambient && !enumIsConst) { autoValue = undefined; @@ -19618,22 +19941,42 @@ var ts; }); nodeLinks.flags |= 8192; } - function getConstantValueForEnumMemberInitializer(initializer) { - return evalConstant(initializer); + function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { + var reportError = true; + var value = evalConstant(initializer); + if (reportError) { + if (value === 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(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } + } + return value; function evalConstant(e) { switch (e.kind) { - case 176: - var value = evalConstant(e.operand); - if (value === undefined) { + case 177: + var value_1 = evalConstant(e.operand); + if (value_1 === undefined) { return undefined; } switch (e.operator) { - case 34: return value; - case 35: return -value; - case 48: return ~value; + case 35: return value_1; + case 36: return -value_1; + case 49: return ~value_1; } return undefined; - case 178: + case 179: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -19643,39 +19986,39 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 45: return left | right; - case 44: return left & right; - case 42: return left >> right; - case 43: return left >>> right; - case 41: return left << right; - case 46: return left ^ right; - case 36: return left * right; - case 37: return left / right; - case 34: return left + right; - case 35: return left - right; - case 38: return left % right; + case 46: return left | right; + case 45: return left & right; + case 43: return left >> right; + case 44: return left >>> right; + case 42: return left << right; + case 47: return left ^ right; + case 37: return left * right; + case 38: return left / right; + case 35: return left + right; + case 36: return left - right; + case 39: return left % right; } return undefined; - case 7: + case 8: return +e.text; - case 169: + case 170: return evalConstant(e.expression); - case 66: + case 67: + case 165: case 164: - case 163: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType; + var enumType_1; var propertyName; - if (e.kind === 66) { - enumType = currentType; + if (e.kind === 67) { + enumType_1 = currentType; propertyName = e.text; } else { var expression; - if (e.kind === 164) { + if (e.kind === 165) { if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8) { + e.argumentExpression.kind !== 9) { return undefined; } expression = e.expression; @@ -19687,25 +20030,25 @@ var ts; } var current = expression; while (current) { - if (current.kind === 66) { + if (current.kind === 67) { break; } - else if (current.kind === 163) { + else if (current.kind === 164) { current = current.expression; } else { return undefined; } } - enumType = checkExpression(expression); - if (!(enumType.symbol && (enumType.symbol.flags & 384))) { + enumType_1 = checkExpression(expression); + if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + var property = getPropertyOfObjectType(enumType_1, propertyName); if (!property || !(property.flags & 8)) { return undefined; } @@ -19714,6 +20057,8 @@ var ts; return undefined; } if (!isDefinedBefore(propertyDecl, member)) { + reportError = false; + error(e, ts.Diagnostics.A_member_initializer_in_a_const_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_const_enums); return undefined; } return getNodeLinks(propertyDecl).enumMemberValue; @@ -19747,7 +20092,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 214) { + if (declaration.kind !== 215) { return false; } var enumDeclaration = declaration; @@ -19770,8 +20115,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 211 || - (declaration.kind === 210 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 212 || + (declaration.kind === 211 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -19793,7 +20138,7 @@ var ts; } function checkModuleDeclaration(node) { if (produceDiagnostics) { - var isAmbientExternalModule = node.name.kind === 8; + var isAmbientExternalModule = node.name.kind === 9; var contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -19801,7 +20146,7 @@ var ts; return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 8) { + if (!ts.isInAmbientContext(node) && node.name.kind === 9) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } @@ -19822,7 +20167,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 211); + var mergedClass = ts.getDeclarationOfKind(symbol, 212); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -19841,28 +20186,28 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 132) { + if (node.kind === 133) { node = node.left; } - else if (node.kind === 163) { + else if (node.kind === 164) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 66); + ts.Debug.assert(node.kind === 67); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 9) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 216 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 245 && !inAmbientExternalModule) { - error(moduleName, node.kind === 225 ? + var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 246 && !inAmbientExternalModule) { + error(moduleName, node.kind === 226 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -19881,7 +20226,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 227 ? + var message = node.kind === 228 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -19907,7 +20252,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221) { + if (importClause.namedBindings.kind === 222) { checkImportBinding(importClause.namedBindings); } else { @@ -19942,7 +20287,7 @@ var ts; } } else { - if (languageVersion >= 2) { + if (languageVersion >= 2 && !ts.isInAmbientContext(node)) { grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); } } @@ -19958,8 +20303,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 216 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 245 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 246 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -19972,7 +20317,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 245 && node.parent.kind !== 216 && node.parent.kind !== 215) { + if (node.parent.kind !== 246 && node.parent.kind !== 217 && node.parent.kind !== 216) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -19986,15 +20331,15 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 245 ? node.parent : node.parent.parent; - if (container.kind === 215 && container.name.kind === 66) { + var container = node.parent.kind === 246 ? node.parent : node.parent.parent; + if (container.kind === 216 && container.name.kind === 67) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 66) { + if (node.expression.kind === 67) { markExportAsReferenced(node); } else { @@ -20011,10 +20356,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 245) { + if (node.kind === 246) { return node.statements; } - if (node.kind === 215 && node.body.kind === 216) { + if (node.kind === 216 && node.body.kind === 217) { return node.body.statements; } return emptyArray; @@ -20051,182 +20396,181 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 215: - case 211: + case 216: case 212: - case 210: + case 213: + case 211: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 134: - return checkTypeParameter(node); case 135: + return checkTypeParameter(node); + case 136: return checkParameter(node); + case 139: case 138: - case 137: return checkPropertyDeclaration(node); - case 149: case 150: - case 144: + case 151: case 145: - return checkSignatureDeclaration(node); case 146: return checkSignatureDeclaration(node); + case 147: + return checkSignatureDeclaration(node); + case 141: case 140: - case 139: return checkMethodDeclaration(node); - case 141: - return checkConstructorDeclaration(node); case 142: + return checkConstructorDeclaration(node); case 143: + case 144: return checkAccessorDeclaration(node); - case 148: + case 149: return checkTypeReferenceNode(node); - case 147: + case 148: return checkTypePredicate(node); - case 151: - return checkTypeQuery(node); case 152: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 153: - return checkArrayType(node); + return checkTypeLiteral(node); case 154: - return checkTupleType(node); + return checkArrayType(node); case 155: + return checkTupleType(node); case 156: - return checkUnionOrIntersectionType(node); case 157: + return checkUnionOrIntersectionType(node); + case 158: return checkSourceElement(node.type); - case 210: + case 211: return checkFunctionDeclaration(node); - case 189: - case 216: - return checkBlock(node); case 190: + case 217: + return checkBlock(node); + case 191: return checkVariableStatement(node); - case 192: - return checkExpressionStatement(node); case 193: - return checkIfStatement(node); + return checkExpressionStatement(node); case 194: - return checkDoStatement(node); + return checkIfStatement(node); case 195: - return checkWhileStatement(node); + return checkDoStatement(node); case 196: - return checkForStatement(node); + return checkWhileStatement(node); case 197: - return checkForInStatement(node); + return checkForStatement(node); case 198: - return checkForOfStatement(node); + return checkForInStatement(node); case 199: + return checkForOfStatement(node); case 200: - return checkBreakOrContinueStatement(node); case 201: - return checkReturnStatement(node); + return checkBreakOrContinueStatement(node); case 202: - return checkWithStatement(node); + return checkReturnStatement(node); case 203: - return checkSwitchStatement(node); + return checkWithStatement(node); case 204: - return checkLabeledStatement(node); + return checkSwitchStatement(node); case 205: - return checkThrowStatement(node); + return checkLabeledStatement(node); case 206: + return checkThrowStatement(node); + case 207: return checkTryStatement(node); - case 208: + case 209: return checkVariableDeclaration(node); - case 160: + case 161: return checkBindingElement(node); - case 211: - return checkClassDeclaration(node); case 212: - return checkInterfaceDeclaration(node); + return checkClassDeclaration(node); case 213: - return checkTypeAliasDeclaration(node); + return checkInterfaceDeclaration(node); case 214: - return checkEnumDeclaration(node); + return checkTypeAliasDeclaration(node); case 215: + return checkEnumDeclaration(node); + case 216: return checkModuleDeclaration(node); - case 219: + case 220: return checkImportDeclaration(node); - case 218: + case 219: return checkImportEqualsDeclaration(node); - case 225: + case 226: return checkExportDeclaration(node); - case 224: + case 225: return checkExportAssignment(node); - case 191: + case 192: checkGrammarStatementInAmbientContext(node); return; - case 207: + case 208: checkGrammarStatementInAmbientContext(node); return; - case 228: + case 229: return checkMissingDeclaration(node); } } function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 170: case 171: + case 172: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 183: + case 184: ts.forEach(node.members, checkSourceElement); break; + case 141: case 140: - case 139: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 141: case 142: case 143: - case 210: + case 144: + case 211: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 202: + case 203: checkFunctionAndClassExpressionBodies(node.expression); break; + case 137: case 136: - case 135: + case 139: case 138: - case 137: - case 158: case 159: case 160: case 161: case 162: - case 242: case 163: + case 243: case 164: case 165: case 166: case 167: - case 180: - case 187: case 168: - case 186: + case 181: + case 188: case 169: - case 173: + case 187: + case 170: case 174: case 175: - case 172: case 176: + case 173: case 177: case 178: case 179: + case 180: + case 183: case 182: - case 181: - case 189: - case 216: case 190: - case 192: + case 217: + case 191: case 193: case 194: case 195: @@ -20236,27 +20580,28 @@ var ts; case 199: case 200: case 201: - case 203: - case 217: - case 238: - case 239: + case 202: case 204: + case 218: + case 239: + case 240: case 205: case 206: - case 241: - case 208: + case 207: + case 242: case 209: - case 211: - case 214: - case 244: - case 224: + case 210: + case 212: + case 215: case 245: - case 237: - case 230: + case 225: + case 246: + case 238: case 231: - case 235: - case 236: case 232: + case 236: + case 237: + case 233: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -20334,7 +20679,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 202 && node.parent.statement === node) { + if (node.parent.kind === 203 && node.parent.statement === node) { return true; } node = node.parent; @@ -20356,34 +20701,37 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 245: + case 246: if (!ts.isExternalModule(location)) { break; } - case 215: + case 216: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 214: + case 215: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 183: + case 184: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 211: case 212: + case 213: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 170: + case 171: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); } break; } + if (ts.introducesArgumentsExoticObject(location)) { + copySymbol(argumentsSymbol, meaning); + } memberFlags = location.flags; location = location.parent; } @@ -20407,42 +20755,42 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 66 && + return name.kind === 67 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 134: - case 211: + case 135: case 212: case 213: case 214: + case 215: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 132) { + while (node.parent && node.parent.kind === 133) { node = node.parent; } - return node.parent && node.parent.kind === 148; + return node.parent && node.parent.kind === 149; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 163) { + while (node.parent && node.parent.kind === 164) { node = node.parent; } - return node.parent && node.parent.kind === 185; + return node.parent && node.parent.kind === 186; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 132) { + while (nodeOnRightSide.parent.kind === 133) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 218) { + if (nodeOnRightSide.parent.kind === 219) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 224) { + if (nodeOnRightSide.parent.kind === 225) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -20454,10 +20802,10 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 224) { + if (entityName.parent.kind === 225) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 163) { + if (entityName.kind !== 164) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -20466,29 +20814,31 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 185 ? 793056 : 1536; + var meaning = entityName.parent.kind === 186 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 232) || (entityName.parent.kind === 231)) { + else if ((entityName.parent.kind === 233) || + (entityName.parent.kind === 232) || + (entityName.parent.kind === 235)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } - if (entityName.kind === 66) { + if (entityName.kind === 67) { var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 163) { + else if (entityName.kind === 164) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 132) { + else if (entityName.kind === 133) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -20497,54 +20847,65 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 148 ? 793056 : 1536; + var meaning = entityName.parent.kind === 149 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 235) { + else if (entityName.parent.kind === 236) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 147) { + if (entityName.parent.kind === 148) { return resolveEntityName(entityName, 1); } return undefined; } - function getSymbolInfo(node) { + function getSymbolAtLocation(node) { if (isInsideWithStatementBody(node)) { return undefined; } if (ts.isDeclarationName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 66 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 224 - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + if (node.kind === 67) { + if (isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 225 + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); + } + else if (node.parent.kind === 161 && + node.parent.parent.kind === 159 && + node === node.parent.propertyName) { + var typeOfPattern = getTypeOfNode(node.parent.parent); + var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); + if (propertyDeclaration) { + return propertyDeclaration; + } + } } switch (node.kind) { - case 66: - case 163: - case 132: + case 67: + case 164: + case 133: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 94: - case 92: + case 95: + case 93: var type = checkExpression(node); return type.symbol; - case 118: + case 119: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 141) { + if (constructorDeclaration && constructorDeclaration.kind === 142) { return constructorDeclaration.parent.symbol; } return undefined; - case 8: + case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 219 || node.parent.kind === 225) && + ((node.parent.kind === 220 || node.parent.kind === 226) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } - case 7: - if (node.parent.kind === 164 && node.parent.argumentExpression === node) { + case 8: + if (node.parent.kind === 165 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -20558,7 +20919,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 243) { + if (location && location.kind === 244) { return resolveEntityName(location.name, 107455); } return undefined; @@ -20581,7 +20942,7 @@ var ts; return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); } if (ts.isDeclaration(node)) { @@ -20589,14 +20950,14 @@ var ts; return getTypeOfSymbol(symbol); } if (ts.isDeclarationName(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); return symbol && getTypeOfSymbol(symbol); } if (ts.isBindingPattern(node)) { return getTypeForVariableLikeDeclaration(node.parent); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } @@ -20655,11 +21016,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 245) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 246) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 215 || n.kind === 214) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 216 || n.kind === 215) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -20672,11 +21033,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 189: - case 217: - case 196: + case 190: + case 218: case 197: case 198: + case 199: return true; } return false; @@ -20702,22 +21063,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 218: - case 220: + case 219: case 221: - case 223: - case 227: + case 222: + case 224: + case 228: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 225: + case 226: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 224: - return node.expression && node.expression.kind === 66 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 225: + return node.expression && node.expression.kind === 67 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 245 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 246 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -20728,7 +21089,10 @@ var ts; if (target === unknownSymbol && compilerOptions.isolatedModules) { return true; } - return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + return target !== unknownSymbol && + target && + target.flags & 107455 && + (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -20762,7 +21126,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 244) { + if (node.kind === 245) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -20776,13 +21140,14 @@ var ts; function isFunctionType(type) { return type.flags & 80896 && getSignaturesOfType(type, 0).length > 0; } - function getTypeReferenceSerializationKind(node) { - var symbol = resolveEntityName(node.typeName, 107455, true); - var constructorType = symbol ? getTypeOfSymbol(symbol) : undefined; + function getTypeReferenceSerializationKind(typeName) { + var valueSymbol = resolveEntityName(typeName, 107455, true); + var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; if (constructorType && isConstructorType(constructorType)) { return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; } - var type = getTypeFromTypeNode(node); + var typeSymbol = resolveEntityName(typeName, 793056, true); + var type = getDeclaredTypeOfSymbol(typeSymbol); if (type === unknownType) { return ts.TypeReferenceSerializationKind.Unknown; } @@ -20804,7 +21169,7 @@ var ts; else if (allConstituentTypesHaveKind(type, 8192)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, 4194304)) { + else if (allConstituentTypesHaveKind(type, 16777216)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -20846,13 +21211,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 160 || (n.parent.kind === 208 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 161 || (n.parent.kind === 209 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 241; + symbol.valueDeclaration.parent.kind !== 242; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -20892,7 +21257,8 @@ var ts; collectLinkedAliases: collectLinkedAliases, getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, - getTypeReferenceSerializationKind: getTypeReferenceSerializationKind + getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, + isOptionalParameter: isOptionalParameter }; } function initializeTypeChecker() { @@ -20973,7 +21339,7 @@ var ts; else if (languageVersion < 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } - else if (node.kind === 142 || node.kind === 143) { + else if (node.kind === 143 || node.kind === 144) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -20983,38 +21349,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 142: case 143: - case 141: + case 144: + case 142: + case 139: case 138: - case 137: + case 141: case 140: - case 139: - case 146: - case 215: + case 147: + case 216: + case 220: case 219: - case 218: + case 226: case 225: - case 224: - case 135: + case 136: break; - case 210: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 115) && - node.parent.kind !== 216 && node.parent.kind !== 245) { + case 211: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116) && + node.parent.kind !== 217 && node.parent.kind !== 246) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 211: case 212: - case 190: case 213: - if (node.modifiers && node.parent.kind !== 216 && node.parent.kind !== 245) { + case 191: + case 214: + if (node.modifiers && node.parent.kind !== 217 && node.parent.kind !== 246) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 214: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 71) && - node.parent.kind !== 216 && node.parent.kind !== 245) { + case 215: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72) && + node.parent.kind !== 217 && node.parent.kind !== 246) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -21029,14 +21395,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { + case 110: case 109: case 108: - case 107: var text = void 0; - if (modifier.kind === 109) { + if (modifier.kind === 110) { text = "public"; } - else if (modifier.kind === 108) { + else if (modifier.kind === 109) { text = "protected"; lastProtected = modifier; } @@ -21053,11 +21419,11 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 216 || node.parent.kind === 245) { + else if (node.parent.kind === 217 || node.parent.kind === 246) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256) { - if (modifier.kind === 107) { + if (modifier.kind === 108) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -21066,17 +21432,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 110: + case 111: if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 216 || node.parent.kind === 245) { + else if (node.parent.kind === 217 || node.parent.kind === 246) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 135) { + else if (node.kind === 136) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256) { @@ -21085,7 +21451,7 @@ var ts; flags |= 128; lastStatic = modifier; break; - case 79: + case 80: if (flags & 1) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -21098,42 +21464,42 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 211) { + else if (node.parent.kind === 212) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 135) { + else if (node.kind === 136) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; break; - case 119: + case 120: if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 211) { + else if (node.parent.kind === 212) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 135) { + else if (node.kind === 136) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 216) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; lastDeclare = modifier; break; - case 112: + case 113: if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 211) { - if (node.kind !== 140) { + if (node.kind !== 212) { + if (node.kind !== 141) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 211 && node.parent.flags & 256)) { + if (!(node.parent.kind === 212 && node.parent.flags & 256)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128) { @@ -21145,14 +21511,14 @@ var ts; } flags |= 256; break; - case 115: + case 116: if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 135) { + else if (node.kind === 136) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512; @@ -21160,7 +21526,7 @@ var ts; break; } } - if (node.kind === 141) { + if (node.kind === 142) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -21178,10 +21544,10 @@ var ts; } return; } - else if ((node.kind === 219 || node.kind === 218) && flags & 2) { + else if ((node.kind === 220 || node.kind === 219) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 135 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 136 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512) { @@ -21193,10 +21559,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 140: - case 210: - case 170: + case 141: + case 211: case 171: + case 172: if (!node.asteriskToken) { return false; } @@ -21244,16 +21610,14 @@ var ts; return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); } } - else if (parameter.questionToken || parameter.initializer) { + else if (parameter.questionToken) { seenOptionalParameter = true; - if (parameter.questionToken && parameter.initializer) { + if (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); - } + else if (seenOptionalParameter && !parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); } } } @@ -21263,7 +21627,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 171) { + if (node.kind === 172) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -21298,7 +21662,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 127 && parameter.type.kind !== 125) { + if (parameter.type.kind !== 128 && parameter.type.kind !== 126) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -21330,7 +21694,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 184) { + if (arg.kind === 185) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -21357,7 +21721,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 80) { + if (heritageClause.token === 81) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -21370,7 +21734,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 103); + ts.Debug.assert(heritageClause.token === 104); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -21385,14 +21749,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 80) { + if (heritageClause.token === 81) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 103); + ts.Debug.assert(heritageClause.token === 104); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } checkGrammarHeritageClause(heritageClause); @@ -21401,19 +21765,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 133) { + if (node.kind !== 134) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 178 && computedPropertyName.expression.operatorToken.kind === 23) { + if (computedPropertyName.expression.kind === 179 && computedPropertyName.expression.operatorToken.kind === 24) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 210 || - node.kind === 170 || - node.kind === 140); + ts.Debug.assert(node.kind === 211 || + node.kind === 171 || + node.kind === 141); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -21439,26 +21803,26 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_16 = prop.name; - if (prop.kind === 184 || - name_16.kind === 133) { + if (prop.kind === 185 || + name_16.kind === 134) { checkGrammarComputedPropertyName(name_16); continue; } var currentKind = void 0; - if (prop.kind === 242 || prop.kind === 243) { + if (prop.kind === 243 || prop.kind === 244) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_16.kind === 7) { + if (name_16.kind === 8) { checkGrammarNumericLiteral(name_16); } currentKind = Property; } - else if (prop.kind === 140) { + else if (prop.kind === 141) { currentKind = Property; } - else if (prop.kind === 142) { + else if (prop.kind === 143) { currentKind = GetAccessor; } - else if (prop.kind === 143) { + else if (prop.kind === 144) { currentKind = SetAccesor; } else { @@ -21490,7 +21854,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 236) { + if (attr.kind === 237) { continue; } var jsxAttr = attr; @@ -21502,7 +21866,7 @@ var ts; return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 237 && !initializer.expression) { + if (initializer && initializer.kind === 238 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -21511,24 +21875,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 209) { + if (forInOrOfStatement.initializer.kind === 210) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 197 + var diagnostic = forInOrOfStatement.kind === 198 ? 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 === 197 + var diagnostic = forInOrOfStatement.kind === 198 ? 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 === 197 + var diagnostic = forInOrOfStatement.kind === 198 ? 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); @@ -21551,10 +21915,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 142 && accessor.parameters.length) { + else if (kind === 143 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 143) { + else if (kind === 144) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -21579,7 +21943,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 133 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 134 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -21589,7 +21953,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 162) { + if (node.parent.kind === 163) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -21608,22 +21972,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 213) { 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 === 152) { + else if (node.parent.kind === 153) { 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 196: case 197: case 198: - case 194: + case 199: case 195: + case 196: return true; - case 204: + case 205: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -21635,9 +21999,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 204: + case 205: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 199 + var isMisplacedContinueLabel = node.kind === 200 && !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); @@ -21645,8 +22009,8 @@ var ts; return false; } break; - case 203: - if (node.kind === 200 && !node.label) { + case 204: + if (node.kind === 201 && !node.label) { return false; } break; @@ -21659,13 +22023,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 200 + var message = node.kind === 201 ? 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 === 200 + var message = node.kind === 201 ? 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); @@ -21677,7 +22041,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 159 || node.name.kind === 158) { + if (node.name.kind === 160 || node.name.kind === 159) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -21686,7 +22050,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 197 && node.parent.parent.kind !== 198) { + if (node.parent.parent.kind !== 198 && node.parent.parent.kind !== 199) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -21706,7 +22070,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 66) { + if (name.kind === 67) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -21715,7 +22079,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 184) { + if (element.kind !== 185) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -21732,15 +22096,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 193: case 194: case 195: - case 202: case 196: + case 203: case 197: case 198: + case 199: return false; - case 204: + case 205: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -21756,13 +22120,13 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 176) { + if (expression.kind === 177) { var unaryExpression = expression; - if (unaryExpression.operator === 34 || unaryExpression.operator === 35) { + if (unaryExpression.operator === 35 || unaryExpression.operator === 36) { expression = unaryExpression.operand; } } - if (expression.kind === 7) { + if (expression.kind === 8) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); } return false; @@ -21775,7 +22139,7 @@ var ts; var inAmbientContext = ts.isInAmbientContext(enumDecl); for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; - if (node.name.kind === 133) { + if (node.name.kind === 134) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -21818,7 +22182,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 66 && + return node.kind === 67 && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -21838,12 +22202,12 @@ var ts; return true; } } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 213) { 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 === 152) { + else if (node.parent.kind === 153) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -21853,11 +22217,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 212 || + if (node.kind === 213 || + node.kind === 220 || node.kind === 219 || - node.kind === 218 || + node.kind === 226 || node.kind === 225 || - node.kind === 224 || (node.flags & 2) || (node.flags & (1 | 1024))) { return false; @@ -21867,7 +22231,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 190) { + if (ts.isDeclaration(decl) || decl.kind === 191) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -21886,7 +22250,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 189 || node.parent.kind === 216 || node.parent.kind === 245) { + if (node.parent.kind === 190 || node.parent.kind === 217 || node.parent.kind === 246) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -21959,7 +22323,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 219); + ts.Debug.assert(aliasEmitInfo.node.kind === 220); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -22032,10 +22396,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 208) { + if (declaration.kind === 209) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 222 || declaration.kind === 223 || declaration.kind === 220) { + else if (declaration.kind === 223 || declaration.kind === 224 || declaration.kind === 221) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -22046,7 +22410,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 219) { + if (moduleElementEmitInfo.node.kind === 220) { moduleElementEmitInfo.isVisible = true; } else { @@ -22054,12 +22418,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 215) { + if (nodeToCheck.kind === 216) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 215) { + if (nodeToCheck.kind === 216) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -22146,62 +22510,62 @@ var ts; } function emitType(type) { switch (type.kind) { - case 114: - case 127: - case 125: - case 117: + case 115: case 128: - case 100: - case 8: + case 126: + case 118: + case 129: + case 101: + case 9: return writeTextOfNode(currentSourceFile, type); - case 185: + case 186: return emitExpressionWithTypeArguments(type); - case 148: + case 149: return emitTypeReference(type); - case 151: + case 152: return emitTypeQuery(type); - case 153: - return emitArrayType(type); case 154: - return emitTupleType(type); + return emitArrayType(type); case 155: - return emitUnionType(type); + return emitTupleType(type); case 156: - return emitIntersectionType(type); + return emitUnionType(type); case 157: + return emitIntersectionType(type); + case 158: return emitParenType(type); - case 149: case 150: + case 151: return emitSignatureDeclarationWithJsDocComments(type); - case 152: + case 153: return emitTypeLiteral(type); - case 66: + case 67: return emitEntityName(type); - case 132: + case 133: return emitEntityName(type); - case 147: + case 148: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 66) { + if (entityName.kind === 67) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 132 ? entityName.left : entityName.expression; - var right = entityName.kind === 132 ? entityName.right : entityName.name; + var left = entityName.kind === 133 ? entityName.left : entityName.expression; + var right = entityName.kind === 133 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 218 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 219 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 66 || node.expression.kind === 163); + ts.Debug.assert(node.expression.kind === 67 || node.expression.kind === 164); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -22277,7 +22641,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 66) { + if (node.expression.kind === 67) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -22295,7 +22659,7 @@ var ts; } write(";"); writeLine(); - if (node.expression.kind === 66) { + if (node.expression.kind === 67) { var nodes = resolver.collectLinkedAliases(node.expression); writeAsynchronousModuleElements(nodes); } @@ -22313,10 +22677,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 218 || - (node.parent.kind === 245 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 219 || + (node.parent.kind === 246 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 245) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -22325,7 +22689,7 @@ var ts; }); } else { - if (node.kind === 219) { + if (node.kind === 220) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -22343,23 +22707,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 210: + case 211: return writeFunctionDeclaration(node); - case 190: + case 191: return writeVariableStatement(node); - case 212: + case 213: return writeInterfaceDeclaration(node); - case 211: + case 212: return writeClassDeclaration(node); - case 213: - return writeTypeAliasDeclaration(node); case 214: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 215: + return writeEnumDeclaration(node); + case 216: return writeModuleDeclaration(node); - case 218: - return writeImportEqualsDeclaration(node); case 219: + return writeImportEqualsDeclaration(node); + case 220: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -22373,7 +22737,7 @@ var ts; if (node.flags & 1024) { write("default "); } - else if (node.kind !== 212) { + else if (node.kind !== 213) { write("declare "); } } @@ -22420,7 +22784,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 221) { + if (namedBindings.kind === 222) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -22446,7 +22810,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 221) { + if (node.importClause.namedBindings.kind === 222) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -22502,7 +22866,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 216) { + while (node.body.kind !== 217) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -22519,14 +22883,18 @@ var ts; enclosingDeclaration = prevEnclosingDeclaration; } function writeTypeAliasDeclaration(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); writeTextOfNode(currentSourceFile, node.name); + emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); write(";"); writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, @@ -22563,7 +22931,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 140 && (node.parent.flags & 32); + return node.parent.kind === 141 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -22573,15 +22941,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 149 || - node.parent.kind === 150 || - (node.parent.parent && node.parent.parent.kind === 152)) { - ts.Debug.assert(node.parent.kind === 140 || - node.parent.kind === 139 || - node.parent.kind === 149 || + if (node.parent.kind === 150 || + node.parent.kind === 151 || + (node.parent.parent && node.parent.parent.kind === 153)) { + ts.Debug.assert(node.parent.kind === 141 || + node.parent.kind === 140 || node.parent.kind === 150 || - node.parent.kind === 144 || - node.parent.kind === 145); + node.parent.kind === 151 || + node.parent.kind === 145 || + node.parent.kind === 146); emitType(node.constraint); } else { @@ -22591,31 +22959,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 211: + case 212: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 212: + case 213: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 145: + case 146: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 144: + case 145: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 141: case 140: - case 139: 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 === 211) { + else if (node.parent.parent.kind === 212) { 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 210: + case 211: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -22645,7 +23013,7 @@ var ts; } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 211) { + if (node.parent.parent.kind === 212) { 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; @@ -22725,16 +23093,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 208 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 209 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 138 || node.kind === 137) && ts.hasQuestionToken(node)) { + if ((node.kind === 139 || node.kind === 138) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 138 || node.kind === 137) && node.parent.kind === 152) { + if ((node.kind === 139 || node.kind === 138) && node.parent.kind === 153) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -22743,14 +23111,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 208) { + if (node.kind === 209) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 138 || node.kind === 137) { + else if (node.kind === 139 || node.kind === 138) { if (node.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -22758,7 +23126,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 211) { + else if (node.parent.kind === 212) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -22784,7 +23152,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 184) { + if (element.kind !== 185) { elements.push(element); } } @@ -22850,7 +23218,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 142 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 143 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -22863,7 +23231,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 142 + return accessor.kind === 143 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -22872,7 +23240,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 143) { + if (accessorWithTypeAnnotation.kind === 144) { 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 : @@ -22918,17 +23286,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 210) { + if (node.kind === 211) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 140) { + else if (node.kind === 141) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 210) { + if (node.kind === 211) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 141) { + else if (node.kind === 142) { write("constructor"); } else { @@ -22945,11 +23313,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 145 || node.kind === 150) { + if (node.kind === 146 || node.kind === 151) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 146) { + if (node.kind === 147) { write("["); } else { @@ -22958,20 +23326,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 146) { + if (node.kind === 147) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 149 || node.kind === 150; - if (isFunctionTypeOrConstructorType || node.parent.kind === 152) { + var isFunctionTypeOrConstructorType = node.kind === 150 || node.kind === 151; + if (isFunctionTypeOrConstructorType || node.parent.kind === 153) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 141 && !(node.flags & 32)) { + else if (node.kind !== 142 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -22982,23 +23350,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 145: + case 146: 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 144: + case 145: 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 146: + case 147: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; + case 141: case 140: - case 139: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23006,7 +23374,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 211) { + else if (node.parent.kind === 212) { 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 : @@ -23019,7 +23387,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 210: + case 211: 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 : @@ -23047,13 +23415,13 @@ var ts; else { writeTextOfNode(currentSourceFile, node.name); } - if (node.initializer || ts.hasQuestionToken(node)) { + if (resolver.isOptionalParameter(node)) { write("?"); } decreaseIndent(); - if (node.parent.kind === 149 || - node.parent.kind === 150 || - node.parent.parent.kind === 152) { + if (node.parent.kind === 150 || + node.parent.kind === 151 || + node.parent.parent.kind === 153) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -23069,22 +23437,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 141: + case 142: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 145: + case 146: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 144: + case 145: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 141: case 140: - case 139: if (node.parent.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23092,7 +23460,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 211) { + else if (node.parent.parent.kind === 212) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23104,7 +23472,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 210: + case 211: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23115,12 +23483,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 158) { + if (bindingPattern.kind === 159) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 159) { + else if (bindingPattern.kind === 160) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -23139,21 +23507,20 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 184) { + if (bindingElement.kind === 185) { write(" "); } - else if (bindingElement.kind === 160) { + else if (bindingElement.kind === 161) { if (bindingElement.propertyName) { writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); - emitBindingPattern(bindingElement.name); } - else if (bindingElement.name) { + if (bindingElement.name) { if (ts.isBindingPattern(bindingElement.name)) { emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 66); + ts.Debug.assert(bindingElement.name.kind === 67); if (bindingElement.dotDotDotToken) { write("..."); } @@ -23165,39 +23532,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 210: - case 215: - case 218: - case 212: case 211: + case 216: + case 219: case 213: + case 212: case 214: + case 215: return emitModuleElement(node, isModuleElementVisible(node)); - case 190: + case 191: return emitModuleElement(node, isVariableStatementVisible(node)); - case 219: + case 220: return emitModuleElement(node, !node.importClause); - case 225: + case 226: return emitExportDeclaration(node); + case 142: case 141: case 140: - case 139: return writeFunctionDeclaration(node); - case 145: - case 144: case 146: + case 145: + case 147: return emitSignatureDeclarationWithJsDocComments(node); - case 142: case 143: + case 144: return emitAccessorDeclaration(node); + case 139: case 138: - case 137: return emitPropertyDeclaration(node); - case 244: + case 245: return emitEnumMemberDeclaration(node); - case 224: + case 225: return emitExportAssignment(node); - case 245: + case 246: return emitSourceFile(node); } } @@ -23206,7 +23573,7 @@ var ts; ? referencedFile.fileName : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + : ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -23262,17 +23629,17 @@ var ts; emitFile(jsFilePath, sourceFile); } }); - if (compilerOptions.out) { - emitFile(compilerOptions.out); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } else { if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, ts.forEach(host.getSourceFiles(), shouldEmitJsx) ? ".jsx" : ".js"); + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!ts.isDeclarationFile(targetSourceFile) && compilerOptions.out) { - emitFile(compilerOptions.out); + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); @@ -23325,7 +23692,7 @@ var ts; var writeEmittedFiles = writeJavaScriptFile; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; - var emit = emitNodeWithoutSourceMap; + var emit = emitNodeWithCommentsAndWithoutSourcemap; var emitStart = function (node) { }; var emitEnd = function (node) { }; var emitToken = emitTokenText; @@ -23396,7 +23763,7 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? + var baseName = expr.kind === 9 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; return makeUniqueName(baseName); } @@ -23408,19 +23775,19 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 66: + case 67: return makeUniqueName(node.text); + case 216: case 215: - case 214: return generateNameForModuleOrEnum(node); - case 219: - case 225: + case 220: + case 226: return generateNameForImportOrExportDeclaration(node); - case 210: case 211: - case 224: + case 212: + case 225: return generateNameForExportDefault(); - case 183: + case 184: return generateNameForClassExpression(); } } @@ -23474,7 +23841,7 @@ var ts; function base64VLQFormatEncode(inValue) { function base64FormatEncode(inValue) { if (inValue < 64) { - return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(inValue); + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); } throw TypeError(inValue + ": not a 64 based value"); } @@ -23559,7 +23926,7 @@ var ts; var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { var name_21 = node.name; - if (!name_21 || name_21.kind !== 133) { + if (!name_21 || name_21.kind !== 134) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -23576,18 +23943,18 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 210 || - node.kind === 170 || + else if (node.kind === 211 || + node.kind === 171 || + node.kind === 141 || node.kind === 140 || - node.kind === 139 || - node.kind === 142 || node.kind === 143 || - node.kind === 215 || - node.kind === 211 || - node.kind === 214) { + node.kind === 144 || + node.kind === 216 || + node.kind === 212 || + node.kind === 215) { if (node.name) { var name_22 = node.name; - scopeName = name_22.kind === 133 + scopeName = name_22.kind === 134 ? ts.getTextOfNode(name_22) : node.name.text; } @@ -23686,7 +24053,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node); } - if (node.kind !== 245) { + if (node.kind !== 246) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node); recordEmitNodeEndSpan(node); @@ -23697,8 +24064,11 @@ var ts; } } } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithSourceMap; + emit = emitNodeWithCommentsAndWithSourcemap; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -23710,7 +24080,7 @@ var ts; ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(flags) { - var result = ts.createSynthesizedNode(66); + var result = ts.createSynthesizedNode(67); result.text = makeTempVariableName(flags); return result; } @@ -23820,7 +24190,9 @@ var ts; write(", "); } } - emitNode(nodes[start + i]); + var node = nodes[start + i]; + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); leadingComma = true; } if (trailingComma) { @@ -23846,7 +24218,7 @@ var ts; } } function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 7 && text.length > 1) { + if (node.kind === 8 && text.length > 1) { switch (text.charCodeAt(1)) { case 98: case 66: @@ -23859,7 +24231,7 @@ var ts; } function emitLiteral(node) { var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { @@ -23871,23 +24243,23 @@ var ts; } function getLiteralText(node) { if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); + return getQuotedEscapedLiteralText("\"", node.text, "\""); } if (node.parent) { return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); } switch (node.kind) { - case 8: - return getQuotedEscapedLiteralText('"', node.text, '"'); - case 10: - return getQuotedEscapedLiteralText('`', node.text, '`'); + case 9: + return getQuotedEscapedLiteralText("\"", node.text, "\""); case 11: - return getQuotedEscapedLiteralText('`', node.text, '${'); + return getQuotedEscapedLiteralText("`", node.text, "`"); case 12: - return getQuotedEscapedLiteralText('}', node.text, '${'); + return getQuotedEscapedLiteralText("`", node.text, "${"); case 13: - return getQuotedEscapedLiteralText('}', node.text, '`'); - case 7: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8: return node.text; } ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); @@ -23897,15 +24269,15 @@ var ts; } function emitDownlevelRawTemplateLiteral(node) { var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - var isLast = node.kind === 10 || node.kind === 13; + var isLast = node.kind === 11 || node.kind === 14; text = text.substring(1, text.length - (isLast ? 1 : 2)); text = text.replace(/\r\n?/g, "\n"); text = ts.escapeString(text); - write('"' + text + '"'); + write("\"" + text + "\""); } function emitDownlevelTaggedTemplateArray(node, literalEmitter) { write("["); - if (node.template.kind === 10) { + if (node.template.kind === 11) { literalEmitter(node.template); } else { @@ -23931,11 +24303,11 @@ var ts; emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); write("("); emit(tempVariable); - if (node.template.kind === 180) { + if (node.template.kind === 181) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 178 - && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 179 + && templateSpan.expression.operatorToken.kind === 24; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -23958,7 +24330,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 169 + var needsParens = templateSpan.expression.kind !== 170 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); @@ -23991,11 +24363,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 165: case 166: - return parent.expression === template; case 167: - case 169: + return parent.expression === template; + case 168: + case 170: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -24003,20 +24375,20 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 178: + case 179: switch (expression.operatorToken.kind) { - case 36: case 37: case 38: + case 39: return 1; - case 34: case 35: + case 36: return 0; default: return -1; } - case 181: - case 179: + case 182: + case 180: return -1; default: return 1; @@ -24029,10 +24401,10 @@ var ts; } function jsxEmitReact(node) { function emitTagName(name) { - if (name.kind === 66 && ts.isIntrinsicJsxName(name.text)) { - write('"'); + if (name.kind === 67 && ts.isIntrinsicJsxName(name.text)) { + write("\""); emit(name); - write('"'); + write("\""); } else { emit(name); @@ -24040,9 +24412,9 @@ var ts; } function emitAttributeName(name) { if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write('"'); + write("\""); emit(name); - write('"'); + write("\""); } else { emit(name); @@ -24068,36 +24440,36 @@ var ts; } else { var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 236; })) { + if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) { write("React.__spread("); var haveOpenedObjectLiteral = false; - for (var i_2 = 0; i_2 < attrs.length; i_2++) { - if (attrs[i_2].kind === 236) { - if (i_2 === 0) { + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 237) { + if (i_1 === 0) { write("{}, "); } if (haveOpenedObjectLiteral) { write("}"); haveOpenedObjectLiteral = false; } - if (i_2 > 0) { + if (i_1 > 0) { write(", "); } - emit(attrs[i_2].expression); + emit(attrs[i_1].expression); } else { - ts.Debug.assert(attrs[i_2].kind === 235); + ts.Debug.assert(attrs[i_1].kind === 236); if (haveOpenedObjectLiteral) { write(", "); } else { haveOpenedObjectLiteral = true; - if (i_2 > 0) { + if (i_1 > 0) { write(", "); } write("{"); } - emitJsxAttribute(attrs[i_2]); + emitJsxAttribute(attrs[i_1]); } } if (haveOpenedObjectLiteral) @@ -24117,15 +24489,15 @@ var ts; } if (children) { for (var i = 0; i < children.length; i++) { - if (children[i].kind === 237 && !(children[i].expression)) { + if (children[i].kind === 238 && !(children[i].expression)) { continue; } - if (children[i].kind === 233) { + if (children[i].kind === 234) { var text = getTextToEmit(children[i]); if (text !== undefined) { - write(', "'); + write(", \""); write(text); - write('"'); + write("\""); } } else { @@ -24137,11 +24509,11 @@ var ts; write(")"); emitTrailingComments(openingNode); } - if (node.kind === 230) { + if (node.kind === 231) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 231); + ts.Debug.assert(node.kind === 232); emitJsxElement(node); } } @@ -24161,11 +24533,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 236) { + if (attribs[i].kind === 237) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 235); + ts.Debug.assert(attribs[i].kind === 236); emitJsxAttribute(attribs[i]); } } @@ -24173,11 +24545,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 231)) { + if (node.attributes.length > 0 || (node.kind === 232)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 231) { + if (node.kind === 232) { write("/>"); } else { @@ -24196,20 +24568,20 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 230) { + if (node.kind === 231) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 231); + ts.Debug.assert(node.kind === 232); emitJsxOpeningOrSelfClosingElement(node); } } function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 160); - if (node.kind === 8) { + ts.Debug.assert(node.kind !== 161); + if (node.kind === 9) { emitLiteral(node); } - else if (node.kind === 133) { + else if (node.kind === 134) { if (ts.nodeIsDecorated(node.parent)) { if (!computedPropertyNamesToGeneratedNames) { computedPropertyNamesToGeneratedNames = []; @@ -24228,7 +24600,7 @@ var ts; } else { write("\""); - if (node.kind === 7) { + if (node.kind === 8) { write(node.text); } else { @@ -24240,58 +24612,60 @@ var ts; function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 161: - case 178: - case 165: - case 238: - case 133: + case 162: case 179: - case 136: - case 172: - case 194: - case 164: - case 224: - case 192: - case 185: - case 196: + case 166: + case 239: + case 134: + case 180: + case 137: + case 173: + case 195: + case 165: + case 225: + case 193: + case 186: case 197: case 198: - case 193: - case 231: + case 199: + case 194: case 232: - case 166: - case 169: - case 177: - case 176: - case 201: - case 243: - case 182: - case 203: + case 233: + case 237: + case 238: case 167: - case 187: - case 205: - case 168: - case 173: - case 174: - case 195: + case 170: + case 178: + case 177: case 202: - case 181: - return true; - case 160: case 244: - case 135: - case 242: - case 138: - case 208: + case 183: + case 204: + case 168: + case 188: + case 206: + case 169: + case 174: + case 175: + case 196: + case 203: + case 182: + return true; + case 161: + case 245: + case 136: + case 243: + case 139: + case 209: return parent.initializer === node; - case 163: + case 164: return parent.expression === node; + case 172: case 171: - case 170: return parent.body === node; - case 218: + case 219: return parent.moduleReference === node; - case 132: + case 133: return parent.left === node; } return false; @@ -24303,7 +24677,7 @@ var ts; } var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 245) { + if (container.kind === 246) { if (languageVersion < 2 && compilerOptions.module !== 4) { write("exports."); } @@ -24316,12 +24690,12 @@ var ts; else if (languageVersion < 2) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 220) { + if (declaration.kind === 221) { write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? '["default"]' : ".default"); + write(languageVersion === 0 ? "[\"default\"]" : ".default"); return; } - else if (declaration.kind === 223) { + else if (declaration.kind === 224) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); write("."); writeTextOfNode(currentSourceFile, declaration.propertyName || declaration.name); @@ -24338,13 +24712,13 @@ var ts; } function isNameOfNestedRedeclaration(node) { if (languageVersion < 2) { - var parent_7 = node.parent; - switch (parent_7.kind) { - case 160: - case 211: - case 214: - case 208: - return parent_7.name === node && resolver.isNestedRedeclaration(parent_7); + var parent_6 = node.parent; + switch (parent_6.kind) { + case 161: + case 212: + case 215: + case 209: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); } } return false; @@ -24418,7 +24792,7 @@ var ts; emit(node.expression); } function emitYieldExpression(node) { - write(ts.tokenToString(111)); + write(ts.tokenToString(112)); if (node.asteriskToken) { write("*"); } @@ -24432,7 +24806,7 @@ var ts; if (needsParenthesis) { write("("); } - write(ts.tokenToString(111)); + write(ts.tokenToString(112)); write(" "); emit(node.expression); if (needsParenthesis) { @@ -24440,22 +24814,22 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 178 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 179 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 179 && node.parent.condition === node) { + else if (node.parent.kind === 180 && node.parent.condition === node) { return true; } return false; } function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { - case 66: - case 161: - case 163: + case 67: + case 162: case 164: case 165: - case 169: + case 166: + case 170: return false; } return true; @@ -24472,17 +24846,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 182) { + if (e.kind === 183) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 161) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 182) { + while (i < length && elements[i].kind !== 183) { i++; } write("["); @@ -24505,7 +24879,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 182; + return node.kind === 183; } function emitArrayLiteral(node) { var elements = node.elements; @@ -24566,7 +24940,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 142 || property.kind === 143) { + if (property.kind === 143 || property.kind === 144) { var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { continue; @@ -24617,13 +24991,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 242) { + if (property.kind === 243) { emit(property.initializer); } - else if (property.kind === 243) { + else if (property.kind === 244) { emitExpressionIdentifier(property.name); } - else if (property.kind === 140) { + else if (property.kind === 141) { emitFunctionDeclaration(property); } else { @@ -24655,7 +25029,7 @@ var ts; var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 133) { + if (properties[i].name.kind === 134) { numInitialNonComputedProperties = i; break; } @@ -24669,35 +25043,35 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(178, startsOnNewLine); + var result = ts.createSynthesizedNode(179, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(163); + var result = ts.createSynthesizedNode(164); result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(20); + result.dotToken = ts.createSynthesizedNode(21); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(164); + var result = ts.createSynthesizedNode(165); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; } function parenthesizeForAccess(expr) { - while (expr.kind === 168 || expr.kind === 186) { + while (expr.kind === 169 || expr.kind === 187) { expr = expr.expression; } if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 166 && - expr.kind !== 7) { + expr.kind !== 167 && + expr.kind !== 8) { return expr; } - var node = ts.createSynthesizedNode(169); + var node = ts.createSynthesizedNode(170); node.expression = expr; return node; } @@ -24719,11 +25093,12 @@ var ts; function emitPropertyAssignment(node) { emit(node.name); write(": "); + emitTrailingCommentsOfPosition(node.initializer.pos); emit(node.initializer); } function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 245; + return container && container.kind !== 246; } function emitShorthandPropertyAssignment(node) { writeTextOfNode(currentSourceFile, node.name); @@ -24733,20 +25108,25 @@ var ts; } } function tryEmitConstantValue(node) { - if (compilerOptions.isolatedModules) { - return false; - } - var constantValue = resolver.getConstantValue(node); + var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 163 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 164 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; } return false; } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 164 || node.kind === 165 + ? resolver.getConstantValue(node) + : undefined; + } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); @@ -24769,9 +25149,15 @@ var ts; emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); var shouldEmitSpace; - if (!indentedBeforeDot && node.expression.kind === 7) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(20)) < 0; + if (!indentedBeforeDot) { + if (node.expression.kind === 8) { + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; + } + else { + var constantValue = tryGetConstEnumValue(node.expression); + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } } if (shouldEmitSpace) { write(" ."); @@ -24789,7 +25175,7 @@ var ts; emit(node.right); } function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 66) { + if (node.left.kind === 67) { emitEntityNameAsExpression(node.left, useFallback); } else if (useFallback) { @@ -24805,11 +25191,11 @@ var ts; emitEntityNameAsExpression(node.left, false); } write("."); - emitNodeWithoutSourceMap(node.right); + emit(node.right); } function emitEntityNameAsExpression(node, useFallback) { switch (node.kind) { - case 66: + case 67: if (useFallback) { write("typeof "); emitExpressionIdentifier(node); @@ -24817,7 +25203,7 @@ var ts; } emitExpressionIdentifier(node); break; - case 132: + case 133: emitQualifiedNameAsExpression(node, useFallback); break; } @@ -24832,16 +25218,16 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 182; }); + return ts.forEach(elements, function (e) { return e.kind === 183; }); } function skipParentheses(node) { - while (node.kind === 169 || node.kind === 168 || node.kind === 186) { + while (node.kind === 170 || node.kind === 169 || node.kind === 187) { node = node.expression; } return node; } function emitCallTarget(node) { - if (node.kind === 66 || node.kind === 94 || node.kind === 92) { + if (node.kind === 67 || node.kind === 95 || node.kind === 93) { emit(node); return node; } @@ -24856,18 +25242,18 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 163) { + if (expr.kind === 164) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 164) { + else if (expr.kind === 165) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); write("]"); } - else if (expr.kind === 92) { + else if (expr.kind === 93) { target = expr; write("_super"); } @@ -24876,7 +25262,7 @@ var ts; } write(".apply("); if (target) { - if (target.kind === 92) { + if (target.kind === 93) { emitThis(target); } else { @@ -24896,13 +25282,13 @@ var ts; return; } var superCall = false; - if (node.expression.kind === 92) { + if (node.expression.kind === 93) { emitSuper(node.expression); superCall = true; } else { emit(node.expression); - superCall = node.expression.kind === 163 && node.expression.expression.kind === 92; + superCall = node.expression.kind === 164 && node.expression.expression.kind === 93; } if (superCall && languageVersion < 2) { write(".call("); @@ -24953,20 +25339,20 @@ var ts; } } function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 171) { - if (node.expression.kind === 168 || node.expression.kind === 186) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172) { + if (node.expression.kind === 169 || node.expression.kind === 187) { var operand = node.expression.expression; - while (operand.kind === 168 || operand.kind === 186) { + while (operand.kind === 169 || operand.kind === 187) { operand = operand.expression; } - if (operand.kind !== 176 && + if (operand.kind !== 177 && + operand.kind !== 175 && operand.kind !== 174 && operand.kind !== 173 && - operand.kind !== 172 && - operand.kind !== 177 && - operand.kind !== 166 && - !(operand.kind === 165 && node.parent.kind === 166) && - !(operand.kind === 170 && node.parent.kind === 165)) { + operand.kind !== 178 && + operand.kind !== 167 && + !(operand.kind === 166 && node.parent.kind === 167) && + !(operand.kind === 171 && node.parent.kind === 166)) { emit(operand); return; } @@ -24977,25 +25363,25 @@ var ts; write(")"); } function emitDeleteExpression(node) { - write(ts.tokenToString(75)); + write(ts.tokenToString(76)); write(" "); emit(node.expression); } function emitVoidExpression(node) { - write(ts.tokenToString(100)); + write(ts.tokenToString(101)); write(" "); emit(node.expression); } function emitTypeOfExpression(node) { - write(ts.tokenToString(98)); + write(ts.tokenToString(99)); write(" "); emit(node.expression); } function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 66 || ts.nodeIsSynthesized(node)) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 67 || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 208 || node.parent.kind === 160); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 || node.parent.kind === 161); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); @@ -25009,12 +25395,12 @@ var ts; write("\", "); } write(ts.tokenToString(node.operator)); - if (node.operand.kind === 176) { + if (node.operand.kind === 177) { var operand = node.operand; - if (node.operator === 34 && (operand.operator === 34 || operand.operator === 39)) { + if (node.operator === 35 && (operand.operator === 35 || operand.operator === 40)) { write(" "); } - else if (node.operator === 35 && (operand.operator === 35 || operand.operator === 40)) { + else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 41)) { write(" "); } } @@ -25031,7 +25417,7 @@ var ts; write("\", "); write(ts.tokenToString(node.operator)); emit(node.operand); - if (node.operator === 39) { + if (node.operator === 40) { write(") - 1)"); } else { @@ -25052,10 +25438,10 @@ var ts; } var current = node; while (current) { - if (current.kind === 245) { + if (current.kind === 246) { return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); } - else if (ts.isFunctionLike(current) || current.kind === 216) { + else if (ts.isFunctionLike(current) || current.kind === 217) { return false; } else { @@ -25064,13 +25450,13 @@ var ts; } } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 54 && - (node.left.kind === 162 || node.left.kind === 161)) { - emitDestructuring(node, node.parent.kind === 192); + if (languageVersion < 2 && node.operatorToken.kind === 55 && + (node.left.kind === 163 || node.left.kind === 162)) { + emitDestructuring(node, node.parent.kind === 193); } else { - var exportChanged = node.operatorToken.kind >= 54 && - node.operatorToken.kind <= 65 && + var exportChanged = node.operatorToken.kind >= 55 && + node.operatorToken.kind <= 66 && isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); if (exportChanged) { write(exportFunctionForFile + "(\""); @@ -25078,7 +25464,7 @@ var ts; write("\", "); } emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 ? " " : undefined); + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); @@ -25113,36 +25499,36 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 189) { + if (node && node.kind === 190) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { if (isSingleLineEmptyBlock(node)) { - emitToken(14, node.pos); + emitToken(15, node.pos); write(" "); - emitToken(15, node.statements.end); + emitToken(16, node.statements.end); return; } - emitToken(14, node.pos); + emitToken(15, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 216) { - ts.Debug.assert(node.parent.kind === 215); + if (node.kind === 217) { + ts.Debug.assert(node.parent.kind === 216); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 216) { + if (node.kind === 217) { emitTempDeclarations(true); } decreaseIndent(); writeLine(); - emitToken(15, node.statements.end); + emitToken(16, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 189) { + if (node.kind === 190) { write(" "); emit(node); } @@ -25154,20 +25540,20 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 171); + emitParenthesizedIf(node.expression, node.expression.kind === 172); write(";"); } function emitIfStatement(node) { - var endPos = emitToken(85, node.pos); + var endPos = emitToken(86, node.pos); write(" "); - endPos = emitToken(16, endPos); + endPos = emitToken(17, endPos); emit(node.expression); - emitToken(17, node.expression.end); + emitToken(18, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(77, node.thenStatement.end); - if (node.elseStatement.kind === 193) { + emitToken(78, node.thenStatement.end); + if (node.elseStatement.kind === 194) { write(" "); emit(node.elseStatement); } @@ -25179,7 +25565,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 189) { + if (node.statement.kind === 190) { write(" "); } else { @@ -25199,13 +25585,13 @@ var ts; if (shouldHoistVariable(decl, true)) { return false; } - var tokenKind = 99; + var tokenKind = 100; if (decl && languageVersion >= 2) { if (ts.isLet(decl)) { - tokenKind = 105; + tokenKind = 106; } else if (ts.isConst(decl)) { - tokenKind = 71; + tokenKind = 72; } } if (startPos !== undefined) { @@ -25214,13 +25600,13 @@ var ts; } else { switch (tokenKind) { - case 99: + case 100: write("var "); break; - case 105: + case 106: write("let "); break; - case 71: + case 72: write("const "); break; } @@ -25245,10 +25631,10 @@ var ts; return started; } function emitForStatement(node) { - var endPos = emitToken(83, node.pos); + var endPos = emitToken(84, node.pos); write(" "); - endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 209) { + endPos = emitToken(17, endPos); + if (node.initializer && node.initializer.kind === 210) { var variableDeclarationList = node.initializer; var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); if (startIsEmitted) { @@ -25269,13 +25655,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 198) { + if (languageVersion < 2 && node.kind === 199) { return emitDownLevelForOfStatement(node); } - var endPos = emitToken(83, node.pos); + var endPos = emitToken(84, node.pos); write(" "); - endPos = emitToken(16, endPos); - if (node.initializer.kind === 209) { + endPos = emitToken(17, endPos); + if (node.initializer.kind === 210) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); @@ -25285,14 +25671,14 @@ var ts; else { emit(node.initializer); } - if (node.kind === 197) { + if (node.kind === 198) { write(" in "); } else { write(" of "); } emit(node.expression); - emitToken(17, node.expression.end); + emitToken(18, node.expression.end); emitEmbeddedStatement(node.statement); } function emitDownLevelForOfStatement(node) { @@ -25316,10 +25702,10 @@ var ts; // all destructuring. // Note also that because an extra statement is needed to assign to the LHS, // for-of bodies are always emitted as blocks. - var endPos = emitToken(83, node.pos); + var endPos = emitToken(84, node.pos); write(" "); - endPos = emitToken(16, endPos); - var rhsIsIdentifier = node.expression.kind === 66; + endPos = emitToken(17, endPos); + var rhsIsIdentifier = node.expression.kind === 67; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); emitStart(node.expression); @@ -25339,7 +25725,7 @@ var ts; emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); emitEnd(node.initializer); write("; "); @@ -25347,13 +25733,13 @@ var ts; emitNodeWithoutSourceMap(counter); write("++"); emitEnd(node.initializer); - emitToken(17, node.expression.end); + emitToken(18, node.expression.end); write(" {"); writeLine(); increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 209) { + if (node.initializer.kind === 210) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -25362,7 +25748,7 @@ var ts; emitDestructuring(declaration, false, rhsIterationValue); } else { - emitNodeWithoutSourceMap(declaration); + emitNodeWithCommentsAndWithoutSourcemap(declaration); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -25374,17 +25760,17 @@ var ts; } } else { - var assignmentExpression = createBinaryExpression(node.initializer, 54, rhsIterationValue, false); - if (node.initializer.kind === 161 || node.initializer.kind === 162) { + var assignmentExpression = createBinaryExpression(node.initializer, 55, rhsIterationValue, false); + if (node.initializer.kind === 162 || node.initializer.kind === 163) { emitDestructuring(assignmentExpression, true, undefined); } else { - emitNodeWithoutSourceMap(assignmentExpression); + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); } } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 189) { + if (node.statement.kind === 190) { emitLines(node.statement.statements); } else { @@ -25396,12 +25782,12 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 200 ? 67 : 72, node.pos); + emitToken(node.kind === 201 ? 68 : 73, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { - emitToken(91, node.pos); + emitToken(92, node.pos); emitOptional(" ", node.expression); write(";"); } @@ -25412,21 +25798,21 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(93, node.pos); + var endPos = emitToken(94, node.pos); write(" "); - emitToken(16, endPos); + emitToken(17, endPos); emit(node.expression); - endPos = emitToken(17, node.expression.end); + endPos = emitToken(18, node.expression.end); write(" "); emitCaseBlock(node.caseBlock, endPos); } function emitCaseBlock(node, startPos) { - emitToken(14, startPos); + emitToken(15, startPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(15, node.clauses.end); + emitToken(16, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === @@ -25441,7 +25827,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 238) { + if (node.kind === 239) { write("case "); emit(node.expression); write(":"); @@ -25476,16 +25862,16 @@ var ts; } function emitCatchClause(node) { writeLine(); - var endPos = emitToken(69, node.pos); + var endPos = emitToken(70, node.pos); write(" "); - emitToken(16, endPos); + emitToken(17, endPos); emit(node.variableDeclaration); - emitToken(17, node.variableDeclaration ? node.variableDeclaration.end : endPos); + emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); write(" "); emitBlock(node.block); } function emitDebuggerStatement(node) { - emitToken(73, node.pos); + emitToken(74, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -25496,7 +25882,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 215); + } while (node && node.kind !== 216); return node; } function emitContainingModuleName(node) { @@ -25515,16 +25901,33 @@ var ts; write("exports."); } } - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); emitEnd(node.name); } function createVoidZero() { - var zero = ts.createSynthesizedNode(7); + var zero = ts.createSynthesizedNode(8); zero.text = "0"; - var result = ts.createSynthesizedNode(174); + var result = ts.createSynthesizedNode(175); result.expression = zero; return result; } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 246) { + ts.Debug.assert(!!(node.flags & 1024) || node.kind === 225); + if (compilerOptions.module === 1 || compilerOptions.module === 2 || compilerOptions.module === 3) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1) { + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } function emitExportMemberAssignment(node) { if (node.flags & 1) { writeLine(); @@ -25535,7 +25938,7 @@ var ts; write("default"); } else { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } write("\", "); emitDeclarationName(node); @@ -25543,6 +25946,7 @@ var ts; } else { if (node.flags & 1024) { + emitEs6ExportDefaultCompat(node); if (languageVersion === 0) { write("exports[\"default\"]"); } @@ -25561,44 +25965,48 @@ var ts; } } function emitExportMemberAssignments(name) { + if (compilerOptions.module === 4) { + return; + } if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); - if (compilerOptions.module === 4) { - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(specifier.name); - write("\", "); - emitExpressionIdentifier(name); - write(")"); - emitEnd(specifier.name); - } - else { - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - } + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); write(";"); } } } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(compilerOptions.module === 4); + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; var canDefineTempVariablesInPlace = false; - if (root.kind === 208) { + if (root.kind === 209) { var isExported = ts.getCombinedNodeFlags(root) & 1; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 135) { + else if (root.kind === 136) { canDefineTempVariablesInPlace = true; } - if (root.kind === 178) { + if (root.kind === 179) { emitAssignmentExpression(root); } else { @@ -25609,11 +26017,11 @@ var ts; if (emitCount++) { write(", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 208 || name.parent.kind === 160); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 || name.parent.kind === 161); var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); if (exportChanged) { write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(name); + emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } if (isVariableDeclarationOrBindingElement) { @@ -25629,7 +26037,7 @@ var ts; } } function ensureIdentifier(expr) { - if (expr.kind !== 66) { + if (expr.kind !== 67) { var identifier = createTempVariable(0); if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); @@ -25641,37 +26049,37 @@ var ts; } function createDefaultValueCheck(value, defaultValue) { value = ensureIdentifier(value); - var equals = ts.createSynthesizedNode(178); + var equals = ts.createSynthesizedNode(179); equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(31); + equals.operatorToken = ts.createSynthesizedNode(32); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(179); + var cond = ts.createSynthesizedNode(180); cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(51); + cond.questionToken = ts.createSynthesizedNode(52); cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(52); + cond.colonToken = ts.createSynthesizedNode(53); cond.whenFalse = whenFalse; return cond; } function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(7); + var node = ts.createSynthesizedNode(8); node.text = "" + value; return node; } function createPropertyAccessForDestructuringProperty(object, propName) { var syntheticName = ts.createSynthesizedNode(propName.kind); syntheticName.text = propName.text; - if (syntheticName.kind !== 66) { + if (syntheticName.kind !== 67) { return createElementAccessExpression(object, syntheticName); } return createPropertyAccessExpression(object, syntheticName); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(165); - var sliceIdentifier = ts.createSynthesizedNode(66); + var call = ts.createSynthesizedNode(166); + var sliceIdentifier = ts.createSynthesizedNode(67); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); call.arguments = ts.createSynthesizedNodeArray(); @@ -25685,7 +26093,7 @@ var ts; } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 242 || p.kind === 243) { + if (p.kind === 243 || p.kind === 244) { var propName = p.name; emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); } @@ -25698,8 +26106,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 184) { - if (e.kind !== 182) { + if (e.kind !== 185) { + if (e.kind !== 183) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); } else if (i === elements.length - 1) { @@ -25709,14 +26117,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 178 && target.operatorToken.kind === 54) { + if (target.kind === 179 && target.operatorToken.kind === 55) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 162) { + if (target.kind === 163) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 161) { + else if (target.kind === 162) { emitArrayLiteralAssignment(target, value); } else { @@ -25726,18 +26134,21 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (isAssignmentExpressionStatement) { + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 169) { + if (root.parent.kind !== 170) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 169) { + if (root.parent.kind !== 170) { write(")"); } } @@ -25757,11 +26168,11 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 158) { + if (pattern.kind === 159) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 184) { + else if (element.kind !== 185) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } @@ -25792,15 +26203,15 @@ var ts; var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384) && (getCombinedFlagsForIdentifier(node.name) & 16384); if (isUninitializedLet && - node.parent.parent.kind !== 197 && - node.parent.parent.kind !== 198) { + node.parent.parent.kind !== 198 && + node.parent.parent.kind !== 199) { initializer = createVoidZero(); } } var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); if (exportChanged) { write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); write("\", "); } emitModuleMemberName(node); @@ -25811,11 +26222,11 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 184) { + if (node.kind === 185) { return; } var name = node.name; - if (name.kind === 66) { + if (name.kind === 67) { emitExportMemberAssignments(name); } else if (ts.isBindingPattern(name)) { @@ -25823,7 +26234,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 208 && node.parent.kind !== 160)) { + if (!node.parent || (node.parent.kind !== 209 && node.parent.kind !== 161)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -25831,7 +26242,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 245; + node.parent.kind === 246; } function emitVariableStatement(node) { var startIsEmitted = false; @@ -25929,9 +26340,9 @@ var ts; emitEnd(parameter); write(" { "); emitStart(parameter); - emitNodeWithoutSourceMap(paramName); + emitNodeWithCommentsAndWithoutSourcemap(paramName); write(" = "); - emitNodeWithoutSourceMap(initializer); + emitNodeWithCommentsAndWithoutSourcemap(initializer); emitEnd(parameter); write("; }"); } @@ -25950,7 +26361,7 @@ var ts; emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -25971,7 +26382,7 @@ var ts; increaseIndent(); writeLine(); emitStart(restParam); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -25980,26 +26391,26 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 142 ? "get " : "set "); + write(node.kind === 143 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 171 && languageVersion >= 2; + return node.kind === 172 && languageVersion >= 2; } function emitDeclarationName(node) { if (node.name) { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } else { write(getGeneratedNameForNode(node)); } } function shouldEmitFunctionName(node) { - if (node.kind === 170) { + if (node.kind === 171) { return !!node.name; } - if (node.kind === 210) { + if (node.kind === 211) { return !!node.name || languageVersion < 2; } } @@ -26007,9 +26418,12 @@ var ts; if (ts.nodeIsMissing(node.body)) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== 140 && node.kind !== 139) { + if (node.kind !== 141 && node.kind !== 140 && + node.parent && node.parent.kind !== 243 && + node.parent.kind !== 166) { emitLeadingComments(node); } + emitStart(node); if (!shouldEmitAsArrowFunction(node)) { if (isES6ExportedDeclaration(node)) { write("export "); @@ -26027,10 +26441,11 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 210 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 211 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } - if (node.kind !== 140 && node.kind !== 139) { + emitEnd(node); + if (node.kind !== 141 && node.kind !== 140) { emitTrailingComments(node); } } @@ -26062,7 +26477,7 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 171; + var isArrowFunction = node.kind === 172; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; var args; if (!isArrowFunction) { @@ -26105,7 +26520,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 189) { + if (node.body.kind === 190) { emitBlockFunctionBody(node, node.body); } else { @@ -26153,10 +26568,10 @@ var ts; } write(" "); var current = body; - while (current.kind === 168) { + while (current.kind === 169) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 162); + emitParenthesizedIf(body, current.kind === 163); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -26222,17 +26637,17 @@ var ts; emitLeadingCommentsOfPosition(body.statements.end); decreaseIndent(); } - emitToken(15, body.statements.end); + emitToken(16, body.statements.end); scopeEmitEnd(); } function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 192) { + if (statement && statement.kind === 193) { var expr = statement.expression; - if (expr && expr.kind === 165) { + if (expr && expr.kind === 166) { var func = expr.expression; - if (func && func.kind === 92) { + if (func && func.kind === 93) { return statement; } } @@ -26256,24 +26671,24 @@ var ts; }); } function emitMemberAccessForPropertyName(memberName) { - if (memberName.kind === 8 || memberName.kind === 7) { + if (memberName.kind === 9 || memberName.kind === 8) { write("["); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 133) { + else if (memberName.kind === 134) { emitComputedPropertyName(memberName); } else { write("."); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); } } function getInitializedProperties(node, isStatic) { var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 138 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { + if (member.kind === 139 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { properties.push(member); } } @@ -26313,11 +26728,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 188) { + if (member.kind === 189) { writeLine(); write(";"); } - else if (member.kind === 140 || node.kind === 139) { + else if (member.kind === 141 || node.kind === 140) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -26329,14 +26744,12 @@ var ts; emitMemberAccessForPropertyName(member.name); emitEnd(member.name); write(" = "); - emitStart(member); emitFunctionDeclaration(member); emitEnd(member); - emitEnd(member); write(";"); emitTrailingComments(member); } - else if (member.kind === 142 || member.kind === 143) { + else if (member.kind === 143 || member.kind === 144) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -26386,22 +26799,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 140 || node.kind === 139) && !member.body) { + if ((member.kind === 141 || node.kind === 140) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 140 || - member.kind === 142 || - member.kind === 143) { + else if (member.kind === 141 || + member.kind === 143 || + member.kind === 144) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 128) { write("static "); } - if (member.kind === 142) { + if (member.kind === 143) { write("get "); } - else if (member.kind === 143) { + else if (member.kind === 144) { write("set "); } if (member.asteriskToken) { @@ -26412,7 +26825,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 188) { + else if (member.kind === 189) { writeLine(); write(";"); } @@ -26433,10 +26846,10 @@ var ts; function emitConstructorWorker(node, baseTypeElement) { var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { - if (member.kind === 141 && !member.body) { + if (member.kind === 142 && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - if (member.kind === 138 && member.initializer && (member.flags & 128) === 0) { + if (member.kind === 139 && member.initializer && (member.flags & 128) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -26467,18 +26880,21 @@ var ts; } } } + var startIndex = 0; write(" {"); scopeEmitStart(node, "constructor"); increaseIndent(); if (ctor) { + startIndex = emitDirectivePrologues(ctor.body.statements, true); emitDetachedComments(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); + var superCall; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -26505,7 +26921,7 @@ var ts; if (superCall) { statements = statements.slice(1); } - emitLines(statements); + emitLinesStartingAt(statements, startIndex); } emitTempDeclarations(true); writeLine(); @@ -26513,7 +26929,7 @@ var ts; emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(15, ctor ? ctor.body.statements.end : node.members.end); + emitToken(16, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -26536,7 +26952,7 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 211) { + if (node.kind === 212) { if (thisNodeIsDecorated) { if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { write("export "); @@ -26553,7 +26969,7 @@ var ts; } } var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 183; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0); @@ -26580,7 +26996,7 @@ var ts; emitMemberFunctionsForES6AndHigher(node); decreaseIndent(); writeLine(); - emitToken(15, node.members.end); + emitToken(16, node.members.end); scopeEmitEnd(); if (thisNodeIsDecorated) { write(";"); @@ -26620,7 +27036,7 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 211) { + if (node.kind === 212) { if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); } @@ -26658,7 +27074,7 @@ var ts; writeLine(); emitDecoratorsOfClass(node); writeLine(); - emitToken(15, node.members.end, function () { + emitToken(16, node.members.end, function () { write("return "); emitDeclarationName(node); }); @@ -26670,7 +27086,7 @@ var ts; computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; decreaseIndent(); writeLine(); - emitToken(15, node.members.end); + emitToken(16, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -26678,11 +27094,11 @@ var ts; emit(baseTypeNode.expression); } write(")"); - if (node.kind === 211) { + if (node.kind === 212) { write(";"); } emitEnd(node); - if (node.kind === 211) { + if (node.kind === 212) { emitExportMemberAssignment(node); } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { @@ -26756,13 +27172,13 @@ var ts; } else { decorators = member.decorators; - if (member.kind === 140) { + if (member.kind === 141) { functionLikeMember = member; } } writeLine(); emitStart(member); - if (member.kind !== 138) { + if (member.kind !== 139) { write("Object.defineProperty("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -26792,7 +27208,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - if (member.kind !== 138) { + if (member.kind !== 139) { write(", Object.getOwnPropertyDescriptor("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -26831,45 +27247,45 @@ var ts; } function shouldEmitTypeMetadata(node) { switch (node.kind) { - case 140: - case 142: + case 141: case 143: - case 138: + case 144: + case 139: return true; } return false; } function shouldEmitReturnTypeMetadata(node) { switch (node.kind) { - case 140: + case 141: return true; } return false; } function shouldEmitParamTypesMetadata(node) { switch (node.kind) { - case 211: - case 140: - case 143: + case 212: + case 141: + case 144: return true; } return false; } function emitSerializedTypeOfNode(node) { switch (node.kind) { - case 211: + case 212: write("Function"); return; - case 138: + case 139: emitSerializedTypeNode(node.type); return; - case 135: + case 136: emitSerializedTypeNode(node.type); return; - case 142: + case 143: emitSerializedTypeNode(node.type); return; - case 143: + case 144: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -26880,43 +27296,46 @@ var ts; write("void 0"); } function emitSerializedTypeNode(node) { + if (!node) { + return; + } switch (node.kind) { - case 100: + case 101: write("void 0"); return; - case 157: + case 158: emitSerializedTypeNode(node.type); return; - case 149: case 150: + case 151: write("Function"); return; - case 153: case 154: + case 155: write("Array"); return; - case 147: - case 117: + case 148: + case 118: write("Boolean"); return; - case 127: - case 8: + case 128: + case 9: write("String"); return; - case 125: + case 126: write("Number"); return; - case 128: + case 129: write("Symbol"); return; - case 148: + case 149: emitSerializedTypeReferenceNode(node); return; - case 151: case 152: - case 155: + case 153: case 156: - case 114: + case 157: + case 115: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -26925,8 +27344,13 @@ var ts; write("Object"); } function emitSerializedTypeReferenceNode(node) { - var typeName = node.typeName; - var result = resolver.getTypeReferenceSerializationKind(node); + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); switch (result) { case ts.TypeReferenceSerializationKind.Unknown: var temp = createAndRecordTempVariable(0); @@ -26975,7 +27399,7 @@ var ts; function emitSerializedParameterTypesOfNode(node) { if (node) { var valueDeclaration; - if (node.kind === 211) { + if (node.kind === 212) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -26991,10 +27415,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 153) { + if (parameterType.kind === 154) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 148 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 149 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -27011,7 +27435,7 @@ var ts; } } function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node)) { + if (node && ts.isFunctionLike(node) && node.type) { emitSerializedTypeNode(node.type); return; } @@ -27088,7 +27512,7 @@ var ts; emitLines(node.members); decreaseIndent(); writeLine(); - emitToken(15, node.members.end); + emitToken(16, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -27147,7 +27571,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 215) { + if (moduleDeclaration.body.kind === 216) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -27182,7 +27606,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 216) { + if (node.body.kind === 217) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -27201,7 +27625,7 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(15, moduleBlock.statements.end); + emitToken(16, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); @@ -27214,7 +27638,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 66 && node.parent === currentSourceFile) { + if (!isES6ExportedDeclaration(node) && node.name.kind === 67 && node.parent === currentSourceFile) { if (compilerOptions.module === 4 && (node.flags & 1)) { writeLine(); write(exportFunctionForFile + "(\""); @@ -27226,29 +27650,41 @@ var ts; emitExportMemberAssignments(node.name); } } + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } function emitRequire(moduleName) { - if (moduleName.kind === 8) { + if (moduleName.kind === 9) { write("require("); - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - emitToken(17, moduleName.end); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18, moduleName.end); } else { write("require()"); } } function getNamespaceDeclarationNode(node) { - if (node.kind === 218) { + if (node.kind === 219) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 221) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 219 && node.importClause && !!node.importClause.name; + return node.kind === 220 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -27275,7 +27711,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 221) { + if (node.importClause.namedBindings.kind === 222) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -27301,7 +27737,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 218 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 219 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -27313,7 +27749,7 @@ var ts; write(" = "); } else { - var isNakedImport = 219 && !node.importClause; + var isNakedImport = 220 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -27359,16 +27795,29 @@ var ts; (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); + var variableDeclarationIsHoisted = shouldHoistVariable(node, true); + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1)) { + write("var "); + } } - else if (!(node.flags & 1)) { - write("var "); + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); } emitModuleMemberName(node); write(" = "); emit(node.moduleReference); + if (isExported) { + write(")"); + } write(";"); emitEnd(node); emitExportImportAssignments(node); @@ -27396,11 +27845,11 @@ var ts; emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); write(" = "); write(generatedName); write("."); - emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); } @@ -27422,7 +27871,6 @@ var ts; } else { if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - emitStart(node); write("export "); if (node.exportClause) { write("{ "); @@ -27434,10 +27882,9 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - emitNodeWithoutSourceMap(node.moduleSpecifier); + emit(node.moduleSpecifier); } write(";"); - emitEnd(node); } } } @@ -27450,13 +27897,11 @@ var ts; if (needsComma) { write(", "); } - emitStart(specifier); if (specifier.propertyName) { - emitNodeWithoutSourceMap(specifier.propertyName); + emit(specifier.propertyName); write(" as "); } - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier); + emit(specifier.name); needsComma = true; } } @@ -27469,8 +27914,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 210 && - expression.kind !== 211) { + if (expression.kind !== 211 && + expression.kind !== 212) { write(";"); } emitEnd(node); @@ -27484,6 +27929,7 @@ var ts; write(")"); } else { + emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0) { write("[\"default\"] = "); @@ -27506,18 +27952,18 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 219: + case 220: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 218: - if (node.moduleReference.kind === 229 && resolver.isReferencedAliasDeclaration(node)) { + case 219: + if (node.moduleReference.kind === 230 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 225: + case 226: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -27535,7 +27981,7 @@ var ts; } } break; - case 224: + case 225: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -27560,17 +28006,17 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); } - if (node.kind === 219 && node.importClause) { + if (node.kind === 220 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 225 && node.moduleSpecifier) { + if (node.kind === 226 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } function getExternalModuleNameText(importNode) { var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 8) { - return getLiteralText(moduleName); + if (moduleName.kind === 9) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); } return undefined; } @@ -27582,8 +28028,8 @@ var ts; var started = false; for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; - var skipNode = importNode.kind === 225 || - (importNode.kind === 219 && !importNode.importClause); + var skipNode = importNode.kind === 226 || + (importNode.kind === 220 && !importNode.importClause); if (skipNode) { continue; } @@ -27608,7 +28054,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0; _a < externalImports.length; _a++) { var externalImport = externalImports[_a]; - if (externalImport.kind === 225 && externalImport.exportClause) { + if (externalImport.kind === 226 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -27637,7 +28083,7 @@ var ts; } for (var _d = 0; _d < externalImports.length; _d++) { var externalImport = externalImports[_d]; - if (externalImport.kind !== 225) { + if (externalImport.kind !== 226) { continue; } var exportDecl = externalImport; @@ -27659,6 +28105,8 @@ var ts; write("function " + exportStarFunction + "(m) {"); increaseIndent(); writeLine(); + write("var exports = {};"); + writeLine(); write("for(var n in m) {"); increaseIndent(); writeLine(); @@ -27666,17 +28114,19 @@ var ts; if (localNames) { write("&& !" + localNames + ".hasOwnProperty(n)"); } - write(") " + exportFunctionForFile + "(n, m[n]);"); + write(") exports[n] = m[n];"); decreaseIndent(); writeLine(); write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); decreaseIndent(); writeLine(); write("}"); return exportStarFunction; } function writeExportedName(node) { - if (node.kind !== 66 && node.flags & 1024) { + if (node.kind !== 67 && node.flags & 1024) { return; } if (started) { @@ -27687,8 +28137,8 @@ var ts; } writeLine(); write("'"); - if (node.kind === 66) { - emitNodeWithoutSourceMap(node); + if (node.kind === 67) { + emitNodeWithCommentsAndWithoutSourcemap(node); } else { emitDeclarationName(node); @@ -27707,7 +28157,7 @@ var ts; var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; - var name_25 = local.kind === 66 + var name_25 = local.kind === 67 ? local : local.name; if (name_25) { @@ -27722,13 +28172,13 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 211 || local.kind === 215 || local.kind === 214) { + if (local.kind === 212 || local.kind === 216 || local.kind === 215) { emitDeclarationName(local); } else { emit(local); } - var flags = ts.getCombinedNodeFlags(local.kind === 66 ? local.parent : local); + var flags = ts.getCombinedNodeFlags(local.kind === 67 ? local.parent : local); if (flags & 1) { if (!exportedDeclarations) { exportedDeclarations = []; @@ -27756,21 +28206,21 @@ var ts; if (node.flags & 2) { return; } - if (node.kind === 210) { + if (node.kind === 211) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 211) { + if (node.kind === 212) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 214) { + if (node.kind === 215) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -27779,7 +28229,7 @@ var ts; } return; } - if (node.kind === 215) { + if (node.kind === 216) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -27788,10 +28238,10 @@ var ts; } return; } - if (node.kind === 208 || node.kind === 160) { + if (node.kind === 209 || node.kind === 161) { if (shouldHoistVariable(node, false)) { var name_26 = node.name; - if (name_26.kind === 66) { + if (name_26.kind === 67) { if (!hoistedVars) { hoistedVars = []; } @@ -27803,6 +28253,13 @@ var ts; } return; } + if (ts.isInternalModuleImportEqualsDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } if (ts.isBindingPattern(node)) { ts.forEach(node.elements, visit); return; @@ -27817,12 +28274,12 @@ var ts; return false; } return (ts.getCombinedNodeFlags(node) & 49152) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 245; + ts.getEnclosingBlockScopeContainer(node).kind === 246; } function isCurrentFileSystemExternalModule() { return compilerOptions.module === 4 && ts.isExternalModule(currentSourceFile); } - function emitSystemModuleBody(node, startIndex) { + function emitSystemModuleBody(node, dependencyGroups, startIndex) { emitVariableDeclarationsForImports(); writeLine(); var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); @@ -27831,7 +28288,7 @@ var ts; write("return {"); increaseIndent(); writeLine(); - emitSetters(exportStarFunction); + emitSetters(exportStarFunction, dependencyGroups); writeLine(); emitExecute(node, startIndex); decreaseIndent(); @@ -27839,75 +28296,64 @@ var ts; write("}"); emitTempDeclarations(true); } - function emitSetters(exportStarFunction) { + function emitSetters(exportStarFunction, dependencyGroups) { write("setters:["); - for (var i = 0; i < externalImports.length; ++i) { + for (var i = 0; i < dependencyGroups.length; ++i) { if (i !== 0) { write(","); } writeLine(); increaseIndent(); - var importNode = externalImports[i]; - var importVariableName = getLocalNameForExternalImport(importNode) || ""; - var parameterName = "_" + importVariableName; + var group = dependencyGroups[i]; + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); write("function (" + parameterName + ") {"); - switch (importNode.kind) { - case 219: - if (!importNode.importClause) { - break; - } - case 218: - ts.Debug.assert(importVariableName !== ""); - increaseIndent(); - writeLine(); - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - var defaultName = importNode.kind === 219 - ? importNode.importClause.name - : importNode.name; - if (defaultName) { - emitExportMemberAssignments(defaultName); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 220: + if (!entry.importClause) { + break; + } + case 219: + ts.Debug.assert(importVariableName !== ""); writeLine(); - } - if (importNode.kind === 219 && - importNode.importClause.namedBindings) { - var namedBindings = importNode.importClause.namedBindings; - if (namedBindings.kind === 221) { - emitExportMemberAssignments(namedBindings.name); + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 226: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { writeLine(); - } - else { - for (var _a = 0, _b = namedBindings.elements; _a < _b.length; _a++) { - var element = _b[_a]; - emitExportMemberAssignments(element.name || element.propertyName); - writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); } + decreaseIndent(); + writeLine(); + write("});"); } - } - decreaseIndent(); - break; - case 225: - ts.Debug.assert(importVariableName !== ""); - increaseIndent(); - if (importNode.exportClause) { - for (var _c = 0, _d = importNode.exportClause.elements; _c < _d.length; _c++) { - var e = _d[_c]; + else { writeLine(); - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(e.name); - write("\", " + parameterName + "[\""); - emitNodeWithoutSourceMap(e.propertyName || e.name); - write("\"]);"); + write(exportStarFunction + "(" + parameterName + ");"); } - } - else { writeLine(); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - decreaseIndent(); - break; + break; + } } + decreaseIndent(); write("}"); decreaseIndent(); } @@ -27920,14 +28366,25 @@ var ts; for (var i = startIndex; i < node.statements.length; ++i) { var statement = node.statements[i]; switch (statement.kind) { - case 225: - case 219: - case 218: - case 210: + case 211: + case 220: + continue; + case 226: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportSpecifierInSystemModule(element); + } + } continue; + case 219: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + continue; + } + default: + writeLine(); + emit(statement); } - writeLine(); - emit(statement); } decreaseIndent(); writeLine(); @@ -27943,8 +28400,19 @@ var ts; write("\"" + node.moduleName + "\", "); } write("["); + var groupIndices = {}; + var dependencyGroups = []; for (var i = 0; i < externalImports.length; ++i) { var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } if (i !== 0) { write(", "); } @@ -27953,8 +28421,9 @@ var ts; write("], function(" + exportFunctionForFile + ") {"); writeLine(); increaseIndent(); + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, startIndex); + emitSystemModuleBody(node, dependencyGroups, startIndex); decreaseIndent(); writeLine(); write("});"); @@ -28012,6 +28481,7 @@ var ts; } } function emitAMDModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); @@ -28031,6 +28501,7 @@ var ts; write("});"); } function emitCommonJSModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); @@ -28039,6 +28510,7 @@ var ts; emitExportEquals(false); } function emitUMDModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); emitAMDDependencies(node, false); @@ -28058,6 +28530,7 @@ var ts; exportSpecifiers = undefined; exportEquals = undefined; hasExportStars = false; + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); emitTempDeclarations(true); @@ -28083,7 +28556,7 @@ var ts; break; } } - function trimReactWhitespace(node) { + function trimReactWhitespaceAndApplyEntities(node) { var result = undefined; var text = ts.getTextOfNode(node); var firstNonWhitespace = 0; @@ -28093,7 +28566,7 @@ var ts; if (ts.isLineBreak(c)) { if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + '" + \' \' + "' : '') + part; + result = (result ? result + "\" + ' ' + \"" : "") + part; } firstNonWhitespace = -1; } @@ -28106,15 +28579,25 @@ var ts; } if (firstNonWhitespace !== -1) { var part = text.substr(firstNonWhitespace); - result = (result ? result + '" + \' \' + "' : '') + part; + result = (result ? result + "\" + ' ' + \"" : "") + part; + } + if (result) { + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); } return result; } function getTextToEmit(node) { switch (compilerOptions.jsx) { case 2: - var text = trimReactWhitespace(node); - if (text.length === 0) { + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { return undefined; } else { @@ -28128,13 +28611,13 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2: - write('"'); - write(trimReactWhitespace(node)); - write('"'); + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); break; case 1: default: - write(ts.getTextOfNode(node, true)); + writer.writeLiteral(ts.getTextOfNode(node, true)); break; } } @@ -28143,9 +28626,9 @@ var ts; switch (compilerOptions.jsx) { case 1: default: - write('{'); + write("{"); emit(node.expression); - write('}'); + write("}"); break; case 2: emit(node.expression); @@ -28177,10 +28660,7 @@ var ts; } } } - function emitSourceFileNode(node) { - writeLine(); - emitDetachedComments(node); - var startIndex = emitDirectivePrologues(node.statements, false); + function emitEmitHelpers(node) { if (!compilerOptions.noEmitHelpers) { if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { writeLines(extendsHelper); @@ -28202,6 +28682,12 @@ var ts; awaiterEmitted = true; } } + } + function emitSourceFileNode(node) { + writeLine(); + emitShebang(); + emitDetachedComments(node); + var startIndex = emitDirectivePrologues(node.statements, false); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { if (languageVersion >= 2) { emitES6Module(node, startIndex); @@ -28224,47 +28710,63 @@ var ts; exportSpecifiers = undefined; exportEquals = undefined; hasExportStars = false; + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); emitTempDeclarations(true); } emitLeadingComments(node.endOfFileToken); } - function emitNodeWithoutSourceMap(node) { - if (!node) { - return; - } - if (node.flags & 2) { - return emitOnlyPinnedOrTripleSlashComments(node); + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2) { + return emitOnlyPinnedOrTripleSlashComments(node); + } + if (isSpecializedCommentHandling(node)) { + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } } - var emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { - emitLeadingComments(node); + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); } - emitJavaScriptWorker(node); - if (emitComments) { - emitTrailingComments(node); + } + function isSpecializedCommentHandling(node) { + switch (node.kind) { + case 213: + case 211: + case 220: + case 219: + case 214: + case 225: + return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 212: - case 210: - case 219: - case 218: - case 213: - case 224: - return false; - case 190: + case 191: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 215: + case 216: return shouldEmitModuleDeclaration(node); - case 214: + case 215: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 189 && + ts.Debug.assert(!isSpecializedCommentHandling(node)); + if (node.kind !== 190 && node.parent && - node.parent.kind === 171 && + node.parent.kind === 172 && node.parent.body === node && compilerOptions.target <= 1) { return false; @@ -28273,170 +28775,170 @@ var ts; } function emitJavaScriptWorker(node) { switch (node.kind) { - case 66: + case 67: return emitIdentifier(node); - case 135: + case 136: return emitParameter(node); + case 141: case 140: - case 139: return emitMethod(node); - case 142: case 143: + case 144: return emitAccessor(node); - case 94: + case 95: return emitThis(node); - case 92: + case 93: return emitSuper(node); - case 90: + case 91: return write("null"); - case 96: + case 97: return write("true"); - case 81: + case 82: return write("false"); - case 7: case 8: case 9: case 10: case 11: case 12: case 13: + case 14: return emitLiteral(node); - case 180: + case 181: return emitTemplateExpression(node); - case 187: + case 188: return emitTemplateSpan(node); - case 230: case 231: + case 232: return emitJsxElement(node); - case 233: + case 234: return emitJsxText(node); - case 237: + case 238: return emitJsxExpression(node); - case 132: + case 133: return emitQualifiedName(node); - case 158: - return emitObjectBindingPattern(node); case 159: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 160: - return emitBindingElement(node); + return emitArrayBindingPattern(node); case 161: - return emitArrayLiteral(node); + return emitBindingElement(node); case 162: + return emitArrayLiteral(node); + case 163: return emitObjectLiteral(node); - case 242: - return emitPropertyAssignment(node); case 243: + return emitPropertyAssignment(node); + case 244: return emitShorthandPropertyAssignment(node); - case 133: + case 134: return emitComputedPropertyName(node); - case 163: - return emitPropertyAccess(node); case 164: - return emitIndexedAccess(node); + return emitPropertyAccess(node); case 165: - return emitCallExpression(node); + return emitIndexedAccess(node); case 166: - return emitNewExpression(node); + return emitCallExpression(node); case 167: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 168: + return emitTaggedTemplateExpression(node); + case 169: return emit(node.expression); - case 186: + case 187: return emit(node.expression); - case 169: - return emitParenExpression(node); - case 210: case 170: + return emitParenExpression(node); + case 211: case 171: - return emitFunctionDeclaration(node); case 172: - return emitDeleteExpression(node); + return emitFunctionDeclaration(node); case 173: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 174: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 175: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 176: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 177: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 178: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 179: + return emitBinaryExpression(node); + case 180: return emitConditionalExpression(node); - case 182: + case 183: return emitSpreadElementExpression(node); - case 181: + case 182: return emitYieldExpression(node); - case 184: + case 185: return; - case 189: - case 216: - return emitBlock(node); case 190: - return emitVariableStatement(node); + case 217: + return emitBlock(node); case 191: - return write(";"); + return emitVariableStatement(node); case 192: - return emitExpressionStatement(node); + return write(";"); case 193: - return emitIfStatement(node); + return emitExpressionStatement(node); case 194: - return emitDoStatement(node); + return emitIfStatement(node); case 195: - return emitWhileStatement(node); + return emitDoStatement(node); case 196: + return emitWhileStatement(node); + case 197: return emitForStatement(node); + case 199: case 198: - case 197: return emitForInOrForOfStatement(node); - case 199: case 200: - return emitBreakOrContinueStatement(node); case 201: - return emitReturnStatement(node); + return emitBreakOrContinueStatement(node); case 202: - return emitWithStatement(node); + return emitReturnStatement(node); case 203: + return emitWithStatement(node); + case 204: return emitSwitchStatement(node); - case 238: case 239: + case 240: return emitCaseOrDefaultClause(node); - case 204: - return emitLabelledStatement(node); case 205: - return emitThrowStatement(node); + return emitLabelledStatement(node); case 206: + return emitThrowStatement(node); + case 207: return emitTryStatement(node); - case 241: + case 242: return emitCatchClause(node); - case 207: - return emitDebuggerStatement(node); case 208: + return emitDebuggerStatement(node); + case 209: return emitVariableDeclaration(node); - case 183: + case 184: return emitClassExpression(node); - case 211: - return emitClassDeclaration(node); case 212: + return emitClassDeclaration(node); + case 213: return emitInterfaceDeclaration(node); - case 214: + case 215: return emitEnumDeclaration(node); - case 244: + case 245: return emitEnumMember(node); - case 215: + case 216: return emitModuleDeclaration(node); - case 219: + case 220: return emitImportDeclaration(node); - case 218: + case 219: return emitImportEqualsDeclaration(node); - case 225: + case 226: return emitExportDeclaration(node); - case 224: + case 225: return emitExportAssignment(node); - case 245: + case 246: return emitSourceFileNode(node); } } @@ -28464,7 +28966,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 245 || node.pos !== node.parent.pos) { + if (node.parent.kind === 246 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -28476,7 +28978,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 245 || node.end !== node.parent.end) { + if (node.parent.kind === 246 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -28496,6 +28998,10 @@ var ts; var trailingComments = filterComments(getTrailingCommentsToEmit(node), compilerOptions.removeComments); ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } + function emitTrailingCommentsOfPosition(pos) { + var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), compilerOptions.removeComments); + ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); + } function emitLeadingCommentsOfPosition(pos) { var leadingComments; if (hasDetachedComments(pos)) { @@ -28541,6 +29047,12 @@ var ts; } } } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } function isPinnedOrTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; @@ -28561,6 +29073,261 @@ var ts; } } ts.emitFiles = emitFiles; + var entities = { + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }; })(ts || (ts = {})); /// /// @@ -28570,7 +29337,8 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.3"; + var emptyArray = []; + ts.version = "1.6.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -28587,6 +29355,49 @@ var ts; return undefined; } ts.findConfigFile = findConfigFile; + function resolveTripleslashReference(moduleName, containingFile) { + var basePath = ts.getDirectoryPath(containingFile); + var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName); + return ts.normalizePath(referencedFileName); + } + ts.resolveTripleslashReference = resolveTripleslashReference; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + return legacyNameResolver(moduleName, containingFile, compilerOptions, host); + } + ts.resolveModuleName = resolveModuleName; + function legacyNameResolver(moduleName, containingFile, compilerOptions, host) { + if (moduleName.indexOf('!') != -1) { + return { resolvedFileName: undefined, failedLookupLocations: [] }; + } + var searchPath = ts.getDirectoryPath(containingFile); + var searchName; + var failedLookupLocations = []; + var referencedSourceFile; + while (true) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + if (extension === ".tsx" && !compilerOptions.jsx) { + return undefined; + } + var candidate = searchName + extension; + if (host.fileExists(candidate)) { + return candidate; + } + else { + failedLookupLocations.push(candidate); + } + }); + if (referencedSourceFile) { + break; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations }; + } function createCompilerHost(options, setParentNodes) { var currentDirectory; var existingDirectories = {}; @@ -28649,7 +29460,9 @@ var ts; getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return newLine; } + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, + readFile: function (fileName) { return ts.sys.readFile(fileName); } }; } ts.createCompilerHost = createCompilerHost; @@ -28684,7 +29497,7 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; - function createProgram(rootNames, options, host) { + function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; var diagnostics = ts.createDiagnosticCollection(); @@ -28695,14 +29508,30 @@ var ts; var skipDefaultLib = options.noLib; var start = new Date().getTime(); host = host || createCompilerHost(options); + var resolveModuleNamesWorker = host.resolveModuleNames || + (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); }); var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); }); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); - if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (oldProgram) { + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx)) { + oldProgram = undefined; + } + } + if (!tryReuseStructureFromOldProgram()) { + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + if (!skipDefaultLib) { + processRootFile(host.getDefaultLibFileName(options), true); + } } verifyCompilerOptions(); + oldProgram = undefined; ts.programTime += new Date().getTime() - start; program = { + getRootFileNames: function () { return rootNames; }, getSourceFile: getSourceFile, getSourceFiles: function () { return files; }, getCompilerOptions: function () { return options; }, @@ -28734,6 +29563,58 @@ var ts; } return classifiableNames; } + function tryReuseStructureFromOldProgram() { + if (!oldProgram) { + return false; + } + ts.Debug.assert(!oldProgram.structureIsReused); + var oldRootNames = oldProgram.getRootFileNames(); + if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { + return false; + } + var newSourceFiles = []; + for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { + var oldSourceFile = _a[_i]; + var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + if (!newSourceFile) { + return false; + } + if (oldSourceFile !== newSourceFile) { + if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { + return false; + } + collectExternalModuleReferences(newSourceFile); + if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { + return false; + } + if (resolveModuleNamesWorker) { + var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); + for (var i = 0; i < moduleNames.length; ++i) { + var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]); + if (oldResolution !== resolutions[i]) { + return false; + } + } + } + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + } + else { + newSourceFile = oldSourceFile; + } + newSourceFiles.push(newSourceFile); + } + for (var _b = 0; _b < newSourceFiles.length; _b++) { + var file = newSourceFiles[_b]; + filesByName.set(file.fileName, file); + } + files = newSourceFiles; + oldProgram.structureIsReused = true; + return true; + } function getEmitHost(writeFileCallback) { return { getCanonicalFileName: function (fileName) { return host.getCanonicalFileName(fileName); }, @@ -28760,7 +29641,7 @@ var ts; if (options.noEmitOnError && getPreEmitDiagnostics(program, undefined, cancellationToken).length > 0) { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; @@ -28841,14 +29722,51 @@ var ts; function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib); } + function fileReferenceIsEqualTo(a, b) { + return a.fileName === b.fileName; + } + function moduleNameIsEqualTo(a, b) { + return a.text === b.text; + } + function collectExternalModuleReferences(file) { + if (file.imports) { + return; + } + var imports; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 220: + case 219: + case 226: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + break; + } + if (!moduleNameExpr.text) { + break; + } + (imports || (imports = [])).push(moduleNameExpr); + break; + case 216: + if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { + ts.forEachChild(node.body, function (node) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && + ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9) { + var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); + if (moduleName) { + (imports || (imports = [])).push(moduleName); + } + } + }); + } + break; + } + } + file.imports = imports || emptyArray; + } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var start; - var length; var diagnosticArgument; - if (refEnd !== undefined && refPos !== undefined) { - start = refPos; - length = refEnd - refPos; - } var diagnostic; if (hasExtension(fileName)) { if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { @@ -28879,15 +29797,15 @@ var ts; } } if (diagnostic) { - if (refFile) { - diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); + if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } - function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { + function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (filesByName.contains(canonicalName)) { return getSourceFileFromCache(fileName, canonicalName, false); @@ -28899,8 +29817,8 @@ var ts; return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); } var file = 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)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, 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)); @@ -28910,11 +29828,11 @@ var ts; if (file) { skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; filesByName.set(canonicalAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - var basePath = ts.getDirectoryPath(fileName); processReferencedFiles(file, basePath); - processImportedModules(file, basePath); } + processImportedModules(file, basePath); if (isDefaultLib) { file.isDefaultLib = true; files.unshift(file); @@ -28930,7 +29848,12 @@ var ts; 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)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } + else { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } } } return file; @@ -28938,49 +29861,30 @@ var ts; } 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); + var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); + processSourceFile(referencedFileName, false, file, ref.pos, ref.end); }); } function processImportedModules(file, basePath) { - ts.forEach(file.statements, function (node) { - if (node.kind === 219 || node.kind === 218 || node.kind === 225) { - var moduleNameExpr = ts.getExternalModuleName(node); - if (moduleNameExpr && moduleNameExpr.kind === 8) { - var moduleNameText = moduleNameExpr.text; - if (moduleNameText) { - var searchPath = basePath; - var searchName; - while (true) { - searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { - break; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } - } + collectExternalModuleReferences(file); + if (file.imports.length) { + file.resolvedModules = {}; + var moduleNames = ts.map(file.imports, function (name) { return name.text; }); + var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); + for (var i = 0; i < file.imports.length; ++i) { + var resolution = resolutions[i]; + ts.setResolvedModuleName(file, moduleNames[i], resolution); + if (resolution && !options.noResolve) { + findModuleSourceFile(resolution, file.imports[i]); } } - else if (node.kind === 215 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { - ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { - var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); - var moduleName = nameLiteral.text; - if (moduleName) { - var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); - } - } - }); - } - }); + } + else { + file.resolvedModules = undefined; + } + return; function findModuleSourceFile(fileName, nameLiteral) { - return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end); } } function computeCommonSourceDirectory(sourceFiles) { @@ -29032,28 +29936,28 @@ var ts; } function verifyCompilerOptions() { if (options.isolatedModules) { - if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_isolatedModules)); - } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + } + if (options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { @@ -29061,16 +29965,20 @@ var ts; diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } + if (options.out && options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + } 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)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } var languageVersion = options.target || 0; + var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { if (!options.module && languageVersion < 2) { @@ -29092,7 +30000,7 @@ var ts; if (options.outDir || options.sourceRoot || (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + (!outFile || firstExternalModuleSourceFile !== undefined))) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); } @@ -29104,16 +30012,22 @@ var ts; } } 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.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + } + if (options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + } + if (options.outDir) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== 2) { @@ -29244,6 +30158,12 @@ var ts; { name: "out", type: "string", + isFilePath: false, + paramType: ts.Diagnostics.FILE + }, + { + name: "outFile", + type: "string", isFilePath: true, description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, paramType: ts.Diagnostics.FILE @@ -29446,7 +30366,7 @@ var ts; } ts.parseCommandLine = parseCommandLine; function readConfigFile(fileName) { - var text = ''; + var text = ""; try { text = ts.sys.readFile(fileName); } @@ -29519,6 +30439,9 @@ var ts; if (json["files"] instanceof Array) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); + } } else { var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; @@ -29553,7 +30476,7 @@ var ts; function validateLocaleAndSetLanguage(locale, errors) { var matchResult = /^([a-z]+)([_\-]([a-z]+))?$/.exec(locale.toLowerCase()); if (!matchResult) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, 'en', 'ja-jp')); + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp")); return false; } var language = matchResult[1]; @@ -29576,7 +30499,7 @@ var ts; if (!ts.sys.fileExists(filePath)) { return false; } - var fileContents = ''; + var fileContents = ""; try { fileContents = ts.sys.readFile(filePath); } @@ -29823,16 +30746,15 @@ var ts; } return { program: program, exitStatus: exitStatus }; function compileProgram() { - var diagnostics = program.getSyntacticDiagnostics(); - reportDiagnostics(diagnostics); + var diagnostics; + diagnostics = program.getSyntacticDiagnostics(); if (diagnostics.length === 0) { - var diagnostics_1 = program.getGlobalDiagnostics(); - reportDiagnostics(diagnostics_1); - if (diagnostics_1.length === 0) { - var diagnostics_2 = program.getSemanticDiagnostics(); - reportDiagnostics(diagnostics_2); + diagnostics = program.getOptionsDiagnostics().concat(program.getGlobalDiagnostics()); + if (diagnostics.length === 0) { + diagnostics = program.getSemanticDiagnostics(); } } + reportDiagnostics(diagnostics); if (compilerOptions.noEmit) { return diagnostics.length ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped diff --git a/lib/tsserver.js b/lib/tsserver.js index 9d582485e2ff8..6fdd0b20f394c 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -57,6 +57,7 @@ var ts; set: set, contains: contains, remove: remove, + clear: clear, forEachValue: forEachValueInMap }; function set(fileName, value) { @@ -78,6 +79,9 @@ var ts; function normalizeKey(key) { return getCanonicalFileName(normalizeSlashes(key)); } + function clear() { + files = {}; + } } ts.createFileMap = createFileMap; function forEach(array, callback) { @@ -495,7 +499,7 @@ var ts; if (path.lastIndexOf("file:///", 0) === 0) { return "file:///".length; } - var idx = path.indexOf('://'); + var idx = path.indexOf("://"); if (idx !== -1) { return idx + "://".length; } @@ -649,7 +653,7 @@ var ts; return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; } ts.fileExtensionIs = fileExtensionIs; - ts.supportedExtensions = [".tsx", ".ts", ".d.ts"]; + ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { @@ -864,7 +868,7 @@ var ts; function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); - var _os = require('os'); + var _os = require("os"); var platform = _os.platform(); var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName, encoding) { @@ -892,7 +896,7 @@ var ts; } function writeFile(fileName, data, writeByteOrderMark) { if (writeByteOrderMark) { - data = '\uFEFF' + data; + data = "\uFEFF" + data; } _fs.writeFileSync(fileName, data, "utf8"); } @@ -933,7 +937,7 @@ var ts; newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { - var buffer = new Buffer(s, 'utf8'); + var buffer = new Buffer(s, "utf8"); var offset = 0; var toWrite = buffer.length; var written = 0; @@ -955,7 +959,6 @@ var ts; } callback(fileName); } - ; }, resolvePath: function (path) { return _path.resolve(path); @@ -992,7 +995,7 @@ var ts; if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } - else if (typeof module !== "undefined" && module.exports) { + else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { return getNodeSystem(); } else { @@ -1255,6 +1258,7 @@ var ts; Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, @@ -1294,7 +1298,7 @@ var ts; Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." }, Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: "Duplicate function implementation." }, Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, @@ -1425,6 +1429,8 @@ var ts; JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The global type 'JSX.{0}' may not have more than one property" }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, + A_member_initializer_in_a_const_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_const_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a 'const' enum declaration cannot reference members declared after it, including members defined in other 'const' enums." }, + Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1504,20 +1510,11 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, - Option_sourceMap_cannot_be_specified_with_option_isolatedModules: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'isolatedModules'." }, - Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." }, - Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." }, - Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, - Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, - Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, - Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, + Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, + Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1568,7 +1565,6 @@ var ts; Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, - Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, @@ -1613,7 +1609,8 @@ var ts; JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, - Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." } + Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } }; })(ts || (ts = {})); /// @@ -1621,123 +1618,123 @@ var ts; var ts; (function (ts) { var textToToken = { - "abstract": 112, - "any": 114, - "as": 113, - "boolean": 117, - "break": 67, - "case": 68, - "catch": 69, - "class": 70, - "continue": 72, - "const": 71, - "constructor": 118, - "debugger": 73, - "declare": 119, - "default": 74, - "delete": 75, - "do": 76, - "else": 77, - "enum": 78, - "export": 79, - "extends": 80, - "false": 81, - "finally": 82, - "for": 83, - "from": 130, - "function": 84, - "get": 120, - "if": 85, - "implements": 103, - "import": 86, - "in": 87, - "instanceof": 88, - "interface": 104, - "is": 121, - "let": 105, - "module": 122, - "namespace": 123, - "new": 89, - "null": 90, - "number": 125, - "package": 106, - "private": 107, - "protected": 108, - "public": 109, - "require": 124, - "return": 91, - "set": 126, - "static": 110, - "string": 127, - "super": 92, - "switch": 93, - "symbol": 128, - "this": 94, - "throw": 95, - "true": 96, - "try": 97, - "type": 129, - "typeof": 98, - "var": 99, - "void": 100, - "while": 101, - "with": 102, - "yield": 111, - "async": 115, - "await": 116, - "of": 131, - "{": 14, - "}": 15, - "(": 16, - ")": 17, - "[": 18, - "]": 19, - ".": 20, - "...": 21, - ";": 22, - ",": 23, - "<": 24, - ">": 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, - "=": 54, - "+=": 55, - "-=": 56, - "*=": 57, - "/=": 58, - "%=": 59, - "<<=": 60, - ">>=": 61, - ">>>=": 62, - "&=": 63, - "|=": 64, - "^=": 65, - "@": 53 + "abstract": 113, + "any": 115, + "as": 114, + "boolean": 118, + "break": 68, + "case": 69, + "catch": 70, + "class": 71, + "continue": 73, + "const": 72, + "constructor": 119, + "debugger": 74, + "declare": 120, + "default": 75, + "delete": 76, + "do": 77, + "else": 78, + "enum": 79, + "export": 80, + "extends": 81, + "false": 82, + "finally": 83, + "for": 84, + "from": 131, + "function": 85, + "get": 121, + "if": 86, + "implements": 104, + "import": 87, + "in": 88, + "instanceof": 89, + "interface": 105, + "is": 122, + "let": 106, + "module": 123, + "namespace": 124, + "new": 90, + "null": 91, + "number": 126, + "package": 107, + "private": 108, + "protected": 109, + "public": 110, + "require": 125, + "return": 92, + "set": 127, + "static": 111, + "string": 128, + "super": 93, + "switch": 94, + "symbol": 129, + "this": 95, + "throw": 96, + "true": 97, + "try": 98, + "type": 130, + "typeof": 99, + "var": 100, + "void": 101, + "while": 102, + "with": 103, + "yield": 112, + "async": 116, + "await": 117, + "of": 132, + "{": 15, + "}": 16, + "(": 17, + ")": 18, + "[": 19, + "]": 20, + ".": 21, + "...": 22, + ";": 23, + ",": 24, + "<": 25, + ">": 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, + "=": 55, + "+=": 56, + "-=": 57, + "*=": 58, + "/=": 59, + "%=": 60, + "<<=": 61, + ">>=": 62, + ">>>=": 63, + "&=": 64, + "|=": 65, + "^=": 66, + "@": 54 }; 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,]; @@ -1838,6 +1835,7 @@ var ts; var lineNumber = ts.binarySearch(lineStarts, position); if (lineNumber < 0) { lineNumber = ~lineNumber - 1; + ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); } return { line: lineNumber, @@ -1903,6 +1901,8 @@ var ts; case 61: case 62: return true; + case 35: + return pos === 0; default: return ch > 127; } @@ -1959,6 +1959,12 @@ var ts; continue; } break; + case 35: + if (pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + continue; + } + break; default: if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { pos++; @@ -2010,6 +2016,16 @@ var ts; } return pos; } + var shebangTriviaRegex = /^#!.*/; + function isShebangTrivia(text, pos) { + ts.Debug.assert(pos === 0); + return shebangTriviaRegex.test(text); + } + function scanShebangTrivia(text, pos) { + var shebang = shebangTriviaRegex.exec(text)[0]; + pos = pos + shebang.length; + return pos; + } function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; @@ -2091,6 +2107,12 @@ var ts; return getCommentRanges(text, pos, true); } ts.getTrailingCommentRanges = getTrailingCommentRanges; + function getShebang(text) { + return shebangTriviaRegex.test(text) + ? shebangTriviaRegex.exec(text)[0] + : undefined; + } + ts.getShebang = getShebang; function isIdentifierStart(ch, languageVersion) { return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || @@ -2124,8 +2146,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 66 || token > 102; }, - isReservedWord: function () { return token >= 67 && token <= 102; }, + isIdentifier: function () { return token === 67 || token > 103; }, + isReservedWord: function () { return token >= 68 && token <= 103; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -2265,20 +2287,20 @@ var ts; contents += text.substring(start, pos); tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 10 : 13; + resultingToken = startedWithBacktick ? 11 : 14; break; } var currChar = text.charCodeAt(pos); if (currChar === 96) { contents += text.substring(start, pos); pos++; - resultingToken = startedWithBacktick ? 10 : 13; + resultingToken = startedWithBacktick ? 11 : 14; break; } if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) { contents += text.substring(start, pos); pos += 2; - resultingToken = startedWithBacktick ? 11 : 12; + resultingToken = startedWithBacktick ? 12 : 13; break; } if (currChar === 92) { @@ -2439,7 +2461,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 66; + return token = 67; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -2471,6 +2493,15 @@ var ts; return token = 1; } var ch = text.charCodeAt(pos); + if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } switch (ch) { case 10: case 13: @@ -2505,66 +2536,66 @@ var ts; case 33: if (text.charCodeAt(pos + 1) === 61) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 32; + return pos += 3, token = 33; } - return pos += 2, token = 30; + return pos += 2, token = 31; } - return pos++, token = 47; + return pos++, token = 48; case 34: case 39: tokenValue = scanString(); - return token = 8; + return token = 9; case 96: return token = scanTemplateAndSetTokenValue(); case 37: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 59; + return pos += 2, token = 60; } - return pos++, token = 38; + return pos++, token = 39; case 38: if (text.charCodeAt(pos + 1) === 38) { - return pos += 2, token = 49; + return pos += 2, token = 50; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 63; + return pos += 2, token = 64; } - return pos++, token = 44; + return pos++, token = 45; case 40: - return pos++, token = 16; - case 41: return pos++, token = 17; + case 41: + return pos++, token = 18; case 42: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 57; + return pos += 2, token = 58; } - return pos++, token = 36; + return pos++, token = 37; case 43: if (text.charCodeAt(pos + 1) === 43) { - return pos += 2, token = 39; + return pos += 2, token = 40; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 55; + return pos += 2, token = 56; } - return pos++, token = 34; + return pos++, token = 35; case 44: - return pos++, token = 23; + return pos++, token = 24; case 45: if (text.charCodeAt(pos + 1) === 45) { - return pos += 2, token = 40; + return pos += 2, token = 41; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 56; + return pos += 2, token = 57; } - return pos++, token = 35; + return pos++, token = 36; case 46: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); - return token = 7; + return token = 8; } if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { - return pos += 3, token = 21; + return pos += 3, token = 22; } - return pos++, token = 20; + return pos++, token = 21; case 47: if (text.charCodeAt(pos + 1) === 47) { pos += 2; @@ -2608,9 +2639,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 58; + return pos += 2, token = 59; } - return pos++, token = 37; + return pos++, token = 38; case 48: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { pos += 2; @@ -2620,7 +2651,7 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7; + return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { pos += 2; @@ -2630,7 +2661,7 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7; + return token = 8; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { pos += 2; @@ -2640,11 +2671,11 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7; + return token = 8; } if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); - return token = 7; + return token = 8; } case 49: case 50: @@ -2656,11 +2687,11 @@ var ts; case 56: case 57: tokenValue = "" + scanNumber(); - return token = 7; + return token = 8; case 58: - return pos++, token = 52; + return pos++, token = 53; case 59: - return pos++, token = 22; + return pos++, token = 23; case 60: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2668,22 +2699,22 @@ var ts; continue; } else { - return token = 6; + return token = 7; } } if (text.charCodeAt(pos + 1) === 60) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 60; + return pos += 3, token = 61; } - return pos += 2, token = 41; + return pos += 2, token = 42; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 27; + return pos += 2, token = 28; } if (text.charCodeAt(pos + 1) === 47 && languageVariant === 1) { - return pos += 2, token = 25; + return pos += 2, token = 26; } - return pos++, token = 24; + return pos++, token = 25; case 61: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2691,19 +2722,19 @@ var ts; continue; } else { - return token = 6; + return token = 7; } } if (text.charCodeAt(pos + 1) === 61) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 31; + return pos += 3, token = 32; } - return pos += 2, token = 29; + return pos += 2, token = 30; } if (text.charCodeAt(pos + 1) === 62) { - return pos += 2, token = 33; + return pos += 2, token = 34; } - return pos++, token = 54; + return pos++, token = 55; case 62: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -2711,37 +2742,37 @@ var ts; continue; } else { - return token = 6; + return token = 7; } } - return pos++, token = 26; + return pos++, token = 27; case 63: - return pos++, token = 51; + return pos++, token = 52; case 91: - return pos++, token = 18; - case 93: return pos++, token = 19; + case 93: + return pos++, token = 20; case 94: if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 65; + return pos += 2, token = 66; } - return pos++, token = 46; + return pos++, token = 47; case 123: - return pos++, token = 14; + return pos++, token = 15; case 124: if (text.charCodeAt(pos + 1) === 124) { - return pos += 2, token = 50; + return pos += 2, token = 51; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 64; + return pos += 2, token = 65; } - return pos++, token = 45; + return pos++, token = 46; case 125: - return pos++, token = 15; + return pos++, token = 16; case 126: - return pos++, token = 48; + return pos++, token = 49; case 64: - return pos++, token = 53; + return pos++, token = 54; case 92: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { @@ -2777,27 +2808,27 @@ var ts; } } function reScanGreaterToken() { - if (token === 26) { + if (token === 27) { if (text.charCodeAt(pos) === 62) { if (text.charCodeAt(pos + 1) === 62) { if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 62; + return pos += 3, token = 63; } - return pos += 2, token = 43; + return pos += 2, token = 44; } if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 61; + return pos += 2, token = 62; } - return pos++, token = 42; + return pos++, token = 43; } if (text.charCodeAt(pos) === 61) { - return pos++, token = 28; + return pos++, token = 29; } } return token; } function reScanSlashToken() { - if (token === 37 || token === 58) { + if (token === 38 || token === 59) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -2836,12 +2867,12 @@ var ts; } pos = p; tokenValue = text.substring(tokenPos, pos); - token = 9; + token = 10; } return token; } function reScanTemplateToken() { - ts.Debug.assert(token === 15, "'reScanTemplateToken' should only be called on a '}'"); + ts.Debug.assert(token === 16, "'reScanTemplateToken' should only be called on a '}'"); pos = tokenPos; return token = scanTemplateAndSetTokenValue(); } @@ -2858,14 +2889,14 @@ var ts; if (char === 60) { if (text.charCodeAt(pos + 1) === 47) { pos += 2; - return token = 25; + return token = 26; } pos++; - return token = 24; + return token = 25; } if (char === 123) { pos++; - return token = 14; + return token = 15; } while (pos < end) { pos++; @@ -2874,10 +2905,10 @@ var ts; break; } } - return token = 233; + return token = 234; } function scanJsxIdentifier() { - if (token === 66) { + if (token === 67) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); @@ -3065,6 +3096,12 @@ var ts; { name: "out", type: "string", + isFilePath: false, + paramType: ts.Diagnostics.FILE + }, + { + name: "outFile", + type: "string", isFilePath: true, description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, paramType: ts.Diagnostics.FILE @@ -3267,7 +3304,7 @@ var ts; } ts.parseCommandLine = parseCommandLine; function readConfigFile(fileName) { - var text = ''; + var text = ""; try { text = ts.sys.readFile(fileName); } @@ -3340,6 +3377,9 @@ var ts; if (json["files"] instanceof Array) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); + } } else { var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; @@ -3416,6 +3456,37 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; + function arrayIsEqualTo(arr1, arr2, comparer) { + if (!arr1 || !arr2) { + return arr1 === arr2; + } + if (arr1.length !== arr2.length) { + return false; + } + for (var i = 0; i < arr1.length; ++i) { + var equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i]; + if (!equals) { + return false; + } + } + return true; + } + ts.arrayIsEqualTo = arrayIsEqualTo; + function hasResolvedModuleName(sourceFile, moduleNameText) { + return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); + } + ts.hasResolvedModuleName = hasResolvedModuleName; + function getResolvedModuleFileName(sourceFile, moduleNameText) { + return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + } + ts.getResolvedModuleFileName = getResolvedModuleFileName; + function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) { + if (!sourceFile.resolvedModules) { + sourceFile.resolvedModules = {}; + } + sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + } + ts.setResolvedModuleName = setResolvedModuleName; function containsParseError(node) { aggregateChildData(node); return (node.parserContextFlags & 64) !== 0; @@ -3432,7 +3503,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 245) { + while (node && node.kind !== 246) { node = node.parent; } return node; @@ -3508,7 +3579,7 @@ var ts; } ts.unescapeIdentifier = unescapeIdentifier; function makeIdentifierFromModuleName(moduleName) { - return ts.getBaseFileName(moduleName).replace(/\W/g, "_"); + return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { @@ -3523,15 +3594,15 @@ var ts; return current; } switch (current.kind) { - case 245: - case 217: - case 241: - case 215: - case 196: + case 246: + case 218: + case 242: + case 216: case 197: case 198: + case 199: return current; - case 189: + case 190: if (!isFunctionLike(current.parent)) { return current; } @@ -3542,9 +3613,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 208 && + declaration.kind === 209 && declaration.parent && - declaration.parent.kind === 241; + declaration.parent.kind === 242; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3580,22 +3651,22 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 245: + case 246: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 208: - case 160: - case 211: - case 183: + case 209: + case 161: case 212: + case 184: + case 213: + case 216: case 215: - case 214: - case 244: - case 210: - case 170: + case 245: + case 211: + case 171: errorNode = node.name; break; } @@ -3617,11 +3688,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 214 && isConst(node); + return node.kind === 215 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 160 || isBindingPattern(node))) { + while (node && (node.kind === 161 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3629,14 +3700,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 208) { + if (node.kind === 209) { node = node.parent; } - if (node && node.kind === 209) { + if (node && node.kind === 210) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 190) { + if (node && node.kind === 191) { flags |= node.flags; } return flags; @@ -3651,20 +3722,18 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 192 && node.expression.kind === 8; + return node.kind === 193 && node.expression.kind === 9; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { - if (node.kind === 135 || node.kind === 134) { - return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); - } - else { - return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); - } + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); + var commentRanges = (node.kind === 136 || node.kind === 135) ? + ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : + getLeadingCommentRangesOfNode(node, sourceFileOfNode); + return ts.filter(commentRanges, isJsDocComment); function isJsDocComment(comment) { return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && @@ -3674,68 +3743,68 @@ var ts; ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (148 <= node.kind && node.kind <= 157) { + if (149 <= node.kind && node.kind <= 158) { return true; } switch (node.kind) { - case 114: - case 125: - case 127: - case 117: + case 115: + case 126: case 128: + case 118: + case 129: return true; - case 100: - return node.parent.kind !== 174; - case 8: - return node.parent.kind === 135; - case 185: + case 101: + return node.parent.kind !== 175; + case 9: + return node.parent.kind === 136; + case 186: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 66: - if (node.parent.kind === 132 && node.parent.right === node) { + case 67: + if (node.parent.kind === 133 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 163 && node.parent.name === node) { + else if (node.parent.kind === 164 && node.parent.name === node) { node = node.parent; } - case 132: - case 163: - ts.Debug.assert(node.kind === 66 || node.kind === 132 || node.kind === 163, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 133: + case 164: + ts.Debug.assert(node.kind === 67 || node.kind === 133 || node.kind === 164, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_1 = node.parent; - if (parent_1.kind === 151) { + if (parent_1.kind === 152) { return false; } - if (148 <= parent_1.kind && parent_1.kind <= 157) { + if (149 <= parent_1.kind && parent_1.kind <= 158) { return true; } switch (parent_1.kind) { - case 185: + case 186: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 134: + case 135: return node === parent_1.constraint; + case 139: case 138: - case 137: - case 135: - case 208: + case 136: + case 209: return node === parent_1.type; - case 210: - case 170: + case 211: case 171: + case 172: + case 142: case 141: case 140: - case 139: - case 142: case 143: - return node === parent_1.type; case 144: + return node === parent_1.type; case 145: case 146: + case 147: return node === parent_1.type; - case 168: + case 169: return node === parent_1.type; - case 165: case 166: - return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; case 167: + return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; + case 168: return false; } } @@ -3746,23 +3815,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201: + case 202: return visitor(node); - case 217: - case 189: - case 193: + case 218: + case 190: case 194: case 195: case 196: case 197: case 198: - case 202: + case 199: case 203: - case 238: - case 239: case 204: - case 206: - case 241: + case 239: + case 240: + case 205: + case 207: + case 242: return ts.forEachChild(node, traverse); } } @@ -3772,23 +3841,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 181: + case 182: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 214: - case 212: case 215: case 213: - case 211: - case 183: + case 216: + case 214: + case 212: + case 184: return; default: if (isFunctionLike(node)) { var name_6 = node.name; - if (name_6 && name_6.kind === 133) { + if (name_6 && name_6.kind === 134) { traverse(name_6.expression); return; } @@ -3803,14 +3872,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 160: - case 244: - case 135: - case 242: - case 138: - case 137: + case 161: + case 245: + case 136: case 243: - case 208: + case 139: + case 138: + case 244: + case 209: return true; } } @@ -3818,41 +3887,55 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 142 || node.kind === 143); + return node && (node.kind === 143 || node.kind === 144); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 211 || node.kind === 183); + return node && (node.kind === 212 || node.kind === 184); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 141: - case 170: - case 210: + case 142: case 171: + case 211: + case 172: + case 141: case 140: - case 139: - case 142: case 143: case 144: case 145: case 146: - case 149: + case 147: case 150: + case 151: return true; } } return false; } ts.isFunctionLike = isFunctionLike; + function introducesArgumentsExoticObject(node) { + switch (node.kind) { + case 141: + case 140: + case 142: + case 143: + case 144: + case 211: + case 171: + return true; + } + return false; + } + ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 189 && isFunctionLike(node.parent); + return node && node.kind === 190 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 140 && node.parent.kind === 162; + return node && node.kind === 141 && node.parent.kind === 163; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -3880,36 +3963,36 @@ var ts; return undefined; } switch (node.kind) { - case 133: + case 134: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 136: - if (node.parent.kind === 135 && isClassElement(node.parent.parent)) { + case 137: + if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 171: + case 172: if (!includeArrowFunctions) { continue; } - case 210: - case 170: - case 215: - case 138: - case 137: - case 140: + case 211: + case 171: + case 216: case 139: + case 138: case 141: + case 140: case 142: case 143: - case 214: - case 245: + case 144: + case 215: + case 246: return node; } } @@ -3921,33 +4004,33 @@ var ts; if (!node) return node; switch (node.kind) { - case 133: + case 134: if (isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 136: - if (node.parent.kind === 135 && isClassElement(node.parent.parent)) { + case 137: + if (node.parent.kind === 136 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 210: - case 170: + case 211: case 171: + case 172: if (!includeFunctions) { continue; } - case 138: - case 137: - case 140: case 139: + case 138: case 141: + case 140: case 142: case 143: + case 144: return node; } } @@ -3956,12 +4039,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 148: + case 149: return node.typeName; - case 185: + case 186: return node.expression; - case 66: - case 132: + case 67: + case 133: return node; } } @@ -3969,7 +4052,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 167) { + if (node.kind === 168) { return node.tag; } return node.expression; @@ -3977,40 +4060,40 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 211: + case 212: return true; - case 138: - return node.parent.kind === 211; - case 135: - return node.parent.body && node.parent.parent.kind === 211; - case 142: + case 139: + return node.parent.kind === 212; + case 136: + return node.parent.body && node.parent.parent.kind === 212; case 143: - case 140: - return node.body && node.parent.kind === 211; + case 144: + case 141: + return node.body && node.parent.kind === 212; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 211: + case 212: if (node.decorators) { return true; } return false; - case 138: - case 135: + case 139: + case 136: if (node.decorators) { return true; } return false; - case 142: + case 143: if (node.body && node.decorators) { return true; } return false; - case 140: - case 143: + case 141: + case 144: if (node.body && node.decorators) { return true; } @@ -4021,10 +4104,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 211: + case 212: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 140: - case 143: + case 141: + case 144: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -4036,92 +4119,92 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function isExpression(node) { switch (node.kind) { - case 94: - case 92: - case 90: - case 96: - case 81: - case 9: - case 161: + case 95: + case 93: + case 91: + case 97: + case 82: + case 10: case 162: case 163: case 164: case 165: case 166: case 167: - case 186: case 168: + case 187: case 169: case 170: - case 183: case 171: - case 174: + case 184: case 172: + case 175: case 173: - case 176: + case 174: case 177: case 178: case 179: - case 182: case 180: - case 10: - case 184: - case 230: - case 231: + case 183: case 181: + case 11: + case 185: + case 231: + case 232: + case 182: return true; - case 132: - while (node.parent.kind === 132) { + case 133: + while (node.parent.kind === 133) { node = node.parent; } - return node.parent.kind === 151; - case 66: - if (node.parent.kind === 151) { + return node.parent.kind === 152; + case 67: + if (node.parent.kind === 152) { return true; } - case 7: case 8: + case 9: var parent_2 = node.parent; switch (parent_2.kind) { - case 208: - case 135: + case 209: + case 136: + case 139: case 138: - case 137: - case 244: - case 242: - case 160: + case 245: + case 243: + case 161: return parent_2.initializer === node; - case 192: case 193: case 194: case 195: - case 201: + case 196: case 202: case 203: - case 238: - case 205: - case 203: + case 204: + case 239: + case 206: + case 204: return parent_2.expression === node; - case 196: + case 197: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 209) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 210) || forStatement.condition === node || forStatement.incrementor === node; - case 197: case 198: + case 199: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 209) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210) || forInStatement.expression === node; - case 168: - case 186: - return node === parent_2.expression; + case 169: case 187: return node === parent_2.expression; - case 133: + case 188: return node === parent_2.expression; - case 136: + case 134: + return node === parent_2.expression; + case 137: return true; - case 185: + case 186: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -4139,7 +4222,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 218 && node.moduleReference.kind === 229; + return node.kind === 219 && node.moduleReference.kind === 230; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4148,20 +4231,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 218 && node.moduleReference.kind !== 229; + return node.kind === 219 && node.moduleReference.kind !== 230; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 219) { + if (node.kind === 220) { return node.moduleSpecifier; } - if (node.kind === 218) { + if (node.kind === 219) { var reference = node.moduleReference; - if (reference.kind === 229) { + if (reference.kind === 230) { return reference.expression; } } - if (node.kind === 225) { + if (node.kind === 226) { return node.moduleSpecifier; } } @@ -4169,15 +4252,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 135: - return node.questionToken !== undefined; + case 136: + case 141: case 140: - case 139: - return node.questionToken !== undefined; + case 244: case 243: - case 242: + case 139: case 138: - case 137: return node.questionToken !== undefined; } } @@ -4185,9 +4266,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 258 && + return node.kind === 259 && node.parameters.length > 0 && - node.parameters[0].type.kind === 260; + node.parameters[0].type.kind === 261; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -4201,24 +4282,24 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 266); + return getJSDocTag(node, 267); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 265); + return getJSDocTag(node, 266); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 267); + return getJSDocTag(node, 268); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 66) { + if (parameter.name && parameter.name.kind === 67) { var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 264) { + if (t.kind === 265) { var parameterTag = t; var name_7 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_7.text === parameterName) { @@ -4237,12 +4318,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32) { - if (node.type && node.type.kind === 259) { + if (node.type && node.type.kind === 260) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 259; + return paramTag.typeExpression.type.kind === 260; } } return node.dotDotDotToken !== undefined; @@ -4251,19 +4332,19 @@ var ts; } ts.isRestParameter = isRestParameter; function isLiteralKind(kind) { - return 7 <= kind && kind <= 10; + return 8 <= kind && kind <= 11; } ts.isLiteralKind = isLiteralKind; function isTextualLiteralKind(kind) { - return kind === 8 || kind === 10; + return kind === 9 || kind === 11; } ts.isTextualLiteralKind = isTextualLiteralKind; function isTemplateLiteralKind(kind) { - return 10 <= kind && kind <= 13; + return 11 <= kind && kind <= 14; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 159 || node.kind === 158); + return !!node && (node.kind === 160 || node.kind === 159); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -4278,34 +4359,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 171: - case 160: + case 172: + case 161: + case 212: + case 184: + case 142: + case 215: + case 245: + case 228: case 211: - case 183: + case 171: + case 143: + case 221: + case 219: + case 224: + case 213: case 141: - case 214: - case 244: - case 227: - case 210: - case 170: - case 142: - case 220: - case 218: - case 223: - case 212: case 140: + case 216: + case 222: + case 136: + case 243: case 139: - case 215: - case 221: - case 135: - case 242: case 138: - case 137: - case 143: - case 243: - case 213: - case 134: - case 208: + case 144: + case 244: + case 214: + case 135: + case 209: return true; } return false; @@ -4313,25 +4394,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { + case 201: case 200: + case 208: + case 195: + case 193: + case 192: + case 198: case 199: - case 207: + case 197: case 194: - case 192: + case 205: + case 202: + case 204: + case 96: + case 207: case 191: - case 197: - case 198: case 196: - case 193: - case 204: - case 201: case 203: - case 95: - case 206: - case 190: - case 195: - case 202: - case 224: + case 225: return true; default: return false; @@ -4340,13 +4421,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 141: - case 138: - case 140: case 142: - case 143: case 139: - case 146: + case 141: + case 143: + case 144: + case 140: + case 147: return true; default: return false; @@ -4354,11 +4435,11 @@ var ts; } ts.isClassElement = isClassElement; function isDeclarationName(name) { - if (name.kind !== 66 && name.kind !== 8 && name.kind !== 7) { + if (name.kind !== 67 && name.kind !== 9 && name.kind !== 8) { return false; } var parent = name.parent; - if (parent.kind === 223 || parent.kind === 227) { + if (parent.kind === 224 || parent.kind === 228) { if (parent.propertyName) { return true; } @@ -4372,54 +4453,54 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { + case 139: case 138: - case 137: + case 141: case 140: - case 139: - case 142: case 143: - case 244: - case 242: - case 163: + case 144: + case 245: + case 243: + case 164: return parent.name === node; - case 132: + case 133: if (parent.right === node) { - while (parent.kind === 132) { + while (parent.kind === 133) { parent = parent.parent; } - return parent.kind === 151; + return parent.kind === 152; } return false; - case 160: - case 223: + case 161: + case 224: return parent.propertyName === node; - case 227: + case 228: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - return node.kind === 218 || - node.kind === 220 && !!node.name || - node.kind === 221 || - node.kind === 223 || - node.kind === 227 || - node.kind === 224 && node.expression.kind === 66; + return node.kind === 219 || + node.kind === 221 && !!node.name || + node.kind === 222 || + node.kind === 224 || + node.kind === 228 || + node.kind === 225 && node.expression.kind === 67; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 80); + var heritageClause = getHeritageClause(node.heritageClauses, 81); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 103); + var heritageClause = getHeritageClause(node.heritageClauses, 104); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 80); + var heritageClause = getHeritageClause(node.heritageClauses, 81); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -4488,11 +4569,11 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 67 <= token && token <= 131; + return 68 <= token && token <= 132; } ts.isKeyword = isKeyword; function isTrivia(token) { - return 2 <= token && token <= 6; + return 2 <= token && token <= 7; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { @@ -4501,19 +4582,19 @@ var ts; ts.isAsyncFunctionLike = isAsyncFunctionLike; function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 133 && + declaration.name.kind === 134 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { - return node.kind === 163 && isESSymbolIdentifier(node.expression); + return node.kind === 164 && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 66 || name.kind === 8 || name.kind === 7) { + if (name.kind === 67 || name.kind === 9 || name.kind === 8) { return name.text; } - if (name.kind === 133) { + if (name.kind === 134) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -4528,21 +4609,21 @@ var ts; } ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; function isESSymbolIdentifier(node) { - return node.kind === 66 && node.text === "Symbol"; + return node.kind === 67 && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 112: - case 115: - case 71: - case 119: - case 74: - case 79: - case 109: - case 107: - case 108: + case 113: + case 116: + case 72: + case 120: + case 75: + case 80: case 110: + case 108: + case 109: + case 111: return true; } return false; @@ -4550,20 +4631,36 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 135; + return root.kind === 136; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 160) { + while (node.kind === 161) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 215 || n.kind === 245; + return isFunctionLike(n) || n.kind === 216 || n.kind === 246; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; + function cloneEntityName(node) { + if (node.kind === 67) { + var clone_1 = createSynthesizedNode(67); + clone_1.text = node.text; + return clone_1; + } + else { + var clone_2 = createSynthesizedNode(133); + clone_2.left = cloneEntityName(node.left); + clone_2.left.parent = clone_2; + clone_2.right = cloneEntityName(node.right); + clone_2.right.parent = clone_2; + return clone_2; + } + } + ts.cloneEntityName = cloneEntityName; function nodeIsSynthesized(node) { return node.pos === -1; } @@ -4788,7 +4885,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 141 && nodeIsPresent(member.body)) { + if (member.kind === 142 && nodeIsPresent(member.body)) { return member; } }); @@ -4800,7 +4897,7 @@ var ts; ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; function shouldEmitToOwnFile(sourceFile, compilerOptions) { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out)) { + if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { return compilerOptions.isolatedModules || !ts.fileExtensionIs(sourceFile.fileName, ".js"); } return false; @@ -4815,10 +4912,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 142) { + if (accessor.kind === 143) { getAccessor = accessor; } - else if (accessor.kind === 143) { + else if (accessor.kind === 144) { setAccessor = accessor; } else { @@ -4827,7 +4924,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 142 || member.kind === 143) + if ((member.kind === 143 || member.kind === 144) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -4838,10 +4935,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 142 && !getAccessor) { + if (member.kind === 143 && !getAccessor) { getAccessor = member; } - if (member.kind === 143 && !setAccessor) { + if (member.kind === 144 && !setAccessor) { setAccessor = member; } } @@ -4920,7 +5017,7 @@ var ts; } function writeTrimmedCurrentLine(pos, nextLineStart) { var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); + var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); if (currentLineText) { writer.write(currentLineText); if (end !== comment.end) { @@ -4947,16 +5044,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 110: return 128; - case 109: return 16; - case 108: return 64; - case 107: return 32; - case 112: return 256; - case 79: return 1; - case 119: return 2; - case 71: return 32768; - case 74: return 1024; - case 115: return 512; + case 111: return 128; + case 110: return 16; + case 109: return 64; + case 108: return 32; + case 113: return 256; + case 80: return 1; + case 120: return 2; + case 72: return 32768; + case 75: return 1024; + case 116: return 512; } return 0; } @@ -4964,29 +5061,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 163: case 164: - case 166: case 165: - case 230: - case 231: case 167: - case 161: - case 169: + case 166: + case 231: + case 232: + case 168: case 162: - case 183: case 170: - case 66: - case 9: - case 7: - case 8: + case 163: + case 184: + case 171: + case 67: case 10: - case 180: - case 81: - case 90: - case 94: - case 96: - case 92: + case 8: + case 9: + case 11: + case 181: + case 82: + case 91: + case 95: + case 97: + case 93: return true; } } @@ -4994,12 +5091,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 54 && token <= 65; + return token >= 55 && token <= 66; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 185 && - node.parent.token === 80 && + return node.kind === 186 && + node.parent.token === 81 && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -5008,10 +5105,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 66) { + if (node.kind === 67) { return true; } - else if (node.kind === 163) { + else if (node.kind === 164) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -5019,10 +5116,21 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 132 && node.parent.right === node) || - (node.parent.kind === 163 && node.parent.name === node); + return (node.parent.kind === 133 && node.parent.right === node) || + (node.parent.kind === 164 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function isEmptyObjectLiteralOrArrayLiteral(expression) { + var kind = expression.kind; + if (kind === 163) { + return expression.properties.length === 0; + } + if (kind === 162) { + return expression.elements.length === 0; + } + return false; + } + ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024) ? symbol.valueDeclaration.localSymbol : undefined; } @@ -5226,9 +5334,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 134) { + if (d && d.kind === 135) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 212) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213) { return current; } } @@ -5240,7 +5348,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(269); + var nodeConstructors = new Array(270); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5278,20 +5386,20 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 132: + case 133: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 134: + case 135: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 135: + case 136: + case 139: case 138: - case 137: - case 242: case 243: - case 208: - case 160: + case 244: + case 209: + case 161: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5300,24 +5408,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 149: case 150: - case 144: + case 151: case 145: case 146: + case 147: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 140: - case 139: case 141: + case 140: case 142: case 143: - case 170: - case 210: + case 144: case 171: + case 211: + case 172: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -5328,290 +5436,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 148: + case 149: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 147: + case 148: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 151: - return visitNode(cbNode, node.exprName); case 152: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 153: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 154: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 155: + return visitNodes(cbNodes, node.elementTypes); case 156: - return visitNodes(cbNodes, node.types); case 157: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); case 158: + return visitNode(cbNode, node.type); case 159: - return visitNodes(cbNodes, node.elements); - case 161: + case 160: return visitNodes(cbNodes, node.elements); case 162: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 163: + return visitNodes(cbNodes, node.properties); + case 164: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 164: + case 165: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 165: case 166: + case 167: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 167: + case 168: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 168: + case 169: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 169: - return visitNode(cbNode, node.expression); - case 172: + case 170: return visitNode(cbNode, node.expression); case 173: return visitNode(cbNode, node.expression); case 174: return visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.operand); - case 181: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); case 175: return visitNode(cbNode, node.expression); case 177: return visitNode(cbNode, node.operand); + case 182: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 176: + return visitNode(cbNode, node.expression); case 178: + return visitNode(cbNode, node.operand); + case 179: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 186: + case 187: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 179: + case 180: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 182: + case 183: return visitNode(cbNode, node.expression); - case 189: - case 216: + case 190: + case 217: return visitNodes(cbNodes, node.statements); - case 245: + case 246: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 190: + case 191: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 209: + case 210: return visitNodes(cbNodes, node.declarations); - case 192: - return visitNode(cbNode, node.expression); case 193: + return visitNode(cbNode, node.expression); + case 194: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 194: + case 195: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 195: + case 196: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 196: + case 197: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 197: + case 198: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 198: + case 199: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 199: case 200: - return visitNode(cbNode, node.label); case 201: - return visitNode(cbNode, node.expression); + return visitNode(cbNode, node.label); case 202: + return visitNode(cbNode, node.expression); + case 203: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 203: + case 204: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 217: + case 218: return visitNodes(cbNodes, node.clauses); - case 238: + case 239: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 239: + case 240: return visitNodes(cbNodes, node.statements); - case 204: + case 205: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 205: - return visitNode(cbNode, node.expression); case 206: + return visitNode(cbNode, node.expression); + case 207: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 241: + case 242: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 136: + case 137: return visitNode(cbNode, node.expression); - case 211: - case 183: + case 212: + case 184: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 212: + case 213: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 213: + case 214: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 214: + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 244: + case 245: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 215: + case 216: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 218: + case 219: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 219: + case 220: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 220: + case 221: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 221: - return visitNode(cbNode, node.name); case 222: - case 226: + return visitNode(cbNode, node.name); + case 223: + case 227: return visitNodes(cbNodes, node.elements); - case 225: + case 226: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 223: - case 227: + case 224: + case 228: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 224: + case 225: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 180: + case 181: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 187: + case 188: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 133: + case 134: return visitNode(cbNode, node.expression); - case 240: + case 241: return visitNodes(cbNodes, node.types); - case 185: + case 186: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 229: + case 230: return visitNode(cbNode, node.expression); - case 228: + case 229: return visitNodes(cbNodes, node.decorators); - case 230: + case 231: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 231: case 232: + case 233: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 235: + case 236: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 236: - return visitNode(cbNode, node.expression); case 237: return visitNode(cbNode, node.expression); - case 234: + case 238: + return visitNode(cbNode, node.expression); + case 235: return visitNode(cbNode, node.tagName); - case 246: + case 247: return visitNode(cbNode, node.type); - case 250: - return visitNodes(cbNodes, node.types); case 251: return visitNodes(cbNodes, node.types); - case 249: + case 252: + return visitNodes(cbNodes, node.types); + case 250: return visitNode(cbNode, node.elementType); - case 253: + case 254: return visitNode(cbNode, node.type); - case 252: + case 253: return visitNode(cbNode, node.type); - case 254: + case 255: return visitNodes(cbNodes, node.members); - case 256: + case 257: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 257: - return visitNode(cbNode, node.type); case 258: + return visitNode(cbNode, node.type); + case 259: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 259: - return visitNode(cbNode, node.type); case 260: return visitNode(cbNode, node.type); case 261: return visitNode(cbNode, node.type); - case 255: + case 262: + return visitNode(cbNode, node.type); + case 256: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 262: + case 263: return visitNodes(cbNodes, node.tags); - case 264: + case 265: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 265: - return visitNode(cbNode, node.typeExpression); case 266: return visitNode(cbNode, node.typeExpression); case 267: + return visitNode(cbNode, node.typeExpression); + case 268: return visitNodes(cbNodes, node.typeParameters); } } @@ -5707,9 +5815,9 @@ var ts; return; function visit(node) { switch (node.kind) { - case 190: - case 210: - case 135: + case 191: + case 211: + case 136: addJSDocComment(node); } forEachChild(node, visit); @@ -5747,7 +5855,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(245, 0); + var sourceFile = createNode(246, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -5880,6 +5988,9 @@ var ts; function scanJsxIdentifier() { return token = scanner.scanJsxIdentifier(); } + function scanJsxText() { + return token = scanner.scanJsxToken(); + } function speculationHelper(callback, isLookAhead) { var saveToken = token; var saveParseDiagnosticsLength = parseDiagnostics.length; @@ -5903,20 +6014,23 @@ var ts; return speculationHelper(callback, false); } function isIdentifier() { - if (token === 66) { + if (token === 67) { return true; } - if (token === 111 && inYieldContext()) { + if (token === 112 && inYieldContext()) { return false; } - if (token === 116 && inAwaitContext()) { + if (token === 117 && inAwaitContext()) { return false; } - return token > 102; + return token > 103; } - function parseExpected(kind, diagnosticMessage) { + function parseExpected(kind, diagnosticMessage, shouldAdvance) { + if (shouldAdvance === void 0) { shouldAdvance = true; } if (token === kind) { - nextToken(); + if (shouldAdvance) { + nextToken(); + } return true; } if (diagnosticMessage) { @@ -5950,20 +6064,20 @@ var ts; return finishNode(node); } function canParseSemicolon() { - if (token === 22) { + if (token === 23) { return true; } - return token === 15 || token === 1 || scanner.hasPrecedingLineBreak(); + return token === 16 || token === 1 || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 22) { + if (token === 23) { nextToken(); } return true; } else { - return parseExpected(22); + return parseExpected(23); } } function createNode(kind, pos) { @@ -6005,15 +6119,15 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(66); - if (token !== 66) { + var node = createNode(67); + if (token !== 67) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(66, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(67, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -6023,14 +6137,14 @@ var ts; } function isLiteralPropertyName() { return isIdentifierOrKeyword() || - token === 8 || - token === 7; + token === 9 || + token === 8; } function parsePropertyNameWorker(allowComputedPropertyNames) { - if (token === 8 || token === 7) { + if (token === 9 || token === 8) { return parseLiteralNode(true); } - if (allowComputedPropertyNames && token === 18) { + if (allowComputedPropertyNames && token === 19) { return parseComputedPropertyName(); } return parseIdentifierName(); @@ -6042,30 +6156,30 @@ var ts; return parsePropertyNameWorker(false); } function isSimplePropertyName() { - return token === 8 || token === 7 || isIdentifierOrKeyword(); + return token === 9 || token === 8 || isIdentifierOrKeyword(); } function parseComputedPropertyName() { - var node = createNode(133); - parseExpected(18); - node.expression = allowInAnd(parseExpression); + var node = createNode(134); parseExpected(19); + node.expression = allowInAnd(parseExpression); + parseExpected(20); return finishNode(node); } function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 71) { - return nextToken() === 78; + if (token === 72) { + return nextToken() === 79; } - if (token === 79) { + if (token === 80) { nextToken(); - if (token === 74) { + if (token === 75) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 36 && token !== 14 && canFollowModifier(); + return token !== 37 && token !== 15 && canFollowModifier(); } - if (token === 74) { + if (token === 75) { return nextTokenIsClassOrFunction(); } nextToken(); @@ -6075,14 +6189,14 @@ var ts; return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { - return token === 18 - || token === 14 - || token === 36 + return token === 19 + || token === 15 + || token === 37 || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); - return token === 70 || token === 84; + return token === 71 || token === 85; } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -6093,21 +6207,21 @@ var ts; case 0: case 1: case 3: - return !(token === 22 && inErrorRecovery) && isStartOfStatement(); + return !(token === 23 && inErrorRecovery) && isStartOfStatement(); case 2: - return token === 68 || token === 74; + return token === 69 || token === 75; case 4: return isStartOfTypeMember(); case 5: - return lookAhead(isClassMemberStart) || (token === 22 && !inErrorRecovery); + return lookAhead(isClassMemberStart) || (token === 23 && !inErrorRecovery); case 6: - return token === 18 || isLiteralPropertyName(); + return token === 19 || isLiteralPropertyName(); case 12: - return token === 18 || token === 36 || isLiteralPropertyName(); + return token === 19 || token === 37 || isLiteralPropertyName(); case 9: return isLiteralPropertyName(); case 7: - if (token === 14) { + if (token === 15) { return lookAhead(isValidHeritageClauseObjectLiteral); } if (!inErrorRecovery) { @@ -6119,23 +6233,23 @@ var ts; case 8: return isIdentifierOrPattern(); case 10: - return token === 23 || token === 21 || isIdentifierOrPattern(); + return token === 24 || token === 22 || isIdentifierOrPattern(); case 17: return isIdentifier(); case 11: case 15: - return token === 23 || token === 21 || isStartOfExpression(); + return token === 24 || token === 22 || isStartOfExpression(); case 16: return isStartOfParameter(); case 18: case 19: - return token === 23 || isStartOfType(); + return token === 24 || isStartOfType(); case 20: return isHeritageClause(); case 21: return isIdentifierOrKeyword(); case 13: - return isIdentifierOrKeyword() || token === 14; + return isIdentifierOrKeyword() || token === 15; case 14: return true; case 22: @@ -6148,10 +6262,10 @@ var ts; ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } function isValidHeritageClauseObjectLiteral() { - ts.Debug.assert(token === 14); - if (nextToken() === 15) { + ts.Debug.assert(token === 15); + if (nextToken() === 16) { var next = nextToken(); - return next === 23 || next === 14 || next === 80 || next === 103; + return next === 24 || next === 15 || next === 81 || next === 104; } return true; } @@ -6164,8 +6278,8 @@ var ts; return isIdentifierOrKeyword(); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 103 || - token === 80) { + if (token === 104 || + token === 81) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -6187,39 +6301,39 @@ var ts; case 12: case 9: case 21: - return token === 15; + return token === 16; case 3: - return token === 15 || token === 68 || token === 74; + return token === 16 || token === 69 || token === 75; case 7: - return token === 14 || token === 80 || token === 103; + return token === 15 || token === 81 || token === 104; case 8: return isVariableDeclaratorListTerminator(); case 17: - return token === 26 || token === 16 || token === 14 || token === 80 || token === 103; + return token === 27 || token === 17 || token === 15 || token === 81 || token === 104; case 11: - return token === 17 || token === 22; + return token === 18 || token === 23; case 15: case 19: case 10: - return token === 19; + return token === 20; case 16: - return token === 17 || token === 19; + return token === 18 || token === 20; case 18: - return token === 26 || token === 16; + return token === 27 || token === 17; case 20: - return token === 14 || token === 15; + return token === 15 || token === 16; case 13: - return token === 26 || token === 37; + return token === 27 || token === 38; case 14: - return token === 24 && lookAhead(nextTokenIsSlash); + return token === 25 && lookAhead(nextTokenIsSlash); case 22: - return token === 17 || token === 52 || token === 15; + return token === 18 || token === 53 || token === 16; case 23: - return token === 26 || token === 15; + return token === 27 || token === 16; case 25: - return token === 19 || token === 15; + return token === 20 || token === 16; case 24: - return token === 15; + return token === 16; } } function isVariableDeclaratorListTerminator() { @@ -6229,7 +6343,7 @@ var ts; if (isInOrOfKeyword(token)) { return true; } - if (token === 33) { + if (token === 34) { return true; } return false; @@ -6334,17 +6448,17 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 141: - case 146: case 142: + case 147: case 143: - case 138: - case 188: + case 144: + case 139: + case 189: return true; - case 140: + case 141: var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 66 && - methodDeclaration.name.originalKeywordKind === 118; + var nameIsConstructor = methodDeclaration.name.kind === 67 && + methodDeclaration.name.originalKeywordKind === 119; return !nameIsConstructor; } } @@ -6353,8 +6467,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 238: case 239: + case 240: return true; } } @@ -6363,65 +6477,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 210: + case 211: + case 191: case 190: - case 189: + case 194: case 193: - case 192: - case 205: + case 206: + case 202: + case 204: case 201: - case 203: case 200: + case 198: case 199: case 197: - case 198: case 196: - case 195: - case 202: - case 191: - case 206: - case 204: - case 194: + case 203: + case 192: case 207: + case 205: + case 195: + case 208: + case 220: case 219: - case 218: + case 226: case 225: - case 224: - case 215: - case 211: + case 216: case 212: - case 214: case 213: + case 215: + case 214: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 244; + return node.kind === 245; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 145: - case 139: case 146: - case 137: - case 144: + case 140: + case 147: + case 138: + case 145: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 208) { + if (node.kind !== 209) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 135) { + if (node.kind !== 136) { return false; } var parameter = node; @@ -6476,15 +6590,15 @@ var ts; if (isListElement(kind, false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); - if (parseOptional(23)) { + if (parseOptional(24)) { continue; } commaStart = -1; if (isListTerminator(kind)) { break; } - parseExpected(23); - if (considerSemicolonAsDelimeter && token === 22 && !scanner.hasPrecedingLineBreak()) { + parseExpected(24); + if (considerSemicolonAsDelimeter && token === 23 && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -6520,8 +6634,8 @@ var ts; } function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); - while (parseOptional(20)) { - var node = createNode(132, entity.pos); + while (parseOptional(21)) { + var node = createNode(133, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -6532,34 +6646,34 @@ var ts; if (scanner.hasPrecedingLineBreak() && isIdentifierOrKeyword()) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { - return createMissingNode(66, true, ts.Diagnostics.Identifier_expected); + return createMissingNode(67, true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(180); + var template = createNode(181); template.head = parseLiteralNode(); - ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); + ts.Debug.assert(template.head.kind === 12, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); do { templateSpans.push(parseTemplateSpan()); - } while (ts.lastOrUndefined(templateSpans).literal.kind === 12); + } while (ts.lastOrUndefined(templateSpans).literal.kind === 13); templateSpans.end = getNodeEnd(); template.templateSpans = templateSpans; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(187); + var span = createNode(188); span.expression = allowInAnd(parseExpression); var literal; - if (token === 15) { + if (token === 16) { reScanTemplateToken(); literal = parseLiteralNode(); } else { - literal = parseExpectedToken(13, false, ts.Diagnostics._0_expected, ts.tokenToString(15)); + literal = parseExpectedToken(14, false, ts.Diagnostics._0_expected, ts.tokenToString(16)); } span.literal = literal; return finishNode(span); @@ -6577,7 +6691,7 @@ var ts; var tokenPos = scanner.getTokenPos(); nextToken(); finishNode(node); - if (node.kind === 7 + if (node.kind === 8 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 65536; @@ -6586,30 +6700,30 @@ var ts; } function parseTypeReferenceOrTypePredicate() { var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 66 && token === 121 && !scanner.hasPrecedingLineBreak()) { + if (typeName.kind === 67 && token === 122 && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(147, typeName.pos); + var node_1 = createNode(148, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(148, typeName.pos); + var node = createNode(149, typeName.pos); node.typeName = typeName; - if (!scanner.hasPrecedingLineBreak() && token === 24) { - node.typeArguments = parseBracketedList(18, parseType, 24, 26); + if (!scanner.hasPrecedingLineBreak() && token === 25) { + node.typeArguments = parseBracketedList(18, parseType, 25, 27); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(151); - parseExpected(98); + var node = createNode(152); + parseExpected(99); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(134); + var node = createNode(135); node.name = parseIdentifier(); - if (parseOptional(80)) { + if (parseOptional(81)) { if (isStartOfType() || !isStartOfExpression()) { node.constraint = parseType(); } @@ -6620,20 +6734,20 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 24) { - return parseBracketedList(17, parseTypeParameter, 24, 26); + if (token === 25) { + return parseBracketedList(17, parseTypeParameter, 25, 27); } } function parseParameterType() { - if (parseOptional(52)) { - return token === 8 + if (parseOptional(53)) { + return token === 9 ? parseLiteralNode(true) : parseType(); } return undefined; } function isStartOfParameter() { - return token === 21 || isIdentifierOrPattern() || ts.isModifier(token) || token === 53; + return token === 22 || isIdentifierOrPattern() || ts.isModifier(token) || token === 54; } function setModifiers(node, modifiers) { if (modifiers) { @@ -6642,15 +6756,15 @@ var ts; } } function parseParameter() { - var node = createNode(135); + var node = createNode(136); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); - node.dotDotDotToken = parseOptionalToken(21); + node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { nextToken(); } - node.questionToken = parseOptionalToken(51); + node.questionToken = parseOptionalToken(52); node.type = parseParameterType(); node.initializer = parseBindingElementInitializer(true); return finishNode(node); @@ -6662,7 +6776,7 @@ var ts; return parseInitializer(true); } function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) { - var returnTokenRequired = returnToken === 33; + var returnTokenRequired = returnToken === 34; signature.typeParameters = parseTypeParameters(); signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { @@ -6674,7 +6788,7 @@ var ts; } } function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) { - if (parseExpected(16)) { + if (parseExpected(17)) { var savedYieldContext = inYieldContext(); var savedAwaitContext = inAwaitContext(); setYieldContext(yieldContext); @@ -6682,7 +6796,7 @@ var ts; var result = parseDelimitedList(16, parseParameter); setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); - if (!parseExpected(17) && requireCompleteParameterList) { + if (!parseExpected(18) && requireCompleteParameterList) { return undefined; } return result; @@ -6690,29 +6804,29 @@ var ts; return requireCompleteParameterList ? undefined : createMissingList(); } function parseTypeMemberSemicolon() { - if (parseOptional(23)) { + if (parseOptional(24)) { return; } parseSemicolon(); } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 145) { - parseExpected(89); + if (kind === 146) { + parseExpected(90); } - fillSignature(52, false, false, false, node); + fillSignature(53, false, false, false, node); parseTypeMemberSemicolon(); return finishNode(node); } function isIndexSignature() { - if (token !== 18) { + if (token !== 19) { return false; } return lookAhead(isUnambiguouslyIndexSignature); } function isUnambiguouslyIndexSignature() { nextToken(); - if (token === 21 || token === 19) { + if (token === 22 || token === 20) { return true; } if (ts.isModifier(token)) { @@ -6727,20 +6841,20 @@ var ts; else { nextToken(); } - if (token === 52 || token === 23) { + if (token === 53 || token === 24) { return true; } - if (token !== 51) { + if (token !== 52) { return false; } nextToken(); - return token === 52 || token === 23 || token === 19; + return token === 53 || token === 24 || token === 20; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(146, fullStart); + var node = createNode(147, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.parameters = parseBracketedList(16, parseParameter, 18, 19); + node.parameters = parseBracketedList(16, parseParameter, 19, 20); node.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); return finishNode(node); @@ -6748,17 +6862,17 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(51); - if (token === 16 || token === 24) { - var method = createNode(139, fullStart); + var questionToken = parseOptionalToken(52); + if (token === 17 || token === 25) { + var method = createNode(140, fullStart); method.name = name; method.questionToken = questionToken; - fillSignature(52, false, false, false, method); + fillSignature(53, false, false, false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(137, fullStart); + var property = createNode(138, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -6768,9 +6882,9 @@ var ts; } function isStartOfTypeMember() { switch (token) { - case 16: - case 24: - case 18: + case 17: + case 25: + case 19: return true; default: if (ts.isModifier(token)) { @@ -6790,27 +6904,27 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || - token === 24 || - token === 51 || + return token === 17 || + token === 25 || token === 52 || + token === 53 || canParseSemicolon(); } function parseTypeMember() { switch (token) { - case 16: - case 24: - return parseSignatureMember(144); - case 18: + case 17: + case 25: + return parseSignatureMember(145); + case 19: return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); - case 89: + case 90: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(145); + return parseSignatureMember(146); } + case 9: case 8: - case 7: return parsePropertyOrMethodSignature(); default: if (ts.isModifier(token)) { @@ -6834,18 +6948,18 @@ var ts; } function isStartOfConstructSignature() { nextToken(); - return token === 16 || token === 24; + return token === 17 || token === 25; } function parseTypeLiteral() { - var node = createNode(152); + var node = createNode(153); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseObjectTypeMembers() { var members; - if (parseExpected(14)) { + if (parseExpected(15)) { members = parseList(4, parseTypeMember); - parseExpected(15); + parseExpected(16); } else { members = createMissingList(); @@ -6853,47 +6967,47 @@ var ts; return members; } function parseTupleType() { - var node = createNode(154); - node.elementTypes = parseBracketedList(19, parseType, 18, 19); + var node = createNode(155); + node.elementTypes = parseBracketedList(19, parseType, 19, 20); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(157); - parseExpected(16); - node.type = parseType(); + var node = createNode(158); parseExpected(17); + node.type = parseType(); + parseExpected(18); return finishNode(node); } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 150) { - parseExpected(89); + if (kind === 151) { + parseExpected(90); } - fillSignature(33, false, false, false, node); + fillSignature(34, false, false, false, node); return finishNode(node); } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 20 ? undefined : node; + return token === 21 ? undefined : node; } function parseNonArrayType() { switch (token) { - case 114: - case 127: - case 125: - case 117: + case 115: case 128: + case 126: + case 118: + case 129: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 100: + case 101: return parseTokenNode(); - case 98: + case 99: return parseTypeQuery(); - case 14: + case 15: return parseTypeLiteral(); - case 18: + case 19: return parseTupleType(); - case 16: + case 17: return parseParenthesizedType(); default: return parseTypeReferenceOrTypePredicate(); @@ -6901,19 +7015,19 @@ var ts; } function isStartOfType() { switch (token) { - case 114: - case 127: - case 125: - case 117: + case 115: case 128: - case 100: - case 98: - case 14: - case 18: - case 24: - case 89: + case 126: + case 118: + case 129: + case 101: + case 99: + case 15: + case 19: + case 25: + case 90: return true; - case 16: + case 17: return lookAhead(isStartOfParenthesizedOrFunctionType); default: return isIdentifier(); @@ -6921,13 +7035,13 @@ var ts; } function isStartOfParenthesizedOrFunctionType() { nextToken(); - return token === 17 || isStartOfParameter() || isStartOfType(); + return token === 18 || isStartOfParameter() || isStartOfType(); } function parseArrayTypeOrHigher() { var type = parseNonArrayType(); - while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { - parseExpected(19); - var node = createNode(153, type.pos); + while (!scanner.hasPrecedingLineBreak() && parseOptional(19)) { + parseExpected(20); + var node = createNode(154, type.pos); node.elementType = type; type = finishNode(node); } @@ -6949,32 +7063,32 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(156, parseArrayTypeOrHigher, 44); + return parseUnionOrIntersectionType(157, parseArrayTypeOrHigher, 45); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(155, parseIntersectionTypeOrHigher, 45); + return parseUnionOrIntersectionType(156, parseIntersectionTypeOrHigher, 46); } function isStartOfFunctionType() { - if (token === 24) { + if (token === 25) { return true; } - return token === 16 && lookAhead(isUnambiguouslyStartOfFunctionType); + return token === 17 && lookAhead(isUnambiguouslyStartOfFunctionType); } function isUnambiguouslyStartOfFunctionType() { nextToken(); - if (token === 17 || token === 21) { + if (token === 18 || token === 22) { return true; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 52 || token === 23 || - token === 51 || token === 54 || + if (token === 53 || token === 24 || + token === 52 || token === 55 || isIdentifier() || ts.isModifier(token)) { return true; } - if (token === 17) { + if (token === 18) { nextToken(); - if (token === 33) { + if (token === 34) { return true; } } @@ -6986,36 +7100,36 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(149); - } - if (token === 89) { return parseFunctionOrConstructorType(150); } + if (token === 90) { + return parseFunctionOrConstructorType(151); + } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(52) ? parseType() : undefined; + return parseOptional(53) ? parseType() : undefined; } function isStartOfLeftHandSideExpression() { switch (token) { - case 94: - case 92: - case 90: - case 96: - case 81: - case 7: + case 95: + case 93: + case 91: + case 97: + case 82: case 8: - case 10: + case 9: case 11: - case 16: - case 18: - case 14: - case 84: - case 70: - case 89: - case 37: - case 58: - case 66: + case 12: + case 17: + case 19: + case 15: + case 85: + case 71: + case 90: + case 38: + case 59: + case 67: return true; default: return isIdentifier(); @@ -7026,18 +7140,18 @@ var ts; return true; } switch (token) { - case 34: case 35: + case 36: + case 49: case 48: - case 47: - case 75: - case 98: - case 100: - case 39: + case 76: + case 99: + case 101: case 40: - case 24: - case 116: - case 111: + case 41: + case 25: + case 117: + case 112: return true; default: if (isBinaryOperator()) { @@ -7047,10 +7161,10 @@ var ts; } } function isStartOfExpressionStatement() { - return token !== 14 && - token !== 84 && - token !== 70 && - token !== 53 && + return token !== 15 && + token !== 85 && + token !== 71 && + token !== 54 && isStartOfExpression(); } function allowInAndParseExpression() { @@ -7066,7 +7180,7 @@ var ts; } var expr = parseAssignmentExpressionOrHigher(); var operatorToken; - while ((operatorToken = parseOptionalToken(23))) { + while ((operatorToken = parseOptionalToken(24))) { expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } if (saveDecoratorContext) { @@ -7075,12 +7189,12 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 54) { - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 14) || !isStartOfExpression()) { + if (token !== 55) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 15) || !isStartOfExpression()) { return undefined; } } - parseExpected(54); + parseExpected(55); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -7101,7 +7215,7 @@ var ts; return arrowExpression; } var expr = parseBinaryExpressionOrHigher(0); - if (expr.kind === 66 && token === 33) { + if (expr.kind === 67 && token === 34) { return parseSimpleArrowFunctionExpression(expr); } if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) { @@ -7110,7 +7224,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 111) { + if (token === 112) { if (inYieldContext()) { return true; } @@ -7123,11 +7237,11 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(181); + var node = createNode(182); nextToken(); if (!scanner.hasPrecedingLineBreak() && - (token === 36 || isStartOfExpression())) { - node.asteriskToken = parseOptionalToken(36); + (token === 37 || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(37); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -7136,15 +7250,15 @@ var ts; } } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 33, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(171, identifier.pos); - var parameter = createNode(135, identifier.pos); + ts.Debug.assert(token === 34, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(172, identifier.pos); + var parameter = createNode(136, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - node.equalsGreaterThanToken = parseExpectedToken(33, false, ts.Diagnostics._0_expected, "=>"); + node.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); node.body = parseArrowFunctionExpressionBody(false); return finishNode(node); } @@ -7161,78 +7275,78 @@ var ts; } var isAsync = !!(arrowFunction.flags & 512); var lastToken = token; - arrowFunction.equalsGreaterThanToken = parseExpectedToken(33, false, ts.Diagnostics._0_expected, "=>"); - arrowFunction.body = (lastToken === 33 || lastToken === 14) + arrowFunction.equalsGreaterThanToken = parseExpectedToken(34, false, ts.Diagnostics._0_expected, "=>"); + arrowFunction.body = (lastToken === 34 || lastToken === 15) ? parseArrowFunctionExpressionBody(isAsync) : parseIdentifier(); return finishNode(arrowFunction); } function isParenthesizedArrowFunctionExpression() { - if (token === 16 || token === 24 || token === 115) { + if (token === 17 || token === 25 || token === 116) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } - if (token === 33) { + if (token === 34) { return 1; } return 0; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 115) { + if (token === 116) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0; } - if (token !== 16 && token !== 24) { + if (token !== 17 && token !== 25) { return 0; } } var first = token; var second = nextToken(); - if (first === 16) { - if (second === 17) { + if (first === 17) { + if (second === 18) { var third = nextToken(); switch (third) { - case 33: - case 52: - case 14: + case 34: + case 53: + case 15: return 1; default: return 0; } } - if (second === 18 || second === 14) { + if (second === 19 || second === 15) { return 2; } - if (second === 21) { + if (second === 22) { return 1; } if (!isIdentifier()) { return 0; } - if (nextToken() === 52) { + if (nextToken() === 53) { return 1; } return 2; } else { - ts.Debug.assert(first === 24); + ts.Debug.assert(first === 25); if (!isIdentifier()) { return 0; } if (sourceFile.languageVariant === 1) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 80) { + if (third === 81) { var fourth = nextToken(); switch (fourth) { - case 54: - case 26: + case 55: + case 27: return false; default: return true; } } - else if (third === 23) { + else if (third === 24) { return true; } return false; @@ -7249,25 +7363,25 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(171); + var node = createNode(172); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512); - fillSignature(52, false, isAsync, !allowAmbiguity, node); + fillSignature(53, false, isAsync, !allowAmbiguity, node); if (!node.parameters) { return undefined; } - if (!allowAmbiguity && token !== 33 && token !== 14) { + if (!allowAmbiguity && token !== 34 && token !== 15) { return undefined; } return node; } function parseArrowFunctionExpressionBody(isAsync) { - if (token === 14) { + if (token === 15) { return parseFunctionBlock(false, isAsync, false); } - if (token !== 22 && - token !== 84 && - token !== 70 && + if (token !== 23 && + token !== 85 && + token !== 71 && isStartOfStatement() && !isStartOfExpressionStatement()) { return parseFunctionBlock(false, isAsync, true); @@ -7277,15 +7391,15 @@ var ts; : doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher); } function parseConditionalExpressionRest(leftOperand) { - var questionToken = parseOptionalToken(51); + var questionToken = parseOptionalToken(52); if (!questionToken) { return leftOperand; } - var node = createNode(179, leftOperand.pos); + var node = createNode(180, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(52, false, ts.Diagnostics._0_expected, ts.tokenToString(52)); + node.colonToken = parseExpectedToken(53, false, ts.Diagnostics._0_expected, ts.tokenToString(53)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -7294,7 +7408,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 87 || t === 131; + return t === 88 || t === 132; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -7303,10 +7417,10 @@ var ts; if (newPrecedence <= precedence) { break; } - if (token === 87 && inDisallowInContext()) { + if (token === 88 && inDisallowInContext()) { break; } - if (token === 113) { + if (token === 114) { if (scanner.hasPrecedingLineBreak()) { break; } @@ -7322,90 +7436,90 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 87) { + if (inDisallowInContext() && token === 88) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 50: + case 51: return 1; - case 49: + case 50: return 2; - case 45: - return 3; case 46: + return 3; + case 47: return 4; - case 44: + case 45: return 5; - case 29: case 30: case 31: case 32: + case 33: return 6; - case 24: - case 26: + case 25: case 27: case 28: + case 29: + case 89: case 88: - case 87: - case 113: + case 114: return 7; - case 41: case 42: case 43: + case 44: return 8; - case 34: case 35: - return 9; case 36: + return 9; case 37: case 38: + case 39: return 10; } return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(178, left.pos); + var node = createNode(179, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(186, left.pos); + var node = createNode(187, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(176); + var node = createNode(177); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(172); + var node = createNode(173); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(173); + var node = createNode(174); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(174); + var node = createNode(175); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function isAwaitExpression() { - if (token === 116) { + if (token === 117) { if (inAwaitContext()) { return true; } @@ -7414,7 +7528,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(175); + var node = createNode(176); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -7424,25 +7538,25 @@ var ts; return parseAwaitExpression(); } switch (token) { - case 34: case 35: + case 36: + case 49: case 48: - case 47: - case 39: case 40: + case 41: return parsePrefixUnaryExpression(); - case 75: + case 76: return parseDeleteExpression(); - case 98: + case 99: return parseTypeOfExpression(); - case 100: + case 101: return parseVoidExpression(); - case 24: + case 25: if (sourceFile.languageVariant !== 1) { return parseTypeAssertion(); } if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(); + return parseJsxElementOrSelfClosingElement(true); } default: return parsePostfixExpressionOrHigher(); @@ -7451,8 +7565,8 @@ var ts; function parsePostfixExpressionOrHigher() { var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 39 || token === 40) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(177, expression.pos); + if ((token === 40 || token === 41) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(178, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -7461,7 +7575,7 @@ var ts; return expression; } function parseLeftHandSideExpressionOrHigher() { - var expression = token === 92 + var expression = token === 93 ? parseSuperExpression() : parseMemberExpressionOrHigher(); return parseCallExpressionRest(expression); @@ -7472,44 +7586,44 @@ var ts; } function parseSuperExpression() { var expression = parseTokenNode(); - if (token === 16 || token === 20) { + if (token === 17 || token === 21 || token === 19) { return expression; } - var node = createNode(163, expression.pos); + var node = createNode(164, expression.pos); node.expression = expression; - node.dotToken = parseExpectedToken(20, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.dotToken = parseExpectedToken(21, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); return finishNode(node); } - function parseJsxElementOrSelfClosingElement() { - var opening = parseJsxOpeningOrSelfClosingElement(); - if (opening.kind === 232) { - var node = createNode(230, opening.pos); + function parseJsxElementOrSelfClosingElement(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + if (opening.kind === 233) { + var node = createNode(231, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); - node.closingElement = parseJsxClosingElement(); + node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 231); + ts.Debug.assert(opening.kind === 232); return opening; } } function parseJsxText() { - var node = createNode(233, scanner.getStartPos()); + var node = createNode(234, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 233: + case 234: return parseJsxText(); - case 14: - return parseJsxExpression(); - case 24: - return parseJsxElementOrSelfClosingElement(); + case 15: + return parseJsxExpression(false); + case 25: + return parseJsxElementOrSelfClosingElement(false); } - ts.Debug.fail('Unknown JSX child kind ' + token); + ts.Debug.fail("Unknown JSX child kind " + token); } function parseJsxChildren(openingTagName) { var result = []; @@ -7518,7 +7632,7 @@ var ts; parsingContext |= 1 << 14; while (true) { token = scanner.reScanJsxToken(); - if (token === 25) { + if (token === 26) { break; } else if (token === 1) { @@ -7531,19 +7645,26 @@ var ts; parsingContext = saveParsingContext; return result; } - function parseJsxOpeningOrSelfClosingElement() { + function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); - parseExpected(24); + parseExpected(25); var tagName = parseJsxElementName(); var attributes = parseList(13, parseJsxAttribute); var node; - if (parseOptional(26)) { - node = createNode(232, fullStart); + if (token === 27) { + node = createNode(233, fullStart); + scanJsxText(); } else { - parseExpected(37); - parseExpected(26); - node = createNode(231, fullStart); + parseExpected(38); + if (inExpressionContext) { + parseExpected(27); + } + else { + parseExpected(27, undefined, false); + scanJsxText(); + } + node = createNode(232, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -7552,95 +7673,107 @@ var ts; function parseJsxElementName() { scanJsxIdentifier(); var elementName = parseIdentifierName(); - while (parseOptional(20)) { + while (parseOptional(21)) { scanJsxIdentifier(); - var node = createNode(132, elementName.pos); + var node = createNode(133, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); } return elementName; } - function parseJsxExpression() { - var node = createNode(237); - parseExpected(14); - if (token !== 15) { + function parseJsxExpression(inExpressionContext) { + var node = createNode(238); + parseExpected(15); + if (token !== 16) { node.expression = parseExpression(); } - parseExpected(15); + if (inExpressionContext) { + parseExpected(16); + } + else { + parseExpected(16, undefined, false); + scanJsxText(); + } return finishNode(node); } function parseJsxAttribute() { - if (token === 14) { + if (token === 15) { return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(235); + var node = createNode(236); node.name = parseIdentifierName(); - if (parseOptional(54)) { + if (parseOptional(55)) { switch (token) { - case 8: + case 9: node.initializer = parseLiteralNode(); break; default: - node.initializer = parseJsxExpression(); + node.initializer = parseJsxExpression(true); break; } } return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(236); - parseExpected(14); - parseExpected(21); - node.expression = parseExpression(); + var node = createNode(237); parseExpected(15); + parseExpected(22); + node.expression = parseExpression(); + parseExpected(16); return finishNode(node); } - function parseJsxClosingElement() { - var node = createNode(234); - parseExpected(25); - node.tagName = parseJsxElementName(); + function parseJsxClosingElement(inExpressionContext) { + var node = createNode(235); parseExpected(26); + node.tagName = parseJsxElementName(); + if (inExpressionContext) { + parseExpected(27); + } + else { + parseExpected(27, undefined, false); + scanJsxText(); + } return finishNode(node); } function parseTypeAssertion() { - var node = createNode(168); - parseExpected(24); + var node = createNode(169); + parseExpected(25); node.type = parseType(); - parseExpected(26); + parseExpected(27); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { - var dotToken = parseOptionalToken(20); + var dotToken = parseOptionalToken(21); if (dotToken) { - var propertyAccess = createNode(163, expression.pos); + var propertyAccess = createNode(164, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } - if (!inDecoratorContext() && parseOptional(18)) { - var indexedAccess = createNode(164, expression.pos); + if (!inDecoratorContext() && parseOptional(19)) { + var indexedAccess = createNode(165, expression.pos); indexedAccess.expression = expression; - if (token !== 19) { + if (token !== 20) { indexedAccess.argumentExpression = allowInAnd(parseExpression); - if (indexedAccess.argumentExpression.kind === 8 || indexedAccess.argumentExpression.kind === 7) { + if (indexedAccess.argumentExpression.kind === 9 || indexedAccess.argumentExpression.kind === 8) { var literal = indexedAccess.argumentExpression; literal.text = internIdentifier(literal.text); } } - parseExpected(19); + parseExpected(20); expression = finishNode(indexedAccess); continue; } - if (token === 10 || token === 11) { - var tagExpression = createNode(167, expression.pos); + if (token === 11 || token === 12) { + var tagExpression = createNode(168, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 + tagExpression.template = token === 11 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); @@ -7652,20 +7785,20 @@ var ts; function parseCallExpressionRest(expression) { while (true) { expression = parseMemberExpressionRest(expression); - if (token === 24) { + if (token === 25) { var typeArguments = tryParse(parseTypeArgumentsInExpression); if (!typeArguments) { return expression; } - var callExpr = createNode(165, expression.pos); + var callExpr = createNode(166, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); continue; } - else if (token === 16) { - var callExpr = createNode(165, expression.pos); + else if (token === 17) { + var callExpr = createNode(166, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -7675,17 +7808,17 @@ var ts; } } function parseArgumentList() { - parseExpected(16); - var result = parseDelimitedList(11, parseArgumentExpression); parseExpected(17); + var result = parseDelimitedList(11, parseArgumentExpression); + parseExpected(18); return result; } function parseTypeArgumentsInExpression() { - if (!parseOptional(24)) { + if (!parseOptional(25)) { return undefined; } var typeArguments = parseDelimitedList(18, parseType); - if (!parseExpected(26)) { + if (!parseExpected(27)) { return undefined; } return typeArguments && canFollowTypeArgumentsInExpression() @@ -7694,108 +7827,108 @@ var ts; } function canFollowTypeArgumentsInExpression() { switch (token) { - case 16: - case 20: case 17: - case 19: + case 21: + case 18: + case 20: + case 53: + case 23: case 52: - case 22: - case 51: - case 29: - case 31: case 30: case 32: - case 49: + case 31: + case 33: case 50: - case 46: - case 44: + case 51: + case 47: case 45: - case 15: + case 46: + case 16: case 1: return true; - case 23: - case 14: + case 24: + case 15: default: return false; } } function parsePrimaryExpression() { switch (token) { - case 7: case 8: - case 10: + case 9: + case 11: return parseLiteralNode(); - case 94: - case 92: - case 90: - case 96: - case 81: + case 95: + case 93: + case 91: + case 97: + case 82: return parseTokenNode(); - case 16: + case 17: return parseParenthesizedExpression(); - case 18: + case 19: return parseArrayLiteralExpression(); - case 14: + case 15: return parseObjectLiteralExpression(); - case 115: + case 116: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { break; } return parseFunctionExpression(); - case 70: + case 71: return parseClassExpression(); - case 84: + case 85: return parseFunctionExpression(); - case 89: + case 90: return parseNewExpression(); - case 37: - case 58: - if (reScanSlashToken() === 9) { + case 38: + case 59: + if (reScanSlashToken() === 10) { return parseLiteralNode(); } break; - case 11: + case 12: return parseTemplateExpression(); } return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(169); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(170); parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); return finishNode(node); } function parseSpreadElement() { - var node = createNode(182); - parseExpected(21); + var node = createNode(183); + parseExpected(22); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(184) : + return token === 22 ? parseSpreadElement() : + token === 24 ? createNode(185) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(161); - parseExpected(18); + var node = createNode(162); + parseExpected(19); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048; node.elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement); - parseExpected(19); + parseExpected(20); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(120)) { - return parseAccessorDeclaration(142, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(126)) { + if (parseContextualModifier(121)) { return parseAccessorDeclaration(143, fullStart, decorators, modifiers); } + else if (parseContextualModifier(127)) { + return parseAccessorDeclaration(144, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { @@ -7806,37 +7939,37 @@ var ts; if (accessor) { return accessor; } - var asteriskToken = parseOptionalToken(36); + var asteriskToken = parseOptionalToken(37); var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); - var questionToken = parseOptionalToken(51); - if (asteriskToken || token === 16 || token === 24) { + var questionToken = parseOptionalToken(52); + if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } - if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(243, fullStart); + if ((token === 24 || token === 16) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(244, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(242, fullStart); + var propertyAssignment = createNode(243, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(52); + parseExpected(53); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(162); - parseExpected(14); + var node = createNode(163); + parseExpected(15); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048; } node.properties = parseDelimitedList(12, parseObjectLiteralElement, true); - parseExpected(15); + parseExpected(16); return finishNode(node); } function parseFunctionExpression() { @@ -7844,10 +7977,10 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(170); + var node = createNode(171); setModifiers(node, parseModifiers()); - parseExpected(84); - node.asteriskToken = parseOptionalToken(36); + parseExpected(85); + node.asteriskToken = parseOptionalToken(37); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); node.name = @@ -7855,7 +7988,7 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(52, isGenerator, isAsync, false, node); + fillSignature(53, isGenerator, isAsync, false, node); node.body = parseFunctionBlock(isGenerator, isAsync, false); if (saveDecoratorContext) { setDecoratorContext(true); @@ -7866,20 +7999,20 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(166); - parseExpected(89); + var node = createNode(167); + parseExpected(90); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); - if (node.typeArguments || token === 16) { + if (node.typeArguments || token === 17) { node.arguments = parseArgumentList(); } return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(189); - if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { + var node = createNode(190); + if (parseExpected(15, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1, parseStatement); - parseExpected(15); + parseExpected(16); } else { node.statements = createMissingList(); @@ -7904,47 +8037,47 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(191); - parseExpected(22); + var node = createNode(192); + parseExpected(23); return finishNode(node); } function parseIfStatement() { - var node = createNode(193); - parseExpected(85); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(194); + parseExpected(86); parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(77) ? parseStatement() : undefined; + node.elseStatement = parseOptional(78) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(194); - parseExpected(76); + var node = createNode(195); + parseExpected(77); node.statement = parseStatement(); - parseExpected(101); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + parseExpected(102); parseExpected(17); - parseOptional(22); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + parseOptional(23); return finishNode(node); } function parseWhileStatement() { - var node = createNode(195); - parseExpected(101); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(196); + parseExpected(102); parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); node.statement = parseStatement(); return finishNode(node); } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(83); - parseExpected(16); + parseExpected(84); + parseExpected(17); var initializer = undefined; - if (token !== 22) { - if (token === 99 || token === 105 || token === 71) { + if (token !== 23) { + if (token === 100 || token === 106 || token === 72) { initializer = parseVariableDeclarationList(true); } else { @@ -7952,32 +8085,32 @@ var ts; } } var forOrForInOrForOfStatement; - if (parseOptional(87)) { - var forInStatement = createNode(197, pos); + if (parseOptional(88)) { + var forInStatement = createNode(198, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); - parseExpected(17); + parseExpected(18); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(131)) { - var forOfStatement = createNode(198, pos); + else if (parseOptional(132)) { + var forOfStatement = createNode(199, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); - parseExpected(17); + parseExpected(18); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(196, pos); + var forStatement = createNode(197, pos); forStatement.initializer = initializer; - parseExpected(22); - if (token !== 22 && token !== 17) { + parseExpected(23); + if (token !== 23 && token !== 18) { forStatement.condition = allowInAnd(parseExpression); } - parseExpected(22); - if (token !== 17) { + parseExpected(23); + if (token !== 18) { forStatement.incrementor = allowInAnd(parseExpression); } - parseExpected(17); + parseExpected(18); forOrForInOrForOfStatement = forStatement; } forOrForInOrForOfStatement.statement = parseStatement(); @@ -7985,7 +8118,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 200 ? 67 : 72); + parseExpected(kind === 201 ? 68 : 73); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7993,8 +8126,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(201); - parseExpected(91); + var node = createNode(202); + parseExpected(92); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -8002,99 +8135,99 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(202); - parseExpected(102); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(203); + parseExpected(103); parseExpected(17); + node.expression = allowInAnd(parseExpression); + parseExpected(18); node.statement = parseStatement(); return finishNode(node); } function parseCaseClause() { - var node = createNode(238); - parseExpected(68); + var node = createNode(239); + parseExpected(69); node.expression = allowInAnd(parseExpression); - parseExpected(52); + parseExpected(53); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(239); - parseExpected(74); - parseExpected(52); + var node = createNode(240); + parseExpected(75); + parseExpected(53); node.statements = parseList(3, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 68 ? parseCaseClause() : parseDefaultClause(); + return token === 69 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(203); - parseExpected(93); - parseExpected(16); - node.expression = allowInAnd(parseExpression); + var node = createNode(204); + parseExpected(94); parseExpected(17); - var caseBlock = createNode(217, scanner.getStartPos()); - parseExpected(14); - caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); + node.expression = allowInAnd(parseExpression); + parseExpected(18); + var caseBlock = createNode(218, scanner.getStartPos()); parseExpected(15); + caseBlock.clauses = parseList(2, parseCaseOrDefaultClause); + parseExpected(16); node.caseBlock = finishNode(caseBlock); return finishNode(node); } function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(205); - parseExpected(95); + var node = createNode(206); + parseExpected(96); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(206); - parseExpected(97); + var node = createNode(207); + parseExpected(98); node.tryBlock = parseBlock(false); - node.catchClause = token === 69 ? parseCatchClause() : undefined; - if (!node.catchClause || token === 82) { - parseExpected(82); + node.catchClause = token === 70 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 83) { + parseExpected(83); node.finallyBlock = parseBlock(false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(241); - parseExpected(69); - if (parseExpected(16)) { + var result = createNode(242); + parseExpected(70); + if (parseExpected(17)) { result.variableDeclaration = parseVariableDeclaration(); } - parseExpected(17); + parseExpected(18); result.block = parseBlock(false); return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(207); - parseExpected(73); + var node = createNode(208); + parseExpected(74); parseSemicolon(); return finishNode(node); } function parseExpressionOrLabeledStatement() { var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 66 && parseOptional(52)) { - var labeledStatement = createNode(204, fullStart); + if (expression.kind === 67 && parseOptional(53)) { + var labeledStatement = createNode(205, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(192, fullStart); + var expressionStatement = createNode(193, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); } } function isIdentifierOrKeyword() { - return token >= 66; + return token >= 67; } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); @@ -8102,51 +8235,51 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 84 && !scanner.hasPrecedingLineBreak(); + return token === 85 && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 7) && !scanner.hasPrecedingLineBreak(); + return (isIdentifierOrKeyword() || token === 8) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { switch (token) { - case 99: - case 105: + case 100: + case 106: + case 72: + case 85: case 71: - case 84: - case 70: - case 78: + case 79: return true; - case 104: - case 129: + case 105: + case 130: return nextTokenIsIdentifierOnSameLine(); - case 122: case 123: + case 124: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 115: - case 119: + case 116: + case 120: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 86: + case 87: nextToken(); - return token === 8 || token === 36 || - token === 14 || isIdentifierOrKeyword(); - case 79: + return token === 9 || token === 37 || + token === 15 || isIdentifierOrKeyword(); + case 80: nextToken(); - if (token === 54 || token === 36 || - token === 14 || token === 74) { + if (token === 55 || token === 37 || + token === 15 || token === 75) { return true; } continue; - case 109: - case 107: - case 108: case 110: - case 112: + case 108: + case 109: + case 111: + case 113: nextToken(); continue; default: @@ -8159,44 +8292,44 @@ var ts; } function isStartOfStatement() { switch (token) { - case 53: - case 22: - case 14: - case 99: - case 105: - case 84: - case 70: - case 78: + case 54: + case 23: + case 15: + case 100: + case 106: case 85: - case 76: - case 101: - case 83: - case 72: - case 67: - case 91: - case 102: - case 93: - case 95: - case 97: - case 73: - case 69: - case 82: - return true; case 71: case 79: case 86: + case 77: + case 102: + case 84: + case 73: + case 68: + case 92: + case 103: + case 94: + case 96: + case 98: + case 74: + case 70: + case 83: + return true; + case 72: + case 80: + case 87: return isStartOfDeclaration(); - case 115: - case 119: - case 104: - case 122: + case 116: + case 120: + case 105: case 123: - case 129: + case 124: + case 130: return true; - case 109: - case 107: - case 108: case 110: + case 108: + case 109: + case 111: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -8204,71 +8337,71 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuring() { nextToken(); - return isIdentifier() || token === 14 || token === 18; + return isIdentifier() || token === 15 || token === 19; } function isLetDeclaration() { return lookAhead(nextTokenIsIdentifierOrStartOfDestructuring); } function parseStatement() { switch (token) { - case 22: + case 23: return parseEmptyStatement(); - case 14: + case 15: return parseBlock(false); - case 99: + case 100: return parseVariableStatement(scanner.getStartPos(), undefined, undefined); - case 105: + case 106: if (isLetDeclaration()) { return parseVariableStatement(scanner.getStartPos(), undefined, undefined); } break; - case 84: + case 85: return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); - case 70: + case 71: return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); - case 85: + case 86: return parseIfStatement(); - case 76: + case 77: return parseDoStatement(); - case 101: + case 102: return parseWhileStatement(); - case 83: + case 84: return parseForOrForInOrForOfStatement(); - case 72: - return parseBreakOrContinueStatement(199); - case 67: + case 73: return parseBreakOrContinueStatement(200); - case 91: + case 68: + return parseBreakOrContinueStatement(201); + case 92: return parseReturnStatement(); - case 102: + case 103: return parseWithStatement(); - case 93: + case 94: return parseSwitchStatement(); - case 95: + case 96: return parseThrowStatement(); - case 97: - case 69: - case 82: + case 98: + case 70: + case 83: return parseTryStatement(); - case 73: + case 74: return parseDebuggerStatement(); - case 53: + case 54: return parseDeclaration(); - case 115: - case 104: - case 129: - case 122: + case 116: + case 105: + case 130: case 123: - case 119: - case 71: - case 78: + case 124: + case 120: + case 72: case 79: - case 86: - case 107: + case 80: + case 87: case 108: case 109: - case 112: case 110: + case 113: + case 111: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -8281,33 +8414,33 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 99: - case 105: - case 71: + case 100: + case 106: + case 72: return parseVariableStatement(fullStart, decorators, modifiers); - case 84: + case 85: return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 70: + case 71: return parseClassDeclaration(fullStart, decorators, modifiers); - case 104: + case 105: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 129: + case 130: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 78: + case 79: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 122: case 123: + case 124: return parseModuleDeclaration(fullStart, decorators, modifiers); - case 86: + case 87: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 79: + case 80: nextToken(); - return token === 74 || token === 54 ? + return token === 75 || token === 55 ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { - var node = createMissingNode(228, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(229, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8317,34 +8450,34 @@ var ts; } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 8); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 9); } function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) { - if (token !== 14 && canParseSemicolon()) { + if (token !== 15 && canParseSemicolon()) { parseSemicolon(); return; } return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage); } function parseArrayBindingElement() { - if (token === 23) { - return createNode(184); + if (token === 24) { + return createNode(185); } - var node = createNode(160); - node.dotDotDotToken = parseOptionalToken(21); + var node = createNode(161); + node.dotDotDotToken = parseOptionalToken(22); node.name = parseIdentifierOrPattern(); node.initializer = parseBindingElementInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(160); + var node = createNode(161); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 52) { + if (tokenIsIdentifier && token !== 53) { node.name = propertyName; } else { - parseExpected(52); + parseExpected(53); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } @@ -8352,33 +8485,33 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(158); - parseExpected(14); - node.elements = parseDelimitedList(9, parseObjectBindingElement); + var node = createNode(159); parseExpected(15); + node.elements = parseDelimitedList(9, parseObjectBindingElement); + parseExpected(16); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(159); - parseExpected(18); - node.elements = parseDelimitedList(10, parseArrayBindingElement); + var node = createNode(160); parseExpected(19); + node.elements = parseDelimitedList(10, parseArrayBindingElement); + parseExpected(20); return finishNode(node); } function isIdentifierOrPattern() { - return token === 14 || token === 18 || isIdentifier(); + return token === 15 || token === 19 || isIdentifier(); } function parseIdentifierOrPattern() { - if (token === 18) { + if (token === 19) { return parseArrayBindingPattern(); } - if (token === 14) { + if (token === 15) { return parseObjectBindingPattern(); } return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(208); + var node = createNode(209); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -8387,21 +8520,21 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(209); + var node = createNode(210); switch (token) { - case 99: + case 100: break; - case 105: + case 106: node.flags |= 16384; break; - case 71: + case 72: node.flags |= 32768; break; default: ts.Debug.fail(); } nextToken(); - if (token === 131 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 132 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -8413,10 +8546,10 @@ var ts; return finishNode(node); } function canFollowContextualOfKeyword() { - return nextTokenIsIdentifier() && nextToken() === 17; + return nextTokenIsIdentifier() && nextToken() === 18; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(190, fullStart); + var node = createNode(191, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -8424,29 +8557,29 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(210, fullStart); + var node = createNode(211, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(84); - node.asteriskToken = parseOptionalToken(36); + parseExpected(85); + node.asteriskToken = parseOptionalToken(37); node.name = node.flags & 1024 ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512); - fillSignature(52, isGenerator, isAsync, false, node); + fillSignature(53, isGenerator, isAsync, false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(141, pos); + var node = createNode(142, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(118); - fillSignature(52, false, false, false, node); + parseExpected(119); + fillSignature(53, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(140, fullStart); + var method = createNode(141, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -8454,12 +8587,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512); - fillSignature(52, isGenerator, isAsync, false, method); + fillSignature(53, isGenerator, isAsync, false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(138, fullStart); + var property = createNode(139, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -8472,10 +8605,10 @@ var ts; return finishNode(property); } function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { - var asteriskToken = parseOptionalToken(36); + var asteriskToken = parseOptionalToken(37); var name = parsePropertyName(); - var questionToken = parseOptionalToken(51); - if (asteriskToken || token === 16 || token === 24) { + var questionToken = parseOptionalToken(52); + if (asteriskToken || token === 17 || token === 25) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { @@ -8490,16 +8623,16 @@ var ts; node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(52, false, false, false, node); + fillSignature(53, false, false, false, node); node.body = parseFunctionBlockOrSemicolon(false, false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { - case 109: - case 107: - case 108: case 110: + case 108: + case 109: + case 111: return true; default: return false; @@ -8507,7 +8640,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 53) { + if (token === 54) { return true; } while (ts.isModifier(token)) { @@ -8517,26 +8650,26 @@ var ts; } nextToken(); } - if (token === 36) { + if (token === 37) { return true; } if (isLiteralPropertyName()) { idToken = token; nextToken(); } - if (token === 18) { + if (token === 19) { return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 126 || idToken === 120) { + if (!ts.isKeyword(idToken) || idToken === 127 || idToken === 121) { return true; } switch (token) { - case 16: - case 24: + case 17: + case 25: + case 53: + case 55: case 52: - case 54: - case 51: return true; default: return canParseSemicolon(); @@ -8548,14 +8681,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(53)) { + if (!parseOptional(54)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(136, decoratorStart); + var decorator = createNode(137, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -8589,7 +8722,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 115) { + if (token === 116) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -8603,8 +8736,8 @@ var ts; return modifiers; } function parseClassElement() { - if (token === 22) { - var result = createNode(188); + if (token === 23) { + var result = createNode(189); nextToken(); return finishNode(result); } @@ -8615,42 +8748,42 @@ var ts; if (accessor) { return accessor; } - if (token === 118) { + if (token === 119) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(fullStart, decorators, modifiers); } if (isIdentifierOrKeyword() || + token === 9 || token === 8 || - token === 7 || - token === 36 || - token === 18) { + token === 37 || + token === 19) { return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { - var name_8 = createMissingNode(66, true, ts.Diagnostics.Declaration_expected); + var name_8 = createMissingNode(67, true, ts.Diagnostics.Declaration_expected); return parsePropertyDeclaration(fullStart, decorators, modifiers, name_8, undefined); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 183); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 184); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 211); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(70); + parseExpected(71); node.name = parseOptionalIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(true); - if (parseExpected(14)) { + if (parseExpected(15)) { node.members = parseClassMembers(); - parseExpected(15); + parseExpected(16); } else { node.members = createMissingList(); @@ -8669,8 +8802,8 @@ var ts; return parseList(20, parseHeritageClause); } function parseHeritageClause() { - if (token === 80 || token === 103) { - var node = createNode(240); + if (token === 81 || token === 104) { + var node = createNode(241); node.token = token; nextToken(); node.types = parseDelimitedList(7, parseExpressionWithTypeArguments); @@ -8679,24 +8812,24 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(185); + var node = createNode(186); node.expression = parseLeftHandSideExpressionOrHigher(); - if (token === 24) { - node.typeArguments = parseBracketedList(18, parseType, 24, 26); + if (token === 25) { + node.typeArguments = parseBracketedList(18, parseType, 25, 27); } return finishNode(node); } function isHeritageClause() { - return token === 80 || token === 103; + return token === 81 || token === 104; } function parseClassMembers() { return parseList(5, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212, fullStart); + var node = createNode(213, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(104); + parseExpected(105); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); node.heritageClauses = parseHeritageClauses(false); @@ -8704,32 +8837,32 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213, fullStart); + var node = createNode(214, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(129); + parseExpected(130); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(54); + parseExpected(55); node.type = parseType(); parseSemicolon(); return finishNode(node); } function parseEnumMember() { - var node = createNode(244, scanner.getStartPos()); + var node = createNode(245, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(78); + parseExpected(79); node.name = parseIdentifier(); - if (parseExpected(14)) { + if (parseExpected(15)) { node.members = parseDelimitedList(6, parseEnumMember); - parseExpected(15); + parseExpected(16); } else { node.members = createMissingList(); @@ -8737,10 +8870,10 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(216, scanner.getStartPos()); - if (parseExpected(14)) { + var node = createNode(217, scanner.getStartPos()); + if (parseExpected(15)) { node.statements = parseList(1, parseStatement); - parseExpected(15); + parseExpected(16); } else { node.statements = createMissingList(); @@ -8748,18 +8881,18 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(215, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20) + node.body = parseOptional(21) ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -8768,57 +8901,57 @@ var ts; } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(123)) { + if (parseOptional(124)) { flags |= 131072; } else { - parseExpected(122); - if (token === 8) { + parseExpected(123); + if (token === 9) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } } return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 124 && + return token === 125 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { - return nextToken() === 16; + return nextToken() === 17; } function nextTokenIsSlash() { - return nextToken() === 37; + return nextToken() === 38; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 || - token === 130; + return token === 24 || + token === 131; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(86); + parseExpected(87); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 23 && token !== 130) { - var importEqualsDeclaration = createNode(218, fullStart); + if (token !== 24 && token !== 131) { + var importEqualsDeclaration = createNode(219, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(54); + parseExpected(55); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(219, fullStart); + var importDeclaration = createNode(220, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || - token === 36 || - token === 14) { + token === 37 || + token === 15) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(130); + parseExpected(131); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -8831,13 +8964,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(220, fullStart); + var importClause = createNode(221, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || - parseOptional(23)) { - importClause.namedBindings = token === 36 ? parseNamespaceImport() : parseNamedImportsOrExports(222); + parseOptional(24)) { + importClause.namedBindings = token === 37 ? parseNamespaceImport() : parseNamedImportsOrExports(223); } return finishNode(importClause); } @@ -8847,37 +8980,37 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(229); - parseExpected(124); - parseExpected(16); - node.expression = parseModuleSpecifier(); + var node = createNode(230); + parseExpected(125); parseExpected(17); + node.expression = parseModuleSpecifier(); + parseExpected(18); return finishNode(node); } function parseModuleSpecifier() { var result = parseExpression(); - if (result.kind === 8) { + if (result.kind === 9) { internIdentifier(result.text); } return result; } function parseNamespaceImport() { - var namespaceImport = createNode(221); - parseExpected(36); - parseExpected(113); + var namespaceImport = createNode(222); + parseExpected(37); + parseExpected(114); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(21, kind === 222 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(21, kind === 223 ? parseImportSpecifier : parseExportSpecifier, 15, 16); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(227); + return parseImportOrExportSpecifier(228); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(223); + return parseImportOrExportSpecifier(224); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -8885,9 +9018,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 113) { + if (token === 114) { node.propertyName = identifierName; - parseExpected(113); + parseExpected(114); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -8896,23 +9029,23 @@ var ts; else { node.name = identifierName; } - if (kind === 223 && checkIdentifierIsKeyword) { + if (kind === 224 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225, fullStart); + var node = createNode(226, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(36)) { - parseExpected(130); + if (parseOptional(37)) { + parseExpected(131); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(226); - if (token === 130 || (token === 8 && !scanner.hasPrecedingLineBreak())) { - parseExpected(130); + node.exportClause = parseNamedImportsOrExports(227); + if (token === 131 || (token === 9 && !scanner.hasPrecedingLineBreak())) { + parseExpected(131); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -8920,14 +9053,14 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(224, fullStart); + var node = createNode(225, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(54)) { + if (parseOptional(55)) { node.isExportEquals = true; } else { - parseExpected(74); + parseExpected(75); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); @@ -8990,10 +9123,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 218 && node.moduleReference.kind === 229 - || node.kind === 219 - || node.kind === 224 + || node.kind === 219 && node.moduleReference.kind === 230 + || node.kind === 220 || node.kind === 225 + || node.kind === 226 ? node : undefined; }); @@ -9002,16 +9135,16 @@ var ts; (function (JSDocParser) { function isJSDocType() { switch (token) { - case 36: - case 51: - case 16: - case 18: - case 47: - case 14: - case 84: - case 21: - case 89: - case 94: + case 37: + case 52: + case 17: + case 19: + case 48: + case 15: + case 85: + case 22: + case 90: + case 95: return true; } return isIdentifierOrKeyword(); @@ -9028,23 +9161,23 @@ var ts; function parseJSDocTypeExpression(start, length) { scanner.setText(sourceText, start, length); token = nextToken(); - var result = createNode(246); - parseExpected(14); - result.type = parseJSDocTopLevelType(); + var result = createNode(247); parseExpected(15); + result.type = parseJSDocTopLevelType(); + parseExpected(16); fixupParentReferences(result); return finishNode(result); } JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 45) { - var unionType = createNode(250, type.pos); + if (token === 46) { + var unionType = createNode(251, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 54) { - var optionalType = createNode(257, type.pos); + if (token === 55) { + var optionalType = createNode(258, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -9054,21 +9187,21 @@ var ts; function parseJSDocType() { var type = parseBasicTypeExpression(); while (true) { - if (token === 18) { - var arrayType = createNode(249, type.pos); + if (token === 19) { + var arrayType = createNode(250, type.pos); arrayType.elementType = type; nextToken(); - parseExpected(19); + parseExpected(20); type = finishNode(arrayType); } - else if (token === 51) { - var nullableType = createNode(252, type.pos); + else if (token === 52) { + var nullableType = createNode(253, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 47) { - var nonNullableType = createNode(253, type.pos); + else if (token === 48) { + var nonNullableType = createNode(254, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -9081,85 +9214,85 @@ var ts; } function parseBasicTypeExpression() { switch (token) { - case 36: + case 37: return parseJSDocAllType(); - case 51: + case 52: return parseJSDocUnknownOrNullableType(); - case 16: + case 17: return parseJSDocUnionType(); - case 18: + case 19: return parseJSDocTupleType(); - case 47: + case 48: return parseJSDocNonNullableType(); - case 14: + case 15: return parseJSDocRecordType(); - case 84: + case 85: return parseJSDocFunctionType(); - case 21: + case 22: return parseJSDocVariadicType(); - case 89: + case 90: return parseJSDocConstructorType(); - case 94: + case 95: return parseJSDocThisType(); - case 114: - case 127: - case 125: - case 117: + case 115: case 128: - case 100: + case 126: + case 118: + case 129: + case 101: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(261); + var result = createNode(262); nextToken(); - parseExpected(52); + parseExpected(53); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(260); + var result = createNode(261); nextToken(); - parseExpected(52); + parseExpected(53); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(259); + var result = createNode(260); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(258); + var result = createNode(259); nextToken(); - parseExpected(16); + parseExpected(17); result.parameters = parseDelimitedList(22, parseJSDocParameter); checkForTrailingComma(result.parameters); - parseExpected(17); - if (token === 52) { + parseExpected(18); + if (token === 53) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(135); + var parameter = createNode(136); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(257, type.pos); + var result = createNode(258, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(256); + var result = createNode(257); result.name = parseSimplePropertyName(); - while (parseOptional(20)) { - if (token === 24) { + while (parseOptional(21)) { + if (token === 25) { result.typeArguments = parseTypeArguments(); break; } @@ -9174,7 +9307,7 @@ var ts; var typeArguments = parseDelimitedList(23, parseJSDocType); checkForTrailingComma(typeArguments); checkForEmptyTypeArgumentList(typeArguments); - parseExpected(26); + parseExpected(27); return typeArguments; } function checkForEmptyTypeArgumentList(typeArguments) { @@ -9185,40 +9318,40 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(132, left.pos); + var result = createNode(133, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(254); + var result = createNode(255); nextToken(); result.members = parseDelimitedList(24, parseJSDocRecordMember); checkForTrailingComma(result.members); - parseExpected(15); + parseExpected(16); return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(255); + var result = createNode(256); result.name = parseSimplePropertyName(); - if (token === 52) { + if (token === 53) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(253); + var result = createNode(254); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(251); + var result = createNode(252); nextToken(); result.types = parseDelimitedList(25, parseJSDocType); checkForTrailingComma(result.types); - parseExpected(19); + parseExpected(20); return finishNode(result); } function checkForTrailingComma(list) { @@ -9228,10 +9361,10 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(250); + var result = createNode(251); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); - parseExpected(17); + parseExpected(18); return finishNode(result); } function parseJSDocTypeList(firstType) { @@ -9239,31 +9372,31 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(45)) { + while (parseOptional(46)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(247); + var result = createNode(248); nextToken(); return finishNode(result); } function parseJSDocUnknownOrNullableType() { var pos = scanner.getStartPos(); nextToken(); - if (token === 23 || - token === 15 || - token === 17 || - token === 26 || - token === 54 || - token === 45) { - var result = createNode(248, pos); + if (token === 24 || + token === 16 || + token === 18 || + token === 27 || + token === 55 || + token === 46) { + var result = createNode(249, pos); return finishNode(result); } else { - var result = createNode(252, pos); + var result = createNode(253, pos); result.type = parseJSDocType(); return finishNode(result); } @@ -9334,7 +9467,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(262, start); + var result = createNode(263, start); result.tags = tags; return finishNode(result, end); } @@ -9345,7 +9478,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64); - var atToken = createNode(53, pos - 1); + var atToken = createNode(54, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -9371,7 +9504,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(263, atToken.pos); + var result = createNode(264, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -9423,7 +9556,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(264, atToken.pos); + var result = createNode(265, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -9433,27 +9566,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 265; })) { + if (ts.forEach(tags, function (t) { return t.kind === 266; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(265, atToken.pos); + var result = createNode(266, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266; })) { + if (ts.forEach(tags, function (t) { return t.kind === 267; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266, atToken.pos); + var result = createNode(267, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -9466,7 +9599,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(134, name_9.pos); + var typeParameter = createNode(135, name_9.pos); typeParameter.name = name_9; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -9477,7 +9610,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(267, atToken.pos); + var result = createNode(268, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -9498,7 +9631,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(66, startPos); + var result = createNode(67, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -9542,7 +9675,7 @@ var ts; } return; function visitNode(node) { - var text = ''; + var text = ""; if (aggressiveChecks && shouldCheckNode(node)) { text = oldText.substring(node.pos, node.end); } @@ -9572,9 +9705,9 @@ var ts; } function shouldCheckNode(node) { switch (node.kind) { + case 9: case 8: - case 7: - case 66: + case 67: return true; } return false; @@ -9793,16 +9926,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 212 || node.kind === 213) { + if (node.kind === 213 || node.kind === 214) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 219 || node.kind === 218) && !(node.flags & 1)) { + else if ((node.kind === 220 || node.kind === 219) && !(node.flags & 1)) { return 0; } - else if (node.kind === 216) { + else if (node.kind === 217) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -9818,7 +9951,7 @@ var ts; }); return state; } - else if (node.kind === 215) { + else if (node.kind === 216) { return getModuleInstanceState(node.body); } else { @@ -9870,10 +10003,10 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 215 && node.name.kind === 8) { - return '"' + node.name.text + '"'; + if (node.kind === 216 && node.name.kind === 9) { + return "\"" + node.name.text + "\""; } - if (node.name.kind === 133) { + if (node.name.kind === 134) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -9881,22 +10014,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 141: + case 142: return "__constructor"; - case 149: - case 144: - return "__call"; case 150: case 145: - return "__new"; + return "__call"; + case 151: case 146: + return "__new"; + case 147: return "__index"; - case 225: + case 226: return "__export"; - case 224: + case 225: return node.isExportEquals ? "export=" : "default"; - case 210: case 211: + case 212: return node.flags & 1024 ? "default" : undefined; } } @@ -9938,7 +10071,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolFlags & 8388608) { - if (node.kind === 227 || (node.kind === 218 && hasExportModifier)) { + if (node.kind === 228 || (node.kind === 219 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -9984,37 +10117,37 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 183: - case 211: + case 184: case 212: - case 214: - case 152: - case 162: + case 213: + case 215: + case 153: + case 163: return 1; - case 144: case 145: case 146: - case 140: - case 139: - case 210: + case 147: case 141: + case 140: + case 211: case 142: case 143: - case 149: + case 144: case 150: - case 170: + case 151: case 171: - case 215: - case 245: - case 213: + case 172: + case 216: + case 246: + case 214: return 5; - case 241: - case 196: + case 242: case 197: case 198: - case 217: + case 199: + case 218: return 2; - case 189: + case 190: return ts.isFunctionLike(node.parent) ? 0 : 2; } return 0; @@ -10030,33 +10163,33 @@ var ts; } function declareSymbolAndAddToSymbolTableWorker(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 215: + case 216: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 245: + case 246: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 183: - case 211: + case 184: + case 212: return declareClassMember(node, symbolFlags, symbolExcludes); - case 214: + case 215: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 152: - case 162: - case 212: + case 153: + case 163: + case 213: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 149: case 150: - case 144: + case 151: case 145: case 146: - case 140: - case 139: + case 147: case 141: + case 140: case 142: case 143: - case 210: - case 170: + case 144: + case 211: case 171: - case 213: + case 172: + case 214: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -10080,11 +10213,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 245 ? node : node.body; - if (body.kind === 245 || body.kind === 216) { + var body = node.kind === 246 ? node : node.body; + if (body.kind === 246 || body.kind === 217) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 225 || stat.kind === 224) { + if (stat.kind === 226 || stat.kind === 225) { return true; } } @@ -10101,7 +10234,7 @@ var ts; } function bindModuleDeclaration(node) { setExportContextFlag(node); - if (node.name.kind === 8) { + if (node.name.kind === 9) { declareSymbolAndAddToSymbolTable(node, 512, 106639); } else { @@ -10111,12 +10244,17 @@ var ts; } else { declareSymbolAndAddToSymbolTable(node, 512, 106639); - var currentModuleIsConstEnumOnly = state === 2; - if (node.symbol.constEnumOnlyModule === undefined) { - node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + if (node.symbol.flags & (16 | 32 | 256)) { + node.symbol.constEnumOnlyModule = false; } else { - node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + var currentModuleIsConstEnumOnly = state === 2; + if (node.symbol.constEnumOnlyModule === undefined) { + node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + } + else { + node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + } } } } @@ -10134,11 +10272,11 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 66) { + if (prop.name.kind !== 67) { continue; } var identifier = prop.name; - var currentKind = prop.kind === 242 || prop.kind === 243 || prop.kind === 140 + var currentKind = prop.kind === 243 || prop.kind === 244 || prop.kind === 141 ? 1 : 2; var existingKind = seen[identifier.text]; @@ -10160,10 +10298,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 215: + case 216: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 245: + case 246: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -10181,8 +10319,8 @@ var ts; } function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 103 && - node.originalKeywordKind <= 111 && + node.originalKeywordKind >= 104 && + node.originalKeywordKind <= 112 && !ts.isIdentifierName(node)) { if (!file.parseDiagnostics.length) { file.bindDiagnostics.push(ts.createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); @@ -10209,17 +10347,17 @@ var ts; } } function checkStrictModeDeleteExpression(node) { - if (inStrictMode && node.expression.kind === 66) { + if (inStrictMode && node.expression.kind === 67) { var span = ts.getErrorSpanForNode(file, node.expression); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 66 && + return node.kind === 67 && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 66) { + if (name && name.kind === 67) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { var span = ts.getErrorSpanForNode(file, name); @@ -10253,7 +10391,7 @@ var ts; } function checkStrictModePrefixUnaryExpression(node) { if (inStrictMode) { - if (node.operator === 39 || node.operator === 40) { + if (node.operator === 40 || node.operator === 41) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -10282,17 +10420,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 245: - case 216: + case 246: + case 217: updateStrictModeStatementList(node.statements); return; - case 189: + case 190: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 211: - case 183: + case 212: + case 184: inStrictMode = true; return; } @@ -10311,106 +10449,106 @@ var ts; } function isUseStrictPrologueDirective(node) { var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); - return nodeText === '"use strict"' || nodeText === "'use strict'"; + return nodeText === "\"use strict\"" || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { - case 66: + case 67: return checkStrictModeIdentifier(node); - case 178: + case 179: return checkStrictModeBinaryExpression(node); - case 241: + case 242: return checkStrictModeCatchClause(node); - case 172: + case 173: return checkStrictModeDeleteExpression(node); - case 7: + case 8: return checkStrictModeNumericLiteral(node); - case 177: + case 178: return checkStrictModePostfixUnaryExpression(node); - case 176: + case 177: return checkStrictModePrefixUnaryExpression(node); - case 202: + case 203: return checkStrictModeWithStatement(node); - case 134: - return declareSymbolAndAddToSymbolTable(node, 262144, 530912); case 135: + return declareSymbolAndAddToSymbolTable(node, 262144, 530912); + case 136: return bindParameter(node); - case 208: - case 160: + case 209: + case 161: return bindVariableDeclarationOrBindingElement(node); + case 139: case 138: - case 137: return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455); - case 242: case 243: - return bindPropertyOrMethodOrAccessor(node, 4, 107455); case 244: + return bindPropertyOrMethodOrAccessor(node, 4, 107455); + case 245: return bindPropertyOrMethodOrAccessor(node, 8, 107455); - case 144: case 145: case 146: + case 147: return declareSymbolAndAddToSymbolTable(node, 131072, 0); + case 141: case 140: - case 139: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263); - case 210: + case 211: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16, 106927); - case 141: - return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 142: - return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + return declareSymbolAndAddToSymbolTable(node, 16384, 0); case 143: + return bindPropertyOrMethodOrAccessor(node, 32768, 41919); + case 144: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); - case 149: case 150: + case 151: return bindFunctionOrConstructorType(node); - case 152: + case 153: return bindAnonymousDeclaration(node, 2048, "__type"); - case 162: + case 163: return bindObjectLiteralExpression(node); - case 170: case 171: + case 172: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16, bindingName); - case 183: - case 211: - return bindClassLikeDeclaration(node); + case 184: case 212: - return bindBlockScopedDeclaration(node, 64, 792960); + return bindClassLikeDeclaration(node); case 213: - return bindBlockScopedDeclaration(node, 524288, 793056); + return bindBlockScopedDeclaration(node, 64, 792960); case 214: - return bindEnumDeclaration(node); + return bindBlockScopedDeclaration(node, 524288, 793056); case 215: + return bindEnumDeclaration(node); + case 216: return bindModuleDeclaration(node); - case 218: - case 221: - case 223: - case 227: + case 219: + case 222: + case 224: + case 228: return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); - case 220: + case 221: return bindImportClause(node); - case 225: + case 226: return bindExportDeclaration(node); - case 224: + case 225: return bindExportAssignment(node); - case 245: + case 246: return bindSourceFileIfExternalModule(); } } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512, '"' + ts.removeFileExtension(file.fileName) + '"'); + bindAnonymousDeclaration(file, 512, "\"" + ts.removeFileExtension(file.fileName) + "\""); } } function bindExportAssignment(node) { if (!container.symbol || !container.symbol.exports) { bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } - else if (node.expression.kind === 66) { + else if (node.expression.kind === 67) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } else { @@ -10431,7 +10569,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 211) { + if (node.kind === 212) { bindBlockScopedDeclaration(node, 32, 899519); } else { @@ -10481,7 +10619,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 1, 107455); } if (node.flags & 112 && - node.parent.kind === 141 && + node.parent.kind === 142 && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); @@ -10536,17 +10674,18 @@ var ts; isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, + getBaseTypes: getBaseTypes, getReturnTypeOfSignature: getReturnTypeOfSignature, getSymbolsInScope: getSymbolsInScope, getSymbolAtLocation: getSymbolAtLocation, getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getTypeAtLocation: getTypeAtLocation, + getTypeAtLocation: getTypeOfNode, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -10563,7 +10702,8 @@ var ts; getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, getJsxElementAttributesType: getJsxElementAttributesType, - getJsxIntrinsicTagNames: getJsxIntrinsicTagNames + getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, + isOptionalParameter: isOptionalParameter }; var unknownSymbol = createSymbol(4 | 67108864, "unknown"); var resolvingSymbol = createSymbol(67108864, "__resolving__"); @@ -10571,16 +10711,17 @@ var ts; var stringType = createIntrinsicType(2, "string"); var numberType = createIntrinsicType(4, "number"); var booleanType = createIntrinsicType(8, "boolean"); - var esSymbolType = createIntrinsicType(4194304, "symbol"); + var esSymbolType = createIntrinsicType(16777216, "symbol"); var voidType = createIntrinsicType(16, "void"); - var undefinedType = createIntrinsicType(32 | 1048576, "undefined"); - var nullType = createIntrinsicType(64 | 1048576, "null"); + var undefinedType = createIntrinsicType(32 | 2097152, "undefined"); + var nullType = createIntrinsicType(64 | 2097152, "null"); var unknownType = createIntrinsicType(1, "unknown"); var circularType = createIntrinsicType(1, "__circular__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + anyFunctionType.flags |= 8388608; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); @@ -10624,6 +10765,7 @@ var ts; var emitGenerator = false; var resolutionTargets = []; var resolutionResults = []; + var resolutionPropertyNames = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -10645,7 +10787,7 @@ var ts; }, "symbol": { type: esSymbolType, - flags: 4194304 + flags: 16777216 } }; var JsxNames = { @@ -10658,6 +10800,7 @@ var ts; var subtypeRelation = {}; var assignableRelation = {}; var identityRelation = {}; + var _displayBuilder; initializeTypeChecker(); return checker; function getEmitResolver(sourceFile, cancellationToken) { @@ -10799,10 +10942,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 245); + return ts.getAncestor(node, 246); } function isGlobalSourceFile(node) { - return node.kind === 245 && !ts.isExternalModule(node); + return node.kind === 246 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -10825,7 +10968,7 @@ var ts; if (file1 === file2) { return node1.pos <= node2.pos; } - if (!compilerOptions.out) { + if (!compilerOptions.outFile && !compilerOptions.out) { return true; } var sourceFiles = host.getSourceFiles(); @@ -10850,16 +10993,16 @@ var ts; } } switch (location.kind) { - case 245: + case 246: if (!ts.isExternalModule(location)) break; - case 215: + case 216: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 245 || - (location.kind === 215 && location.name.kind === 8)) { + if (location.kind === 246 || + (location.kind === 216 && location.name.kind === 9)) { if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 && - ts.getDeclarationOfKind(moduleExports[name], 227)) { + ts.getDeclarationOfKind(moduleExports[name], 228)) { break; } result = moduleExports["default"]; @@ -10873,13 +11016,13 @@ var ts; break loop; } break; - case 214: + case 215: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 139: case 138: - case 137: if (ts.isClassLike(location.parent) && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -10889,9 +11032,9 @@ var ts; } } break; - case 211: - case 183: case 212: + case 184: + case 213: 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); @@ -10899,7 +11042,7 @@ var ts; } break loop; } - if (location.kind === 183 && meaning & 32) { + if (location.kind === 184 && meaning & 32) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -10907,28 +11050,28 @@ var ts; } } break; - case 133: + case 134: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 212) { + if (ts.isClassLike(grandparent) || grandparent.kind === 213) { 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 140: - case 139: case 141: + case 140: case 142: case 143: - case 210: - case 171: + case 144: + case 211: + case 172: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 170: + case 171: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -10941,8 +11084,8 @@ var ts; } } break; - case 136: - if (location.parent && location.parent.kind === 135) { + case 137: + if (location.parent && location.parent.kind === 136) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -10968,7 +11111,7 @@ 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) { + if (meaning & 2 && result.flags & 2) { checkResolvedBlockScopedVariable(result, errorLocation); } } @@ -10980,14 +11123,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 208); + var variableDeclaration = ts.getAncestor(declaration, 209); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 190 || - variableDeclaration.parent.parent.kind === 196) { + if (variableDeclaration.parent.parent.kind === 191 || + variableDeclaration.parent.parent.kind === 197) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 198 || - variableDeclaration.parent.parent.kind === 197) { + else if (variableDeclaration.parent.parent.kind === 199 || + variableDeclaration.parent.parent.kind === 198) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -11009,10 +11152,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 218) { + if (node.kind === 219) { return node; } - while (node && node.kind !== 219) { + while (node && node.kind !== 220) { node = node.parent; } return node; @@ -11022,7 +11165,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 229) { + if (node.moduleReference.kind === 230) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -11111,17 +11254,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 218: + case 219: return getTargetOfImportEqualsDeclaration(node); - case 220: - return getTargetOfImportClause(node); case 221: + return getTargetOfImportClause(node); + case 222: return getTargetOfNamespaceImport(node); - case 223: + case 224: return getTargetOfImportSpecifier(node); - case 227: + case 228: return getTargetOfExportSpecifier(node); - case 224: + case 225: return getTargetOfExportAssignment(node); } } @@ -11163,10 +11306,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 224) { + if (node.kind === 225) { checkExpressionCached(node.expression); } - else if (node.kind === 227) { + else if (node.kind === 228) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -11176,17 +11319,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 218); + importDeclaration = ts.getAncestor(entityName, 219); ts.Debug.assert(importDeclaration !== undefined); } - if (entityName.kind === 66 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 67 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 66 || entityName.parent.kind === 132) { + if (entityName.kind === 67 || entityName.parent.kind === 133) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 218); + ts.Debug.assert(entityName.parent.kind === 219); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -11198,16 +11341,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 66) { + if (name.kind === 67) { var message = meaning === 1536 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 132 || name.kind === 163) { - var left = name.kind === 132 ? name.left : name.expression; - var right = name.kind === 132 ? name.right : name.name; + else if (name.kind === 133 || name.kind === 164) { + var left = name.kind === 133 ? name.left : name.expression; + var right = name.kind === 133 ? name.right : name.name; var namespace = resolveEntityName(left, 1536, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -11230,35 +11373,24 @@ var ts; 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) { + if (moduleReferenceExpression.kind !== 9) { return; } var moduleReferenceLiteral = moduleReferenceExpression; var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) + if (!moduleName) { return; + } var isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', 512); + var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512); if (symbol) { return symbol; } } - var fileName; - var sourceFile; - while (true) { - fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); - if (sourceFile || isRelative) { - break; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } + var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); + var sourceFile = fileName && host.getSourceFile(fileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -11354,7 +11486,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 141 && ts.nodeIsPresent(member.body)) { + if (member.kind === 142 && ts.nodeIsPresent(member.body)) { return member; } } @@ -11419,17 +11551,17 @@ var ts; } } switch (location_1.kind) { - case 245: + case 246: if (!ts.isExternalModule(location_1)) { break; } - case 215: + case 216: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 211: case 212: + case 213: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -11462,7 +11594,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 227)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); @@ -11491,7 +11623,7 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 227)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -11546,8 +11678,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 215 && declaration.name.kind === 8) || - (declaration.kind === 245 && ts.isExternalModule(declaration)); + return (declaration.kind === 216 && declaration.name.kind === 9) || + (declaration.kind === 246 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -11579,11 +11711,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 151) { + if (entityName.parent.kind === 152) { meaning = 107455 | 1048576; } - else if (entityName.kind === 132 || entityName.kind === 163 || - entityName.parent.kind === 218) { + else if (entityName.kind === 133 || entityName.kind === 164 || + entityName.parent.kind === 219) { meaning = 1536; } else { @@ -11634,16 +11766,15 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 157) { + while (node.kind === 158) { node = node.parent; } - if (node.kind === 213) { + if (node.kind === 214) { return getSymbolOfNode(node); } } return undefined; } - var _displayBuilder; function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -11652,10 +11783,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 183: + case 184: return "(Anonymous class)"; - case 170: case 171: + case 172: return "(Anonymous function)"; } } @@ -11676,7 +11807,7 @@ var ts; buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 20); + writePunctuation(writer, 21); } parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); @@ -11718,7 +11849,7 @@ var ts; var globalFlagsToPass = globalFlags & 16; return writeType(type, globalFlags); function writeType(type, flags) { - if (type.flags & 4194431) { + if (type.flags & 16777343) { writer.writeKeyword(!(globalFlags & 16) && isTypeAny(type) ? "any" : type.intrinsicName); @@ -11742,23 +11873,23 @@ var ts; writer.writeStringLiteral(type.text); } else { - writePunctuation(writer, 14); + writePunctuation(writer, 15); writeSpace(writer); - writePunctuation(writer, 21); + writePunctuation(writer, 22); writeSpace(writer); - writePunctuation(writer, 15); + writePunctuation(writer, 16); } } function writeTypeList(types, delimiter) { for (var i = 0; i < types.length; i++) { if (i > 0) { - if (delimiter !== 23) { + if (delimiter !== 24) { writeSpace(writer); } writePunctuation(writer, delimiter); writeSpace(writer); } - writeType(types[i], delimiter === 23 ? 0 : 64); + writeType(types[i], delimiter === 24 ? 0 : 64); } } function writeSymbolTypeReference(symbol, typeArguments, pos, end) { @@ -11766,22 +11897,22 @@ var ts; buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056); } if (pos < end) { - writePunctuation(writer, 24); + writePunctuation(writer, 25); writeType(typeArguments[pos++], 0); while (pos < end) { - writePunctuation(writer, 23); + writePunctuation(writer, 24); writeSpace(writer); writeType(typeArguments[pos++], 0); } - writePunctuation(writer, 26); + writePunctuation(writer, 27); } } function writeTypeReference(type, flags) { var typeArguments = type.typeArguments; if (type.target === globalArrayType && !(flags & 1)) { writeType(typeArguments[0], 64); - writePunctuation(writer, 18); writePunctuation(writer, 19); + writePunctuation(writer, 20); } else { var outerTypeParameters = type.target.outerTypeParameters; @@ -11796,7 +11927,7 @@ var ts; } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent_3); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { writeSymbolTypeReference(parent_3, typeArguments, start, i); - writePunctuation(writer, 20); + writePunctuation(writer, 21); } } } @@ -11804,17 +11935,17 @@ var ts; } } function writeTupleType(type) { - writePunctuation(writer, 18); - writeTypeList(type.elementTypes, 23); writePunctuation(writer, 19); + writeTypeList(type.elementTypes, 24); + writePunctuation(writer, 20); } function writeUnionOrIntersectionType(type, flags) { if (flags & 64) { - writePunctuation(writer, 16); + writePunctuation(writer, 17); } - writeTypeList(type.types, type.flags & 16384 ? 45 : 44); + writeTypeList(type.types, type.flags & 16384 ? 46 : 45); if (flags & 64) { - writePunctuation(writer, 17); + writePunctuation(writer, 18); } } function writeAnonymousType(type, flags) { @@ -11832,7 +11963,7 @@ var ts; buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); } else { - writeKeyword(writer, 114); + writeKeyword(writer, 115); } } else { @@ -11853,7 +11984,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 245 || declaration.parent.kind === 216; + return declaration.parent.kind === 246 || declaration.parent.kind === 217; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -11862,7 +11993,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 98); + writeKeyword(writer, 99); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); } @@ -11878,74 +12009,74 @@ var ts; var resolved = resolveStructuredTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { - writePunctuation(writer, 14); writePunctuation(writer, 15); + writePunctuation(writer, 16); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { if (flags & 64) { - writePunctuation(writer, 16); + writePunctuation(writer, 17); } buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); if (flags & 64) { - writePunctuation(writer, 17); + writePunctuation(writer, 18); } return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { if (flags & 64) { - writePunctuation(writer, 16); + writePunctuation(writer, 17); } - writeKeyword(writer, 89); + writeKeyword(writer, 90); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, symbolStack); if (flags & 64) { - writePunctuation(writer, 17); + writePunctuation(writer, 18); } return; } } - writePunctuation(writer, 14); + writePunctuation(writer, 15); writer.writeLine(); writer.increaseIndent(); for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 89); + writeKeyword(writer, 90); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } if (resolved.stringIndexType) { - writePunctuation(writer, 18); + writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); - writePunctuation(writer, 52); + writePunctuation(writer, 53); writeSpace(writer); - writeKeyword(writer, 127); - writePunctuation(writer, 19); - writePunctuation(writer, 52); + writeKeyword(writer, 128); + writePunctuation(writer, 20); + writePunctuation(writer, 53); writeSpace(writer); writeType(resolved.stringIndexType, 0); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } if (resolved.numberIndexType) { - writePunctuation(writer, 18); + writePunctuation(writer, 19); writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); - writePunctuation(writer, 52); + writePunctuation(writer, 53); writeSpace(writer); - writeKeyword(writer, 125); - writePunctuation(writer, 19); - writePunctuation(writer, 52); + writeKeyword(writer, 126); + writePunctuation(writer, 20); + writePunctuation(writer, 53); writeSpace(writer); writeType(resolved.numberIndexType, 0); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { @@ -11957,27 +12088,27 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 51); + writePunctuation(writer, 52); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } } else { buildSymbolDisplay(p, writer); if (p.flags & 536870912) { - writePunctuation(writer, 51); + writePunctuation(writer, 52); } - writePunctuation(writer, 52); + writePunctuation(writer, 53); writeSpace(writer); writeType(t, 0); - writePunctuation(writer, 22); + writePunctuation(writer, 23); writer.writeLine(); } } writer.decreaseIndent(); - writePunctuation(writer, 15); + writePunctuation(writer, 16); } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -11991,7 +12122,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 80); + writeKeyword(writer, 81); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -11999,67 +12130,67 @@ var ts; function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; if (ts.isRestParameter(parameterNode)) { - writePunctuation(writer, 21); + writePunctuation(writer, 22); } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 51); + writePunctuation(writer, 52); } - writePunctuation(writer, 52); + writePunctuation(writer, 53); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24); + writePunctuation(writer, 25); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23); + writePunctuation(writer, 24); writeSpace(writer); } buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 26); + writePunctuation(writer, 27); } } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24); + writePunctuation(writer, 25); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23); + writePunctuation(writer, 24); writeSpace(writer); } buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0); } - writePunctuation(writer, 26); + writePunctuation(writer, 27); } } function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { - writePunctuation(writer, 16); + writePunctuation(writer, 17); for (var i = 0; i < parameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23); + writePunctuation(writer, 24); writeSpace(writer); } buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 17); + writePunctuation(writer, 18); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8) { writeSpace(writer); - writePunctuation(writer, 33); + writePunctuation(writer, 34); } else { - writePunctuation(writer, 52); + writePunctuation(writer, 53); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 121); + writeKeyword(writer, 122); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -12079,15 +12210,12 @@ var ts; buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } 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 @@ -12096,12 +12224,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 215) { - if (node.name.kind === 8) { + if (node.kind === 216) { + if (node.name.kind === 9) { return node; } } - else if (node.kind === 245) { + else if (node.kind === 246) { return ts.isExternalModule(node) ? node : undefined; } } @@ -12144,59 +12272,59 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 160: + case 161: return isDeclarationVisible(node.parent.parent); - case 208: + case 209: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 215: - case 211: + case 216: case 212: case 213: - case 210: case 214: - case 218: + case 211: + case 215: + case 219: var parent_4 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 218 && parent_4.kind !== 245 && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 219 && parent_4.kind !== 246 && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } return isDeclarationVisible(parent_4); + case 139: case 138: - case 137: - case 142: case 143: + case 144: + case 141: case 140: - case 139: if (node.flags & (32 | 64)) { return false; } - case 141: - case 145: - case 144: + case 142: case 146: - case 135: - case 216: - case 149: + case 145: + case 147: + case 136: + case 217: case 150: - case 152: - case 148: + case 151: case 153: + case 149: case 154: case 155: case 156: case 157: + case 158: return isDeclarationVisible(node.parent); - case 220: case 221: - case 223: + case 222: + case 224: return false; - case 134: - case 245: + case 135: + case 246: return true; - case 224: + case 225: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -12212,11 +12340,14 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 224) { - exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); + if (node.parent && node.parent.kind === 225) { + exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 227) { - exportSymbol = getTargetOfExportSpecifier(node.parent); + else if (node.parent.kind === 228) { + var exportSpecifier = node.parent; + exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? + getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : + resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, 107455 | 793056 | 1536 | 8388608); } var result = []; if (exportSymbol) { @@ -12239,29 +12370,55 @@ var ts; }); } } - function pushTypeResolution(target) { - var i = 0; - var count = resolutionTargets.length; - while (i < count && resolutionTargets[i] !== target) { - i++; - } - if (i < count) { - do { - resolutionResults[i++] = false; - } while (i < count); + function pushTypeResolution(target, propertyName) { + var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); + if (resolutionCycleStartIndex >= 0) { + var length_2 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_2; i++) { + resolutionResults[i] = false; + } return false; } resolutionTargets.push(target); resolutionResults.push(true); + resolutionPropertyNames.push(propertyName); return true; } + function findResolutionCycleStartIndex(target, propertyName) { + for (var i = resolutionTargets.length - 1; i >= 0; i--) { + if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) { + return -1; + } + if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) { + return i; + } + } + return -1; + } + function hasType(target, propertyName) { + if (propertyName === 0) { + return getSymbolLinks(target).type; + } + if (propertyName === 2) { + return getSymbolLinks(target).declaredType; + } + if (propertyName === 1) { + ts.Debug.assert(!!(target.flags & 1024)); + return target.resolvedBaseConstructorType; + } + if (propertyName === 3) { + return target.resolvedReturnType; + } + ts.Debug.fail("Unhandled TypeSystemPropertyName " + propertyName); + } function popTypeResolution() { resolutionTargets.pop(); + resolutionPropertyNames.pop(); return resolutionResults.pop(); } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); - return node.kind === 208 ? node.parent.parent.parent : node.parent; + return node.kind === 209 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -12287,7 +12444,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 158) { + if (pattern.kind === 159) { var name_11 = declaration.propertyName || declaration.name; type = getTypeOfPropertyOfType(parentType, name_11.text) || isNumericLiteralName(name_11.text) && getIndexTypeOfType(parentType, 1) || @@ -12300,9 +12457,6 @@ var ts; else { var elementType = checkIteratedTypeOrElementType(parentType, pattern, false); if (!declaration.dotDotDotToken) { - if (isTypeAny(elementType)) { - return elementType; - } var propName = "" + ts.indexOf(pattern.elements, declaration); type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) @@ -12324,10 +12478,10 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 197) { + if (declaration.parent.parent.kind === 198) { return anyType; } - if (declaration.parent.parent.kind === 198) { + if (declaration.parent.parent.kind === 199) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -12336,10 +12490,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 135) { + if (declaration.kind === 136) { var func = declaration.parent; - if (func.kind === 143 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 142); + if (func.kind === 144 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -12352,9 +12506,12 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 243) { + if (declaration.kind === 244) { return checkIdentifier(declaration.name); } + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name); + } return undefined; } function getTypeFromBindingElement(element) { @@ -12381,7 +12538,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 184 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 185 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -12396,7 +12553,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 158 + return pattern.kind === 159 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } @@ -12406,15 +12563,12 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 242 ? getWidenedType(type) : type; - } - if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return declaration.kind !== 243 ? getWidenedType(type) : type; } type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 135 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 136 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -12427,13 +12581,13 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 241) { + if (declaration.parent.kind === 242) { return links.type = anyType; } - if (declaration.kind === 224) { + if (declaration.kind === 225) { return links.type = checkExpression(declaration.expression); } - if (!pushTypeResolution(symbol)) { + if (!pushTypeResolution(symbol, 0)) { return unknownType; } var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); @@ -12455,7 +12609,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 142) { + if (accessor.kind === 143) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -12468,11 +12622,11 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (!pushTypeResolution(symbol)) { + if (!pushTypeResolution(symbol, 0)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 142); - var setter = ts.getDeclarationOfKind(symbol, 143); + var getter = ts.getDeclarationOfKind(symbol, 143); + var setter = ts.getDeclarationOfKind(symbol, 144); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -12498,7 +12652,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 142); + var getter_1 = ts.getDeclarationOfKind(symbol, 143); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -12587,9 +12741,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 211 || node.kind === 183 || - node.kind === 210 || node.kind === 170 || - node.kind === 140 || node.kind === 171) { + if (node.kind === 212 || node.kind === 184 || + node.kind === 211 || node.kind === 171 || + node.kind === 141 || node.kind === 172) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -12598,15 +12752,15 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 212); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213); return appendOuterTypeParameters(undefined, declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 212 || node.kind === 211 || - node.kind === 183 || node.kind === 213) { + if (node.kind === 213 || node.kind === 212 || + node.kind === 184 || node.kind === 214) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -12642,7 +12796,7 @@ var ts; if (!baseTypeNode) { return type.resolvedBaseConstructorType = undefinedType; } - if (!pushTypeResolution(type)) { + if (!pushTypeResolution(type, 1)) { return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); @@ -12711,7 +12865,7 @@ var ts; type.resolvedBaseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 212 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 213 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -12755,10 +12909,10 @@ var ts; function getDeclaredTypeOfTypeAlias(symbol) { var links = getSymbolLinks(symbol); if (!links.declaredType) { - if (!pushTypeResolution(links)) { + if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 213); + var declaration = ts.getDeclarationOfKind(symbol, 214); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -12789,7 +12943,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 134).constraint) { + if (!ts.getDeclarationOfKind(symbol, 135).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -12956,39 +13110,60 @@ var ts; 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; + function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + for (var _i = 0; _i < signatureList.length; _i++) { + var s = signatureList[_i]; + if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { + return s; } } - 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++) { - var signature = signatures[_i]; - if (signature.typeParameters) { - return emptyArray; + function findMatchingSignatures(signatureLists, signature, listIndex) { + if (signature.typeParameters) { + if (listIndex > 0) { + return undefined; } - } - for (var i_1 = 1; i_1 < signatureLists.length; i_1++) { - if (!signatureListsIdentical(signatures, signatureLists[i_1])) { - return emptyArray; + for (var i = 1; i < signatureLists.length; i++) { + if (!findMatchingSignature(signatureLists[i], signature, false, false)) { + return undefined; + } } + return [signature]; } - 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]; }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, true, true); + if (!match) { + return undefined; + } + if (!ts.contains(result, match)) { + (result || (result = [])).push(match); + } } return result; } + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { + var signature = _a[_i]; + if (!result || !findMatchingSignature(result, signature, false, true)) { + var unionSignatures = findMatchingSignatures(signatureLists, signature, i); + if (unionSignatures) { + var s = signature; + if (unionSignatures.length > 1) { + s = cloneSignature(signature); + s.resolvedReturnType = undefined; + s.unionSignatures = unionSignatures; + } + (result || (result = [])).push(s); + } + } + } + } + return result || emptyArray; + } function getUnionIndexType(types, kind) { var indexTypes = []; for (var _i = 0; _i < types.length; _i++) { @@ -13124,9 +13299,6 @@ var ts; return type.flags & 49152 ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } function getApparentType(type) { - if (type.flags & 16384) { - type = getReducedTypeOfUnionType(type); - } if (type.flags & 512) { do { type = getConstraintOfTypeParameter(type); @@ -13144,7 +13316,7 @@ var ts; else if (type.flags & 8) { type = globalBooleanType; } - else if (type.flags & 4194304) { + else if (type.flags & 16777216) { type = globalESSymbolType; } return type; @@ -13225,6 +13397,25 @@ var ts; } return undefined; } + function isKnownProperty(type, name) { + if (type.flags & 80896 && type !== globalObjectType) { + var resolved = resolveStructuredTypeMembers(type); + return !!(resolved.properties.length === 0 || + resolved.stringIndexType || + resolved.numberIndexType || + getPropertyOfType(type, name)); + } + if (type.flags & 49152) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } function getSignaturesOfStructuredType(type, kind) { if (type.flags & 130048) { var resolved = resolveStructuredTypeMembers(type); @@ -13280,12 +13471,22 @@ var ts; return result; } function isOptionalParameter(node) { - return ts.hasQuestionToken(node) || !!node.initializer; + if (ts.hasQuestionToken(node)) { + return true; + } + if (node.initializer) { + var signatureDeclaration = node.parent; + var signature = getSignatureFromDeclaration(signatureDeclaration); + var parameterIndex = signatureDeclaration.parameters.indexOf(node); + ts.Debug.assert(parameterIndex >= 0); + return parameterIndex >= signature.minArgumentCount; + } + return false; } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 141 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 142 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -13294,14 +13495,17 @@ 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) { + if (param.type && param.type.kind === 9) { hasStringLiterals = true; } - if (minArgumentCount < 0) { - if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (minArgumentCount < 0) { minArgumentCount = i; } } + else { + minArgumentCount = -1; + } } if (minArgumentCount < 0) { minArgumentCount = declaration.parameters.length; @@ -13313,7 +13517,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 147) { + if (declaration.type.kind === 148) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -13323,8 +13527,8 @@ var ts; } } else { - if (declaration.kind === 142 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 143); + if (declaration.kind === 143 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 144); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -13342,19 +13546,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 149: case 150: - case 210: - case 140: - case 139: + case 151: + case 211: case 141: - case 144: + case 140: + case 142: case 145: case 146: - case 142: + case 147: case 143: - case 170: + case 144: case 171: + case 172: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -13368,7 +13572,7 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - if (!pushTypeResolution(signature)) { + if (!pushTypeResolution(signature, 3)) { return unknownType; } var type; @@ -13424,7 +13628,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 141 || signature.declaration.kind === 145; + var isConstructor = signature.declaration.kind === 142 || signature.declaration.kind === 146; var type = createObjectType(65536 | 262144); type.members = emptySymbols; type.properties = emptyArray; @@ -13438,7 +13642,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 125 : 127; + var syntaxKind = kind === 1 ? 126 : 128; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -13467,13 +13671,13 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 134).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 134).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135).parent); } function getTypeListId(types) { switch (types.length) { @@ -13492,19 +13696,19 @@ var ts; return result; } } - function getWideningFlagsOfTypes(types) { + function getPropagatingFlagsOfTypes(types) { var result = 0; for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } - return result & 3145728; + return result & 14680064; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 | getWideningFlagsOfTypes(typeArguments); + var flags = 4096 | getPropagatingFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -13520,13 +13724,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 134; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 148 && n.typeName.kind === 66) { + if (n.kind === 149 && n.typeName.kind === 67) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -13593,7 +13797,7 @@ var ts; function getTypeFromTypeReference(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - var typeNameOrExpression = node.kind === 148 ? node.typeName : + var typeNameOrExpression = node.kind === 149 ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056) || unknownSymbol; @@ -13619,9 +13823,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 211: case 212: - case 214: + case 213: + case 215: return declaration; } } @@ -13694,7 +13898,7 @@ var ts; var id = getTypeListId(elementTypes); var type = tupleTypes[id]; if (!type) { - type = tupleTypes[id] = createObjectType(8192 | getWideningFlagsOfTypes(elementTypes)); + type = tupleTypes[id] = createObjectType(8192 | getPropagatingFlagsOfTypes(elementTypes)); type.elementTypes = elementTypes; } return type; @@ -13720,20 +13924,68 @@ var ts; addTypeToSet(typeSet, type, typeSetKind); } } - function isSubtypeOfAny(candidate, types) { + function isObjectLiteralTypeDuplicateOf(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return false; + } + for (var _i = 0; _i < sourceProperties.length; _i++) { + var sourceProp = sourceProperties[_i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp || + getDeclarationFlagsFromSymbol(targetProp) & (32 | 64) || + !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { + return false; + } + } + return true; + } + function isTupleTypeDuplicateOf(source, target) { + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + if (sourceTypes.length !== targetTypes.length) { + return false; + } + for (var i = 0; i < sourceTypes.length; i++) { + if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { + return false; + } + } + return true; + } + function isTypeDuplicateOf(source, target) { + if (source === target) { + return true; + } + if (source.flags & 32 || source.flags & 64 && !(target.flags & 32)) { + return true; + } + if (source.flags & 524288 && target.flags & 80896) { + return isObjectLiteralTypeDuplicateOf(source, target); + } + if (isArrayType(source) && isArrayType(target)) { + return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]); + } + if (isTupleType(source) && isTupleType(target)) { + return isTupleTypeDuplicateOf(source, target); + } + return isTypeIdenticalTo(source, target); + } + function isTypeDuplicateOfSomeType(candidate, types) { for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; - if (candidate !== type && isTypeSubtypeOf(candidate, type)) { + if (candidate !== type && isTypeDuplicateOf(candidate, type)) { return true; } } return false; } - function removeSubtypes(types) { + function removeDuplicateTypes(types) { var i = types.length; while (i > 0) { i--; - if (isSubtypeOfAny(types[i], types)) { + if (isTypeDuplicateOfSomeType(types[i], types)) { types.splice(i, 1); } } @@ -13756,25 +14008,21 @@ var ts; } } } - function compareTypeIds(type1, type2) { - return type1.id - type2.id; - } - function getUnionType(types, noSubtypeReduction) { + function getUnionType(types, noDeduplication) { if (types.length === 0) { return emptyObjectType; } var typeSet = []; addTypesToSet(typeSet, types, 16384); - typeSet.sort(compareTypeIds); - if (noSubtypeReduction) { - if (containsTypeAny(typeSet)) { - return anyType; - } + if (containsTypeAny(typeSet)) { + return anyType; + } + if (noDeduplication) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeSubtypes(typeSet); + removeDuplicateTypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -13782,25 +14030,11 @@ var ts; var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 | getWideningFlagsOfTypes(typeSet)); + type = unionTypes[id] = createObjectType(16384 | getPropagatingFlagsOfTypes(typeSet)); type.types = typeSet; - type.reducedType = noSubtypeReduction ? undefined : type; } return type; } - function getReducedTypeOfUnionType(type) { - if (!type.reducedType) { - type.reducedType = circularType; - var reducedType = getUnionType(type.types, false); - if (type.reducedType === circularType) { - type.reducedType = reducedType; - } - } - else if (type.reducedType === circularType) { - type.reducedType = type; - } - return type.reducedType; - } function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { @@ -13823,7 +14057,7 @@ var ts; var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 | getWideningFlagsOfTypes(typeSet)); + type = intersectionTypes[id] = createObjectType(32768 | getPropagatingFlagsOfTypes(typeSet)); type.types = typeSet; } return type; @@ -13859,45 +14093,45 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 114: + case 115: return anyType; - case 127: + case 128: return stringType; - case 125: + case 126: return numberType; - case 117: + case 118: return booleanType; - case 128: + case 129: return esSymbolType; - case 100: + case 101: return voidType; - case 8: + case 9: return getTypeFromStringLiteral(node); - case 148: + case 149: return getTypeFromTypeReference(node); - case 147: + case 148: return booleanType; - case 185: + case 186: return getTypeFromTypeReference(node); - case 151: + case 152: return getTypeFromTypeQueryNode(node); - case 153: - return getTypeFromArrayTypeNode(node); case 154: - return getTypeFromTupleTypeNode(node); + return getTypeFromArrayTypeNode(node); case 155: - return getTypeFromUnionTypeNode(node); + return getTypeFromTupleTypeNode(node); case 156: - return getTypeFromIntersectionTypeNode(node); + return getTypeFromUnionTypeNode(node); case 157: + return getTypeFromIntersectionTypeNode(node); + case 158: return getTypeFromTypeNode(node.type); - case 149: case 150: - case 152: + case 151: + case 153: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 66: - case 132: - var symbol = getSymbolInfo(node); + case 67: + case 133: + var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType; @@ -13956,7 +14190,7 @@ var ts; }; } function createInferenceMapper(context) { - return function (t) { + var mapper = function (t) { for (var i = 0; i < context.typeParameters.length; i++) { if (t === context.typeParameters[i]) { context.inferences[i].isFixed = true; @@ -13965,6 +14199,8 @@ var ts; } return t; }; + mapper.context = context; + return mapper; } function identityMapper(type) { return type; @@ -14058,27 +14294,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 140 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 170: case 171: + case 172: return isContextSensitiveFunctionLikeDeclaration(node); - case 162: + case 163: return ts.forEach(node.properties, isContextSensitive); - case 161: + case 162: return ts.forEach(node.elements, isContextSensitive); - case 179: + case 180: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 178: - return node.operatorToken.kind === 50 && + case 179: + return node.operatorToken.kind === 51 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 242: + case 243: return isContextSensitive(node.initializer); + case 141: case 140: - case 139: return isContextSensitiveFunctionLikeDeclaration(node); - case 169: + case 170: return isContextSensitive(node.expression); } return false; @@ -14152,99 +14388,135 @@ var ts; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } + function reportRelationError(message, source, target) { + var sourceType = typeToString(source); + var targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, undefined, 128); + targetType = typeToString(target, undefined, 128); + } + reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + } function isRelatedTo(source, target, reportErrors, headMessage) { var result; if (source === target) return -1; - if (relation !== identityRelation) { - if (isTypeAny(target)) - return -1; - if (source === undefinedType) - return -1; - if (source === nullType && target !== undefinedType) - return -1; - if (source.flags & 128 && target === numberType) + if (relation === identityRelation) { + return isIdenticalTo(source, target); + } + if (isTypeAny(target)) + 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 (isTypeAny(source)) return -1; - if (source.flags & 256 && target === stringType) + if (source === numberType && target.flags & 128) return -1; - if (relation === assignableRelation) { - if (isTypeAny(source)) - return -1; - if (source === numberType && target.flags & 128) - return -1; + } + if (source.flags & 1048576) { + if (hasExcessProperties(source, target, reportErrors)) { + if (reportErrors) { + reportRelationError(headMessage, source, target); + } + return 0; } + source = getRegularTypeOfObjectLiteral(source); } var saveErrorInfo = errorInfo; - if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + if (source.flags & 16384) { + if (result = eachTypeRelatedToType(source, target, reportErrors)) { return result; } } - else if (source.flags & 512 && target.flags & 512) { - if (result = typeParameterRelatedTo(source, target, reportErrors)) { + else if (target.flags & 32768) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - else if (relation !== identityRelation) { - if (source.flags & 16384) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + else { + if (source.flags & 32768) { + if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384))) { return result; } } - else if (target.flags & 32768) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + if (target.flags & 16384) { + if (result = typeRelatedToSomeType(source, target, reportErrors)) { return result; } } - else { - if (source.flags & 32768) { - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384))) { - return result; - } - } - if (target.flags & 16384) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { - return result; - } - } - } } - else { - if (source.flags & 16384 && target.flags & 16384 || - source.flags & 32768 && target.flags & 32768) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { - return result; - } - } + if (source.flags & 512) { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1) { + constraint = emptyObjectType; } - } - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & (80896 | 32768) && target.flags & 80896) { - if (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors)) { + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { errorInfo = saveErrorInfo; return result; } } - else if (source.flags & 512 && sourceOrApparentType.flags & 49152) { - errorInfo = saveErrorInfo; - if (result = isRelatedTo(sourceOrApparentType, target, reportErrors)) { - return result; + else { + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; + } + } + var apparentType = getApparentType(source); + if (apparentType.flags & (80896 | 32768) && target.flags & 80896) { + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; + if (result = objectTypeRelatedTo(apparentType, target, reportStructuralErrors)) { + 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); + reportRelationError(headMessage, source, target); + } + return 0; + } + function isIdenticalTo(source, target) { + var result; + if (source.flags & 80896 && target.flags & 80896) { + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, false)) { + return result; + } + } + return objectTypeRelatedTo(source, target, false); + } + if (source.flags & 512 && target.flags & 512) { + return typeParameterIdenticalTo(source, target); + } + if (source.flags & 16384 && target.flags & 16384 || + source.flags & 32768 && target.flags & 32768) { + if (result = eachTypeRelatedToSomeType(source, target)) { + if (result &= eachTypeRelatedToSomeType(target, source)) { + return result; + } } - reportError(headMessage, sourceType, targetType); } return 0; } + function hasExcessProperties(source, target, reportErrors) { + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (!isKnownProperty(target, prop.name)) { + if (reportErrors) { + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } + return true; + } + } + } function eachTypeRelatedToSomeType(source, target) { var result = -1; var sourceTypes = source.types; @@ -14315,30 +14587,17 @@ var ts; } 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); + function typeParameterIdenticalTo(source, target) { + if (source.symbol.name !== target.symbol.name) { + return 0; } - else { - while (true) { - var constraint = getConstraintOfTypeParameter(source); - if (constraint === target) - return -1; - if (!(constraint && constraint.flags & 512)) - break; - source = constraint; - } + if (source.constraint === target.constraint) { + return -1; + } + if (source.constraint === noConstraintType || target.constraint === noConstraintType) { return 0; } + return isIdenticalTo(source.constraint, target.constraint); } function objectTypeRelatedTo(source, target, reportErrors) { if (overflow) { @@ -14515,22 +14774,12 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1; var saveErrorInfo = errorInfo; - var sourceSig = sourceSignatures[0]; - var targetSig = targetSignatures[0]; - if (sourceSig && targetSig) { - var sourceErasedSignature = getErasedSignature(sourceSig); - var targetErasedSignature = getErasedSignature(targetSig); - var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); - var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; - if (sourceIsAbstract && !targetIsAbstract) { - if (reportErrors) { - reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - } - return 0; + if (kind === 1) { + var sourceSig = sourceSignatures[0]; + var targetSig = targetSignatures[0]; + result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig); + if (result !== -1) { + return result; } } outer: for (var _i = 0; _i < targetSignatures.length; _i++) { @@ -14554,6 +14803,30 @@ var ts; } } return result; + function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { + if (sourceSig && targetSig) { + var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212); + var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212); + if (!sourceDecl) { + return -1; + } + var sourceErasedSignature = getErasedSignature(sourceSig); + var targetErasedSignature = getErasedSignature(targetSig); + var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); + var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212); + var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256; + var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256; + if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0; + } + } + return -1; + } } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -14642,7 +14915,7 @@ var ts; } var result = -1; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], false, false, isRelatedTo); if (!related) { return 0; } @@ -14655,7 +14928,7 @@ var ts; return indexTypesIdenticalTo(0, source, target); } var targetType = getIndexTypeOfType(target, 0); - if (targetType) { + if (targetType && !(targetType.flags & 1)) { var sourceType = getIndexTypeOfType(source, 0); if (!sourceType) { if (reportErrors) { @@ -14679,7 +14952,7 @@ var ts; return indexTypesIdenticalTo(1, source, target); } var targetType = getIndexTypeOfType(target, 1); - if (targetType) { + if (targetType && !(targetType.flags & 1)) { var sourceStringType = getIndexTypeOfType(source, 0); var sourceNumberType = getIndexTypeOfType(source, 1); if (!(sourceStringType || sourceNumberType)) { @@ -14756,14 +15029,18 @@ var ts; } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } - function compareSignatures(source, target, compareReturnTypes, compareTypes) { + function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { if (source === target) { return -1; } if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { - return 0; + if (!partialMatch || + source.parameters.length < target.parameters.length && !source.hasRestParameter || + source.minArgumentCount > target.minArgumentCount) { + return 0; + } } var result = -1; if (source.typeParameters && target.typeParameters) { @@ -14783,16 +15060,18 @@ var ts; } 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 sourceLen = source.parameters.length; + var targetLen = target.parameters.length; + for (var i = 0; i < targetLen; i++) { + var s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0; } result &= related; } - if (compareReturnTypes) { + if (!ignoreReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } return result; @@ -14847,6 +15126,23 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192); } + function getRegularTypeOfObjectLiteral(type) { + if (type.flags & 1048576) { + var regularType = type.regularType; + if (!regularType) { + regularType = createType(type.flags & ~1048576); + regularType.symbol = type.symbol; + regularType.members = type.members; + regularType.properties = type.properties; + regularType.callSignatures = type.callSignatures; + regularType.constructSignatures = type.constructSignatures; + regularType.stringIndexType = type.stringIndexType; + regularType.numberIndexType = type.numberIndexType; + } + return regularType; + } + return type; + } function getWidenedTypeOfObjectLiteral(type) { var properties = getPropertiesOfObjectType(type); var members = {}; @@ -14874,7 +15170,7 @@ var ts; return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); } function getWidenedType(type) { - if (type.flags & 3145728) { + if (type.flags & 6291456) { if (type.flags & (32 | 64)) { return anyType; } @@ -14918,7 +15214,7 @@ var ts; for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); - if (t.flags & 1048576) { + if (t.flags & 2097152) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -14932,22 +15228,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 139: case 138: - case 137: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 135: + case 136: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 210: + case 211: + case 141: case 140: - case 139: - case 142: case 143: - case 170: + case 144: case 171: + case 172: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -14960,7 +15256,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 1048576) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152) { if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); } @@ -14996,7 +15292,9 @@ var ts; var inferences = []; for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; - inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); + inferences.push({ + primary: undefined, secondary: undefined, isFixed: false + }); } return { typeParameters: typeParameters, @@ -15020,10 +15318,10 @@ var ts; return false; } function inferFromTypes(source, target) { - if (source === anyFunctionType) { - return; - } if (target.flags & 512) { + if (source.flags & 8388608) { + return; + } var typeParameters = context.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { @@ -15047,6 +15345,13 @@ var ts; inferFromTypes(sourceTypes[i], targetTypes[i]); } } + else if (source.flags & 8192 && target.flags & 8192 && source.elementTypes.length === target.elementTypes.length) { + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } else if (target.flags & 49152) { var targetTypes = target.types; var typeParameterCount = 0; @@ -15190,10 +15495,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 151: + case 152: return true; - case 66: - case 132: + case 67: + case 133: node = node.parent; continue; default: @@ -15233,12 +15538,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 54 && node.operatorToken.kind <= 65) { + if (node.operatorToken.kind >= 55 && node.operatorToken.kind <= 66) { var n = node.left; - while (n.kind === 169) { + while (n.kind === 170) { n = n.expression; } - if (n.kind === 66 && getResolvedSymbol(n) === symbol) { + if (n.kind === 67 && getResolvedSymbol(n) === symbol) { return true; } } @@ -15252,82 +15557,60 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 178: + case 179: return isAssignedInBinaryExpression(node); - case 208: - case 160: + case 209: + case 161: return isAssignedInVariableDeclaration(node); - case 158: case 159: - case 161: + case 160: case 162: case 163: case 164: case 165: case 166: - case 168: - case 186: + case 167: case 169: - case 176: - case 172: - case 175: + case 187: + case 170: + case 177: case 173: + case 176: case 174: - case 177: - case 181: - case 179: + case 175: + case 178: case 182: - case 189: + case 180: + case 183: case 190: - case 192: + case 191: case 193: case 194: case 195: case 196: case 197: case 198: - case 201: + case 199: case 202: case 203: - case 238: - case 239: case 204: + case 239: + case 240: case 205: case 206: - case 241: - case 230: + case 207: + case 242: case 231: - case 235: - case 236: case 232: + case 236: case 237: + case 233: + case 238: return ts.forEachChild(node, isAssignedIn); } return false; } } - function resolveLocation(node) { - var containerNodes = []; - for (var parent_5 = node.parent; parent_5; parent_5 = parent_5.parent) { - if ((ts.isExpression(parent_5) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(parent_5)) { - containerNodes.unshift(parent_5); - } - } - 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) { @@ -15337,34 +15620,34 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 193: + case 194: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 179: + case 180: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 178: + case 179: if (child === node.right) { - if (node.operatorToken.kind === 49) { + if (node.operatorToken.kind === 50) { narrowedType = narrowType(type, node.left, true); } - else if (node.operatorToken.kind === 50) { + else if (node.operatorToken.kind === 51) { narrowedType = narrowType(type, node.left, false); } } break; - case 245: - case 215: - case 210: + case 246: + case 216: + case 211: + case 141: case 140: - case 139: - case 142: case 143: - case 141: + case 144: + case 142: break loop; } if (narrowedType !== type) { @@ -15378,21 +15661,21 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 173 || expr.right.kind !== 8) { + if (expr.left.kind !== 174 || expr.right.kind !== 9) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 66 || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 67 || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operatorToken.kind === 32) { + if (expr.operatorToken.kind === 33) { assumeTrue = !assumeTrue; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8 | 4194304, true, false); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 16777216, true, false); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; @@ -15429,7 +15712,7 @@ var ts; } } function narrowTypeByInstanceof(type, expr, assumeTrue) { - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 66 || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 || getResolvedSymbol(expr.left) !== symbol) { return type; } var rightType = checkExpression(expr.right); @@ -15462,11 +15745,14 @@ var ts; return type; } function getNarrowedType(originalType, narrowedTypeCandidate) { - if (isTypeSubtypeOf(narrowedTypeCandidate, originalType)) { - return narrowedTypeCandidate; - } if (originalType.flags & 16384) { - return getUnionType(ts.filter(originalType.types, function (t) { return isTypeSubtypeOf(t, narrowedTypeCandidate); })); + var assignableConstituents = ts.filter(originalType.types, function (t) { return isTypeAssignableTo(t, narrowedTypeCandidate); }); + if (assignableConstituents.length) { + return getUnionType(assignableConstituents); + } + } + if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { + return narrowedTypeCandidate; } return originalType; } @@ -15490,27 +15776,27 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 165: + case 166: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 169: + case 170: return narrowType(type, expr.expression, assumeTrue); - case 178: + case 179: var operator = expr.operatorToken.kind; - if (operator === 31 || operator === 32) { + if (operator === 32 || operator === 33) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 49) { + else if (operator === 50) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 50) { + else if (operator === 51) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 88) { + else if (operator === 89) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 176: - if (expr.operator === 47) { + case 177: + if (expr.operator === 48) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -15522,7 +15808,7 @@ var ts; var symbol = getResolvedSymbol(node); if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 171) { + if (container.kind === 172) { if (languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -15553,15 +15839,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 241) { + symbol.valueDeclaration.parent.kind === 242) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 209) { + while (container.kind !== 210) { container = container.parent; } container = container.parent; - if (container.kind === 190) { + if (container.kind === 191) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -15579,7 +15865,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 138 || container.kind === 141) { + if (container.kind === 139 || container.kind === 142) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -15590,29 +15876,29 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 171) { + if (container.kind === 172) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 215: + case 216: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 214: + case 215: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 141: + case 142: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 139: case 138: - case 137: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 133: + case 134: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -15627,86 +15913,92 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 135) { + if (n.kind === 136) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 165 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 166 && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; + var container = ts.getSuperContainer(node, true); + var needToCaptureLexicalThis = false; + if (!isCallExpression) { + while (container && container.kind === 172) { + container = ts.getSuperContainer(container, true); + needToCaptureLexicalThis = languageVersion < 2; + } + } + var canUseSuperExpression = isLegalUsageOfSuperExpression(container); + var nodeCheckFlag = 0; + if (canUseSuperExpression) { + if ((container.flags & 128) || isCallExpression) { + nodeCheckFlag = 512; + } + else { + nodeCheckFlag = 256; + } + getNodeLinks(node).flags |= nodeCheckFlag; + if (needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + } if (!baseClassType) { if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) { 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; - var needToCaptureLexicalThis; + if (!canUseSuperExpression) { + if (container && container.kind === 134) { + 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; + } + if (container.kind === 142 && isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + return unknownType; + } + return nodeCheckFlag === 512 + ? getBaseConstructorTypeOfClass(classType) + : baseClassType; + function isLegalUsageOfSuperExpression(container) { + if (!container) { + return false; + } if (isCallExpression) { - canUseSuperExpression = container.kind === 141; + return container.kind === 142; } else { - needToCaptureLexicalThis = false; - while (container && container.kind === 171) { - container = ts.getSuperContainer(container, true); - needToCaptureLexicalThis = languageVersion < 2; - } if (container && ts.isClassLike(container.parent)) { if (container.flags & 128) { - canUseSuperExpression = + return container.kind === 141 || container.kind === 140 || - container.kind === 139 || - container.kind === 142 || - container.kind === 143; + container.kind === 143 || + container.kind === 144; } else { - canUseSuperExpression = + return container.kind === 141 || container.kind === 140 || - container.kind === 139 || - container.kind === 142 || - container.kind === 143 || - container.kind === 138 || - container.kind === 137 || - container.kind === 141; + container.kind === 143 || + container.kind === 144 || + container.kind === 139 || + container.kind === 138 || + container.kind === 142; } } } - if (canUseSuperExpression) { - var returnType; - if ((container.flags & 128) || isCallExpression) { - getNodeLinks(node).flags |= 512; - returnType = getBaseConstructorTypeOfClass(classType); - } - else { - getNodeLinks(node).flags |= 256; - returnType = baseClassType; - } - if (container.kind === 141 && 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 && container.kind === 133) { - 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 false; } - return unknownType; } function getContextuallyTypedParameterType(parameter) { if (isFunctionExpressionOrArrowFunction(parameter.parent)) { @@ -15735,7 +16027,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 135) { + if (declaration.kind === 136) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -15768,7 +16060,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 135 && node.parent.initializer === node) { + if (node.parent.kind === 136 && node.parent.initializer === node) { return true; } node = node.parent; @@ -15777,8 +16069,8 @@ var ts; } function getContextualReturnType(functionDecl) { if (functionDecl.type || - functionDecl.kind === 141 || - functionDecl.kind === 142 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 143))) { + functionDecl.kind === 142 || + functionDecl.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); @@ -15797,7 +16089,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 167) { + if (template.parent.kind === 168) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -15805,12 +16097,12 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 54 && operator <= 65) { + if (operator >= 55 && operator <= 66) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 50) { + else if (operator === 51) { var type = getContextualType(binaryExpression); if (!type && node === binaryExpression.right) { type = checkExpression(binaryExpression.left); @@ -15897,7 +16189,7 @@ var ts; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; } function getContextualTypeForJsxExpression(expr) { - if (expr.parent.kind === 235) { + if (expr.parent.kind === 236) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -15907,7 +16199,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 236) { + if (expr.kind === 237) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -15925,38 +16217,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 208: - case 135: + case 209: + case 136: + case 139: case 138: - case 137: - case 160: + case 161: return getContextualTypeForInitializerExpression(node); - case 171: - case 201: + case 172: + case 202: return getContextualTypeForReturnExpression(node); - case 181: + case 182: return getContextualTypeForYieldOperand(parent); - case 165: case 166: + case 167: return getContextualTypeForArgument(parent, node); - case 168: - case 186: + case 169: + case 187: return getTypeFromTypeNode(parent.type); - case 178: + case 179: return getContextualTypeForBinaryOperand(node); - case 242: + case 243: return getContextualTypeForObjectLiteralElement(parent); - case 161: + case 162: return getContextualTypeForElementExpression(node); - case 179: + case 180: return getContextualTypeForConditionalOperand(node); - case 187: - ts.Debug.assert(parent.parent.kind === 180); + case 188: + ts.Debug.assert(parent.parent.kind === 181); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 169: + case 170: return getContextualType(parent); + case 238: case 237: - case 236: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -15971,7 +16263,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 170 || node.kind === 171; + return node.kind === 171 || node.kind === 172; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node) @@ -15979,7 +16271,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 140 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -15993,16 +16285,12 @@ var ts; var types = type.types; for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; - if (signatureList && - getSignaturesOfStructuredType(current, 0).length > 1) { - return undefined; - } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { + else if (!compareSignatures(signatureList[0], signature, false, true, compareTypes)) { return undefined; } else { @@ -16019,17 +16307,17 @@ var ts; return result; } function isInferentialContext(mapper) { - return mapper && mapper !== identityMapper; + return mapper && mapper.context; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 178 && parent.operatorToken.kind === 54 && parent.left === node) { + if (parent.kind === 179 && parent.operatorToken.kind === 55 && parent.left === node) { return true; } - if (parent.kind === 242) { + if (parent.kind === 243) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 161) { + if (parent.kind === 162) { return isAssignmentTarget(parent); } return false; @@ -16048,7 +16336,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 182) { + if (inDestructuringPattern && e.kind === 183) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? getElementTypeOfIterable(restArrayType, undefined) : undefined); @@ -16060,7 +16348,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 182; + hasSpreadElement = hasSpreadElement || e.kind === 183; } if (!hasSpreadElement) { var contextualType = getContextualType(node); @@ -16071,7 +16359,7 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 133 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 134 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 132); @@ -16086,7 +16374,7 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 | 258 | 4194304)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 | 258 | 16777216)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -16104,18 +16392,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 242 || - memberDecl.kind === 243 || + if (memberDecl.kind === 243 || + memberDecl.kind === 244 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 242) { + if (memberDecl.kind === 243) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 140) { + else if (memberDecl.kind === 141) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 243); + ts.Debug.assert(memberDecl.kind === 244); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -16130,7 +16418,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 142 || memberDecl.kind === 143); + ts.Debug.assert(memberDecl.kind === 143 || memberDecl.kind === 144); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -16141,7 +16429,7 @@ var ts; var stringIndexType = getIndexType(0); var numberIndexType = getIndexType(1); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 524288 | 2097152 | (typeFlags & 1048576); + result.flags |= 524288 | 1048576 | 4194304 | (typeFlags & 14680064); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -16170,31 +16458,34 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 66) { + if (lhs.kind === 67) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && tagNamesAreEquivalent(lhs.left, rhs.left); } function checkJsxElement(node) { + checkJsxOpeningLikeElement(node.openingElement); if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { error(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNode(node.openingElement.tagName)); } - checkJsxOpeningLikeElement(node.openingElement); + else { + getJsxElementTagSymbol(node.closingElement); + } for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 237: + case 238: checkJsxExpression(child); break; - case 230: + case 231: checkJsxElement(child); break; - case 231: + case 232: checkJsxSelfClosingElement(child); break; default: - ts.Debug.assert(child.kind === 233); + ts.Debug.assert(child.kind === 234); } } return jsxElementType || anyType; @@ -16203,7 +16494,7 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 132) { + if (tagName.kind === 133) { return false; } else { @@ -16218,9 +16509,17 @@ var ts; else if (elementAttributesType && !isTypeAny(elementAttributesType)) { var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - if (!correspondingPropType && isUnhyphenatedJsxName(node.name.text)) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; + if (isUnhyphenatedJsxName(node.name.text)) { + var indexerType = getIndexTypeOfType(elementAttributesType, 0); + if (indexerType) { + correspondingPropType = indexerType; + } + else { + if (!correspondingPropType) { + error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); + return unknownType; + } + } } } var exprType; @@ -16283,7 +16582,7 @@ var ts; links.jsxFlags |= 2; return intrinsicElementsType.symbol; } - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, 'JSX.' + JsxNames.IntrinsicElements); + error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); return unknownSymbol; } else { @@ -16293,26 +16592,26 @@ var ts; } } function lookupClassTag(node) { - var valueSymbol; - if (node.tagName.kind === 66) { - var tag = node.tagName; - var sym = getResolvedSymbol(tag); - valueSymbol = sym.exportSymbol || sym; - } - else { - valueSymbol = checkQualifiedName(node.tagName).symbol; - } + var valueSymbol = resolveJsxTagName(node); if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4; getSymbolLinks(valueSymbol).referenced = true; } return valueSymbol || unknownSymbol; } + function resolveJsxTagName(node) { + if (node.tagName.kind === 67) { + var tag = node.tagName; + var sym = getResolvedSymbol(tag); + return sym.exportSymbol || sym; + } + else { + return checkQualifiedName(node.tagName).symbol; + } + } } function getJsxElementInstanceType(node) { - if (!(getNodeLinks(node).jsxFlags & 4)) { - return undefined; - } + ts.Debug.assert(!!(getNodeLinks(node).jsxFlags & 4), "Should not call getJsxElementInstanceType on non-class Element"); var classSymbol = getJsxElementTagSymbol(node); if (classSymbol === unknownSymbol) { return anyType; @@ -16326,14 +16625,10 @@ var ts; signatures = getSignaturesOfType(valueType, 0); if (signatures.length === 0) { error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return undefined; + return unknownType; } } - var returnType = getUnionType(signatures.map(function (s) { return getReturnTypeOfSignature(s); })); - if (!isTypeAny(returnType) && !(returnType.flags & 80896)) { - error(node.tagName, ts.Diagnostics.The_return_type_of_a_JSX_element_constructor_must_return_an_object_type); - return undefined; - } + var returnType = getUnionType(signatures.map(getReturnTypeOfSignature)); var elemClassType = getJsxGlobalElementClassType(); if (elemClassType) { checkTypeRelatedTo(returnType, elemClassType, assignableRelation, node, ts.Diagnostics.JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements); @@ -16368,7 +16663,7 @@ var ts; if (links.jsxFlags & 4) { var elemInstanceType = getJsxElementInstanceType(node); if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = anyType; + return links.resolvedJsxType = elemInstanceType; } var propsName = getJsxElementPropertiesName(); if (propsName === undefined) { @@ -16436,7 +16731,7 @@ var ts; checkGrammarJsxElement(node); checkJsxPreconditions(node); if (compilerOptions.jsx === 2) { - var reactSym = resolveName(node.tagName, 'React', 107455, ts.Diagnostics.Cannot_find_name_0, 'React'); + var reactSym = resolveName(node.tagName, "React", 107455, ts.Diagnostics.Cannot_find_name_0, "React"); if (reactSym) { getSymbolLinks(reactSym).referenced = true; } @@ -16445,11 +16740,11 @@ var ts; var nameTable = {}; var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 235) { + if (node.attributes[i].kind === 236) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 236); + ts.Debug.assert(node.attributes[i].kind === 237); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -16475,7 +16770,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 138; + return s.valueDeclaration ? s.valueDeclaration.kind : 139; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -16483,11 +16778,11 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 92) { - var errorNode = node.kind === 163 ? + if (left.kind === 93) { + var errorNode = node.kind === 164 ? node.name : node.right; - if (getDeclarationKindFromSymbol(prop) !== 140) { + if (getDeclarationKindFromSymbol(prop) !== 141) { error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); return false; } @@ -16508,7 +16803,7 @@ var ts; } return true; } - if (left.kind === 92) { + if (left.kind === 93) { return true; } if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { @@ -16553,7 +16848,7 @@ var ts; return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 163 + var left = node.kind === 164 ? node.expression : node.left; var type = checkExpression(left); @@ -16568,7 +16863,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 166 && node.parent.expression === node) { + if (node.parent.kind === 167 && 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); @@ -16586,7 +16881,7 @@ var ts; } var isConstEnum = isConstEnumObjectType(objectType); if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + (!node.argumentExpression || node.argumentExpression.kind !== 9)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -16604,7 +16899,7 @@ var ts; } } } - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 | 132 | 4194304)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 | 132 | 16777216)) { if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132)) { var numberIndexType = getIndexTypeOfType(objectType, 1); if (numberIndexType) { @@ -16624,7 +16919,7 @@ var ts; return unknownType; } function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { - if (indexArgumentExpression.kind === 8 || indexArgumentExpression.kind === 7) { + if (indexArgumentExpression.kind === 9 || indexArgumentExpression.kind === 8) { return indexArgumentExpression.text; } if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { @@ -16640,7 +16935,7 @@ var ts; if (!ts.isWellKnownSymbolSyntactically(expression)) { return false; } - if ((expressionType.flags & 4194304) === 0) { + if ((expressionType.flags & 16777216) === 0) { if (reportError) { error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); } @@ -16664,10 +16959,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 167) { + if (node.kind === 168) { checkExpression(node.template); } - else if (node.kind !== 136) { + else if (node.kind !== 137) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -16689,19 +16984,19 @@ var ts; for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_6 = signature.declaration && signature.declaration.parent; + var parent_5 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_6 === lastParent) { + if (lastParent && parent_5 === lastParent) { index++; } else { - lastParent = parent_6; + lastParent = parent_5; index = cutoffIndex; } } else { index = cutoffIndex = result.length; - lastParent = parent_6; + lastParent = parent_5; } lastSymbol = symbol; if (signature.hasStringLiterals) { @@ -16718,7 +17013,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 182) { + if (arg && arg.kind === 183) { return i; } } @@ -16730,11 +17025,11 @@ var ts; var callIsIncomplete; var isDecorator; var spreadArgIndex = -1; - if (node.kind === 167) { + if (node.kind === 168) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 180) { + if (tagExpression.template.kind === 181) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -16742,11 +17037,11 @@ var ts; } else { var templateLiteral = tagExpression.template; - ts.Debug.assert(templateLiteral.kind === 10); + ts.Debug.assert(templateLiteral.kind === 11); callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 136) { + else if (node.kind === 137) { isDecorator = true; typeArguments = undefined; adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); @@ -16754,7 +17049,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 166); + ts.Debug.assert(callExpression.kind === 167); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -16807,7 +17102,7 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 184) { + if (arg === undefined || arg.kind !== 185) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { @@ -16854,11 +17149,11 @@ var ts; var argCount = getEffectiveArgumentCount(node, args, signature); for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); - if (arg === undefined || arg.kind !== 184) { + if (arg === undefined || arg.kind !== 185) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); if (argType === undefined) { - argType = arg.kind === 8 && !reportErrors + argType = arg.kind === 9 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } @@ -16873,16 +17168,16 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 167) { + if (node.kind === 168) { var template = node.template; args = [undefined]; - if (template.kind === 180) { + if (template.kind === 181) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 136) { + else if (node.kind === 137) { return undefined; } else { @@ -16891,18 +17186,18 @@ var ts; return args; } function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 136) { + if (node.kind === 137) { switch (node.parent.kind) { - case 211: - case 183: + case 212: + case 184: return 1; - case 138: + case 139: return 2; - case 140: - case 142: + case 141: case 143: + case 144: return signature.parameters.length >= 3 ? 3 : 2; - case 135: + case 136: return 3; } } @@ -16912,20 +17207,20 @@ var ts; } function getEffectiveDecoratorFirstArgumentType(node) { switch (node.kind) { - case 211: - case 183: + case 212: + case 184: var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 135: + case 136: node = node.parent; - if (node.kind === 141) { + if (node.kind === 142) { var classSymbol_1 = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol_1); } - case 138: - case 140: - case 142: + case 139: + case 141: case 143: + case 144: return getParentTypeOfClassElement(node); default: ts.Debug.fail("Unsupported decorator target."); @@ -16934,27 +17229,27 @@ var ts; } function getEffectiveDecoratorSecondArgumentType(node) { switch (node.kind) { - case 211: + case 212: ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; - case 135: + case 136: node = node.parent; - if (node.kind === 141) { + if (node.kind === 142) { return anyType; } - case 138: - case 140: - case 142: + case 139: + case 141: case 143: + case 144: var element = node; switch (element.name.kind) { - case 66: - case 7: + case 67: case 8: + case 9: return getStringLiteralType(element.name); - case 133: + case 134: var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 4194304)) { + if (allConstituentTypesHaveKind(nameType, 16777216)) { return nameType; } else { @@ -16971,17 +17266,17 @@ var ts; } function getEffectiveDecoratorThirdArgumentType(node) { switch (node.kind) { - case 211: + case 212: ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; - case 135: + case 136: return numberType; - case 138: + case 139: ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; - case 140: - case 142: + case 141: case 143: + case 144: var propertyType = getTypeOfNode(node); return createTypedPropertyDescriptorType(propertyType); default: @@ -17003,26 +17298,26 @@ var ts; return unknownType; } function getEffectiveArgumentType(node, argIndex, arg) { - if (node.kind === 136) { + if (node.kind === 137) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 167) { + else if (argIndex === 0 && node.kind === 168) { return globalTemplateStringsArrayType; } return undefined; } function getEffectiveArgument(node, args, argIndex) { - if (node.kind === 136 || - (argIndex === 0 && node.kind === 167)) { + if (node.kind === 137 || + (argIndex === 0 && node.kind === 168)) { return undefined; } return args[argIndex]; } function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 136) { + if (node.kind === 137) { return node.expression; } - else if (argIndex === 0 && node.kind === 167) { + else if (argIndex === 0 && node.kind === 168) { return node.template; } else { @@ -17030,12 +17325,12 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 167; - var isDecorator = node.kind === 136; + var isTaggedTemplate = node.kind === 168; + var isDecorator = node.kind === 137; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; - if (node.expression.kind !== 92) { + if (node.expression.kind !== 93) { ts.forEach(typeArguments, checkSourceElement); } } @@ -17098,6 +17393,9 @@ var ts; for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { + if (candidate.typeParameters && typeArguments) { + candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); + } return candidate; } } @@ -17170,7 +17468,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 92) { + if (node.expression.kind === 93) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { var baseTypeNode = ts.getClassExtendsHeritageClauseElement(ts.getContainingClass(node)); @@ -17215,7 +17513,7 @@ var ts; if (expressionType === unknownType) { return resolveErrorCall(node); } - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 211); + var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212); if (valueDecl && valueDecl.flags & 256) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -17259,16 +17557,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 211: - case 183: + case 212: + case 184: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 135: + case 136: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 138: + case 139: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 140: - case 142: + case 141: case 143: + case 144: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -17296,16 +17594,16 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 165) { + if (node.kind === 166) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 166) { + else if (node.kind === 167) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 167) { + else if (node.kind === 168) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 136) { + else if (node.kind === 137) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -17317,15 +17615,15 @@ var ts; function checkCallExpression(node) { checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 92) { + if (node.expression.kind === 93) { return voidType; } - if (node.kind === 166) { + if (node.kind === 167) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 141 && - declaration.kind !== 145 && - declaration.kind !== 150) { + declaration.kind !== 142 && + declaration.kind !== 146 && + declaration.kind !== 151) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -17338,7 +17636,7 @@ var ts; return getReturnTypeOfSignature(getResolvedSignature(node)); } function checkAssertion(node) { - var exprType = checkExpression(node.expression); + var exprType = getRegularTypeOfObjectLiteral(checkExpression(node.expression)); var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); @@ -17357,13 +17655,22 @@ var ts; 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); + var contextualParameterType = getTypeAtPosition(context, i); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { var parameter = ts.lastOrUndefined(signature.parameters); - var links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(ts.lastOrUndefined(context.parameters)), mapper); + var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + } + } + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + var links = getSymbolLinks(parameter); + if (!links.type) { + links.type = instantiateType(contextualType, mapper); + } + else if (isInferentialContext(mapper)) { + inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function createPromiseType(promisedType) { @@ -17381,7 +17688,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 189) { + if (func.body.kind !== 190) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { type = checkAwaitedType(type, func, ts.Diagnostics.Return_expression_in_async_function_does_not_have_a_valid_callable_then_member); @@ -17485,7 +17792,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 205); + return (body.statements.length === 1) && (body.statements[0].kind === 206); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -17494,7 +17801,7 @@ var ts; if (returnType === voidType || isTypeAny(returnType)) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 189) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 190) { return; } var bodyBlock = func.body; @@ -17507,9 +17814,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 !== 140 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 170) { + if (!hasGrammarError && node.kind === 171) { checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -17521,33 +17828,38 @@ var ts; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); - if (!(links.flags & 1024)) { + var contextSensitive = isContextSensitive(node); + var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + if (mightFixTypeParameters || !(links.flags & 1024)) { var contextualSignature = getContextualSignature(node); - if (!(links.flags & 1024)) { + var contextChecked = !!(links.flags & 1024); + if (mightFixTypeParameters || !contextChecked) { links.flags |= 1024; if (contextualSignature) { var signature = getSignaturesOfType(type, 0)[0]; - if (isContextSensitive(node)) { + if (contextSensitive) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type && !signature.resolvedReturnType) { + if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } } - checkSignatureDeclaration(node); + if (!contextChecked) { + checkSignatureDeclaration(node); + } } } - if (produceDiagnostics && node.kind !== 140 && node.kind !== 139) { + if (produceDiagnostics && node.kind !== 141 && node.kind !== 140) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 140 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -17564,7 +17876,7 @@ var ts; if (!node.type) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 189) { + if (node.body.kind === 190) { checkSourceElement(node.body); } else { @@ -17596,17 +17908,17 @@ var ts; } function isReferenceOrErrorExpression(n) { switch (n.kind) { - case 66: { + case 67: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; } - case 163: { + case 164: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; } - case 164: + case 165: return true; - case 169: + case 170: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -17614,22 +17926,22 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 66: - case 163: { + case 67: + case 164: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768) !== 0; } - case 164: { + case 165: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8) { + if (symbol && index && index.kind === 9) { var name_13 = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_13); return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 32768) !== 0; } return false; } - case 169: + case 170: return isConstVariableReference(n.expression); default: return false; @@ -17672,17 +17984,17 @@ var ts; function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); switch (node.operator) { - case 34: case 35: - case 48: - if (someConstituentTypeHasKind(operandType, 4194304)) { + case 36: + case 49: + if (someConstituentTypeHasKind(operandType, 16777216)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 47: + case 48: return booleanType; - case 39: case 40: + case 41: 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); @@ -17738,7 +18050,7 @@ var ts; return (symbol.flags & 128) !== 0; } function checkInstanceOfExpression(node, leftType, rightType) { - if (allConstituentTypesHaveKind(leftType, 4194814)) { + if (allConstituentTypesHaveKind(leftType, 16777726)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -17747,7 +18059,7 @@ var ts; return booleanType; } function checkInExpression(node, leftType, rightType) { - if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 | 132 | 4194304)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 | 132 | 16777216)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 | 512)) { @@ -17759,7 +18071,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 242 || p.kind === 243) { + if (p.kind === 243 || p.kind === 244) { var name_14 = p.name; var type = isTypeAny(sourceType) ? sourceType @@ -17784,8 +18096,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 184) { - if (e.kind !== 182) { + if (e.kind !== 185) { + if (e.kind !== 183) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -17810,7 +18122,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 178 && restExpression.operatorToken.kind === 54) { + if (restExpression.kind === 179 && restExpression.operatorToken.kind === 55) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -17823,14 +18135,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 178 && target.operatorToken.kind === 54) { + if (target.kind === 179 && target.operatorToken.kind === 55) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 162) { + if (target.kind === 163) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 161) { + if (target.kind === 162) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -17844,32 +18156,32 @@ var ts; } function checkBinaryExpression(node, contextualMapper) { var operator = node.operatorToken.kind; - if (operator === 54 && (node.left.kind === 162 || node.left.kind === 161)) { + if (operator === 55 && (node.left.kind === 163 || node.left.kind === 162)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 36: - case 57: case 37: case 58: case 38: case 59: - case 35: - case 56: - case 41: + case 39: case 60: + case 36: + case 57: case 42: case 61: case 43: case 62: - case 45: - case 64: - case 46: - case 65: case 44: case 63: + case 46: + case 65: + case 47: + case 66: + case 45: + case 64: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -17888,8 +18200,8 @@ var ts; } } return numberType; - case 34: - case 55: + case 35: + case 56: if (leftType.flags & (32 | 64)) leftType = rightType; if (rightType.flags & (32 | 64)) @@ -17913,42 +18225,42 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 55) { + if (operator === 56) { checkAssignmentOperator(resultType); } return resultType; - case 24: - case 26: + case 25: case 27: case 28: + case 29: if (!checkForDisallowedESSymbolOperand(operator)) { return booleanType; } - case 29: case 30: case 31: case 32: + case 33: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 88: + case 89: return checkInstanceOfExpression(node, leftType, rightType); - case 87: + case 88: return checkInExpression(node, leftType, rightType); - case 49: - return rightType; case 50: + return rightType; + case 51: return getUnionType([leftType, rightType]); - case 54: + case 55: checkAssignmentOperator(rightType); - return rightType; - case 23: + return getRegularTypeOfObjectLiteral(rightType); + case 24: return rightType; } function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 4194304) ? node.left : - someConstituentTypeHasKind(rightType, 4194304) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216) ? node.left : + someConstituentTypeHasKind(rightType, 16777216) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -17958,21 +18270,21 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { + case 46: + case 65: + return 51; + case 47: + case 66: + return 33; case 45: case 64: return 50; - case 46: - case 65: - return 32; - case 44: - case 63: - return 49; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 54 && operator <= 65) { + if (produceDiagnostics && operator >= 55 && operator <= 66) { var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); if (ok) { checkTypeAssignableTo(valueType, leftType, node.left, undefined); @@ -18056,21 +18368,21 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 133) { + if (node.name.kind === 134) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 133) { + if (node.name.kind === 134) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (contextualMapper && contextualMapper !== identityMapper) { + if (isInferentialContext(contextualMapper)) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getContextualType(node); @@ -18086,7 +18398,7 @@ var ts; } function checkExpression(node, contextualMapper) { var type; - if (node.kind === 132) { + if (node.kind === 133) { type = checkQualifiedName(node); } else { @@ -18094,9 +18406,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 163 && node.parent.expression === node) || - (node.parent.kind === 164 && node.parent.expression === node) || - ((node.kind === 66 || node.kind === 132) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 164 && node.parent.expression === node) || + (node.parent.kind === 165 && node.parent.expression === node) || + ((node.kind === 67 || node.kind === 133) && isInRightSideOfImportOrExportAssignment(node)); 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); } @@ -18109,78 +18421,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 66: + case 67: return checkIdentifier(node); - case 94: + case 95: return checkThisExpression(node); - case 92: + case 93: return checkSuperExpression(node); - case 90: + case 91: return nullType; - case 96: - case 81: + case 97: + case 82: return booleanType; - case 7: + case 8: return checkNumericLiteral(node); - case 180: + case 181: return checkTemplateExpression(node); - case 8: - case 10: - return stringType; case 9: + case 11: + return stringType; + case 10: return globalRegExpType; - case 161: - return checkArrayLiteral(node, contextualMapper); case 162: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 163: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 164: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 165: + return checkIndexedAccess(node); case 166: - return checkCallExpression(node); case 167: + return checkCallExpression(node); + case 168: return checkTaggedTemplateExpression(node); - case 169: + case 170: return checkExpression(node.expression, contextualMapper); - case 183: + case 184: return checkClassExpression(node); - case 170: case 171: + case 172: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 173: + case 174: return checkTypeOfExpression(node); - case 168: - case 186: + case 169: + case 187: return checkAssertion(node); - case 172: + case 173: return checkDeleteExpression(node); - case 174: - return checkVoidExpression(node); case 175: - return checkAwaitExpression(node); + return checkVoidExpression(node); case 176: - return checkPrefixUnaryExpression(node); + return checkAwaitExpression(node); case 177: - return checkPostfixUnaryExpression(node); + return checkPrefixUnaryExpression(node); case 178: - return checkBinaryExpression(node, contextualMapper); + return checkPostfixUnaryExpression(node); case 179: + return checkBinaryExpression(node, contextualMapper); + case 180: return checkConditionalExpression(node, contextualMapper); - case 182: + case 183: return checkSpreadElementExpression(node, contextualMapper); - case 184: + case 185: return undefinedType; - case 181: + case 182: return checkYieldExpression(node); - case 237: + case 238: return checkJsxExpression(node); - case 230: - return checkJsxElement(node); case 231: - return checkJsxSelfClosingElement(node); + return checkJsxElement(node); case 232: + return checkJsxSelfClosingElement(node); + case 233: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -18205,7 +18517,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 141 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 142 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -18220,15 +18532,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 140 || - node.kind === 210 || - node.kind === 170; + return node.kind === 141 || + node.kind === 211 || + node.kind === 171; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 66 && + if (param.name.kind === 67 && param.name.text === parameter.text) { return i; } @@ -18238,30 +18550,30 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { + case 172: + case 145: + case 211: case 171: - case 144: - case 210: - case 170: - case 149: + case 150: + case 141: case 140: - case 139: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { - if (node.kind === 146) { + if (node.kind === 147) { checkGrammarIndexSignature(node); } - else if (node.kind === 149 || node.kind === 210 || node.kind === 150 || - node.kind === 144 || node.kind === 141 || - node.kind === 145) { + else if (node.kind === 150 || node.kind === 211 || node.kind === 151 || + node.kind === 145 || node.kind === 142 || + node.kind === 146) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 147) { + if (node.type.kind === 148) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -18270,7 +18582,7 @@ var ts; error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - checkTypeAssignableTo(typePredicate.type, getTypeAtLocation(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); } } else if (typePredicateNode.parameterName) { @@ -18280,19 +18592,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 158 || - param.name.kind === 159) { + if (param.name.kind === 159 || + param.name.kind === 160) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 66 && + if (element.name.kind === 67 && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 159 || - element.name.kind === 158) { + else if (element.name.kind === 160 || + element.name.kind === 159) { checkBindingPattern(element.name); } } @@ -18316,10 +18628,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 145: + case 146: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 144: + case 145: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -18341,7 +18653,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 212) { + if (node.kind === 213) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -18356,7 +18668,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 127: + case 128: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -18364,7 +18676,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 125: + case 126: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -18404,48 +18716,69 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 165 && n.expression.kind === 92; + return n.kind === 166 && n.expression.kind === 93; + } + function containsSuperCallAsComputedPropertyName(n) { + return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } - switch (n.kind) { - case 170: - case 210: - case 171: - case 162: return false; - default: return ts.forEachChild(n, containsSuperCall); + else if (ts.isFunctionLike(n)) { + return false; + } + else if (ts.isClassLike(n)) { + return ts.forEach(n.members, containsSuperCallAsComputedPropertyName); } + return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 94) { + if (n.kind === 95) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 170 && n.kind !== 210) { + else if (n.kind !== 171 && n.kind !== 211) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 138 && + return n.kind === 139 && !(n.flags & 128) && !!n.initializer; } - if (ts.getClassExtendsHeritageClauseElement(node.parent)) { + var containingClassDecl = node.parent; + if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { + var containingClassSymbol = getSymbolOfNode(containingClassDecl); + var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); if (containsSuperCall(node.body)) { + if (baseConstructorType === nullType) { + error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + } 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 !== 192 || !isSuperCallExpression(statements[0].expression)) { + var superCallStatement; + for (var _i = 0; _i < statements.length; _i++) { + var statement = statements[_i]; + if (statement.kind === 193 && isSuperCallExpression(statement.expression)) { + superCallStatement = statement; + break; + } + if (!ts.isPrologueDirective(statement)) { + break; + } + } + if (!superCallStatement) { 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); + markThisReferencesAsErrors(superCallStatement.expression); } } } - else { + else if (baseConstructorType !== nullType) { error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -18453,13 +18786,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 142) { + if (node.kind === 143) { 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 === 142 ? 143 : 142; + var otherKind = node.kind === 143 ? 144 : 143; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -18544,9 +18877,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 212) { - ts.Debug.assert(signatureDeclarationNode.kind === 144 || signatureDeclarationNode.kind === 145); - var signatureKind = signatureDeclarationNode.kind === 144 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213) { + ts.Debug.assert(signatureDeclarationNode.kind === 145 || signatureDeclarationNode.kind === 146); + var signatureKind = signatureDeclarationNode.kind === 145 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -18564,7 +18897,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 212 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 213 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -18640,7 +18973,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 140 || node.kind === 139); + ts.Debug.assert(node.kind === 141 || node.kind === 140); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -18672,11 +19005,11 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 212 || node.parent.kind === 152 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 213 || node.parent.kind === 153 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 210 || node.kind === 140 || node.kind === 139 || node.kind === 141) { + if (node.kind === 211 || node.kind === 141 || node.kind === 140 || node.kind === 142) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -18755,35 +19088,50 @@ var ts; } var exportedDeclarationSpaces = 0; var nonExportedDeclarationSpaces = 0; - ts.forEach(symbol.declarations, function (d) { + var defaultExportedDeclarationSpaces = 0; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - if (getEffectiveDeclarationFlags(d, 1)) { - exportedDeclarationSpaces |= declarationSpaces; + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 1024); + if (effectiveDeclarationFlags & 1) { + if (effectiveDeclarationFlags & 1024) { + defaultExportedDeclarationSpaces |= declarationSpaces; + } + else { + exportedDeclarationSpaces |= declarationSpaces; + } } else { nonExportedDeclarationSpaces |= declarationSpaces; } - }); - var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; - if (commonDeclarationSpace) { - ts.forEach(symbol.declarations, function (d) { - if (getDeclarationSpaces(d) & commonDeclarationSpace) { + } + var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; + var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; + if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var d = _c[_b]; + var declarationSpaces = getDeclarationSpaces(d); + if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { + error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name)); + } + else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) { 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 212: + case 213: return 2097152; - case 215: - return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 + case 216: + return d.name.kind === 9 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 211: - case 214: + case 212: + case 215: return 2097152 | 1048576; - case 218: + case 219: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -18918,22 +19266,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 211: + case 212: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 135: + case 136: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 138: + case 139: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 140: - case 142: + case 141: case 143: + case 144: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -18942,7 +19290,7 @@ var ts; checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage, errorInfo); } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 148) { + if (node && node.kind === 149) { var root = getFirstIdentifier(node.typeName); var rootSymbol = resolveName(root, root.text, 107455, undefined, undefined); if (rootSymbol && rootSymbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { @@ -18952,19 +19300,19 @@ var ts; } function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 138: + case 139: checkTypeNodeAsExpression(node.type); break; - case 135: + case 136: checkTypeNodeAsExpression(node.type); break; - case 140: + case 141: checkTypeNodeAsExpression(node.type); break; - case 142: + case 143: checkTypeNodeAsExpression(node.type); break; - case 143: + case 144: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -18987,24 +19335,24 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 211: + case 212: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 140: + case 141: checkParameterTypeAnnotationsAsExpressions(node); + case 144: case 143: - case 142: - case 138: - case 135: + case 139: + case 136: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 135) { + if (node.kind === 136) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -19027,7 +19375,7 @@ var ts; } emitAwaiter = true; } - if (node.name && node.name.kind === 133) { + if (node.name && node.name.kind === 134) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -19062,11 +19410,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 189) { + if (node.kind === 190) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 216) { + if (ts.isFunctionBlock(node) || node.kind === 217) { checkFunctionAndClassExpressionBodies(node); } } @@ -19084,19 +19432,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 138 || - node.kind === 137 || + if (node.kind === 139 || + node.kind === 138 || + node.kind === 141 || node.kind === 140 || - node.kind === 139 || - node.kind === 142 || - node.kind === 143) { + node.kind === 143 || + node.kind === 144) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 135 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 136 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -19110,7 +19458,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4) { - var isDeclaration_1 = node.kind !== 66; + var isDeclaration_1 = node.kind !== 67; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -19131,7 +19479,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 66; + var isDeclaration_2 = node.kind !== 67; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -19144,11 +19492,11 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 215 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 216 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 245 && ts.isExternalModule(parent)) { + if (parent.kind === 246 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -19159,7 +19507,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 49152) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 208 && !node.initializer) { + if (node.kind === 209 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -19169,15 +19517,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 209); - var container = varDeclList.parent.kind === 190 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210); + var container = varDeclList.parent.kind === 191 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 189 && ts.isFunctionLike(container.parent) || + (container.kind === 190 && ts.isFunctionLike(container.parent) || + container.kind === 217 || container.kind === 216 || - container.kind === 215 || - container.kind === 245); + container.kind === 246); if (!namesShareScope) { var name_15 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_15, name_15); @@ -19187,16 +19535,16 @@ var ts; } } function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 135) { + if (ts.getRootDeclaration(node).kind !== 136) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 66) { + if (n.kind === 67) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 135) { + if (referencedSymbol.valueDeclaration.kind === 136) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -19216,7 +19564,7 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 133) { + if (node.name.kind === 134) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -19225,7 +19573,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && ts.getRootDeclaration(node).kind === 135 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 136 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -19253,9 +19601,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 138 && node.kind !== 137) { + if (node.kind !== 139 && node.kind !== 138) { checkExportsOnMergedDeclarations(node); - if (node.kind === 208 || node.kind === 160) { + if (node.kind === 209 || node.kind === 161) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -19276,7 +19624,7 @@ var ts; ts.forEach(node.declarationList.declarations, checkSourceElement); } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { - if (node.modifiers && node.parent.kind === 162) { + if (node.modifiers && node.parent.kind === 163) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -19309,12 +19657,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 209) { + if (node.initializer && node.initializer.kind === 210) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 209) { + if (node.initializer.kind === 210) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -19329,13 +19677,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 209) { + if (node.initializer.kind === 210) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 161 || varExpr.kind === 162) { + if (varExpr.kind === 162 || varExpr.kind === 163) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -19350,7 +19698,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 209) { + if (node.initializer.kind === 210) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -19360,7 +19708,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 161 || varExpr.kind === 162) { + if (varExpr.kind === 162 || varExpr.kind === 163) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258)) { @@ -19522,7 +19870,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 142 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 143))); + return !!(node.kind === 143 && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144))); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -19540,10 +19888,10 @@ var ts; if (func.asteriskToken) { return; } - if (func.kind === 143) { + if (func.kind === 144) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 141) { + else if (func.kind === 142) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -19576,7 +19924,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 239 && !hasDuplicateDefaultClause) { + if (clause.kind === 240 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -19588,7 +19936,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 238) { + if (produceDiagnostics && clause.kind === 239) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -19605,7 +19953,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 204 && current.label.text === node.label.text) { + if (current.kind === 205 && 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; @@ -19631,7 +19979,7 @@ var ts; var catchClause = node.catchClause; if (catchClause) { if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 66) { + if (catchClause.variableDeclaration.name.kind !== 67) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -19699,7 +20047,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 133 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 134 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -19852,7 +20200,7 @@ var ts; ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { if (derived === base) { - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 211); + var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212); if (baseDeclarationFlags & 256 && (!derivedClassDecl || !(derivedClassDecl.flags & 256))) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, typeToString(type), symbolToString(baseProperty), typeToString(baseType)); } @@ -19893,7 +20241,7 @@ var ts; } } function isAccessor(kind) { - return kind === 142 || kind === 143; + return kind === 143 || kind === 144; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -19959,7 +20307,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 212); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213); 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); @@ -19977,7 +20325,7 @@ var ts; if (symbol && symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 211 && !ts.isInAmbientContext(declaration)) { + if (declaration.kind === 212 && !ts.isInAmbientContext(declaration)) { error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); break; } @@ -20009,28 +20357,12 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 133 && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 134 && 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); - 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); - } - } + autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); } else if (ambient && !enumIsConst) { autoValue = undefined; @@ -20041,22 +20373,42 @@ var ts; }); nodeLinks.flags |= 8192; } - function getConstantValueForEnumMemberInitializer(initializer) { - return evalConstant(initializer); + function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { + var reportError = true; + var value = evalConstant(initializer); + if (reportError) { + if (value === 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(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } + } + return value; function evalConstant(e) { switch (e.kind) { - case 176: - var value = evalConstant(e.operand); - if (value === undefined) { + case 177: + var value_1 = evalConstant(e.operand); + if (value_1 === undefined) { return undefined; } switch (e.operator) { - case 34: return value; - case 35: return -value; - case 48: return ~value; + case 35: return value_1; + case 36: return -value_1; + case 49: return ~value_1; } return undefined; - case 178: + case 179: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -20066,39 +20418,39 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 45: return left | right; - case 44: return left & right; - case 42: return left >> right; - case 43: return left >>> right; - case 41: return left << right; - case 46: return left ^ right; - case 36: return left * right; - case 37: return left / right; - case 34: return left + right; - case 35: return left - right; - case 38: return left % right; + case 46: return left | right; + case 45: return left & right; + case 43: return left >> right; + case 44: return left >>> right; + case 42: return left << right; + case 47: return left ^ right; + case 37: return left * right; + case 38: return left / right; + case 35: return left + right; + case 36: return left - right; + case 39: return left % right; } return undefined; - case 7: + case 8: return +e.text; - case 169: + case 170: return evalConstant(e.expression); - case 66: + case 67: + case 165: case 164: - case 163: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType; + var enumType_1; var propertyName; - if (e.kind === 66) { - enumType = currentType; + if (e.kind === 67) { + enumType_1 = currentType; propertyName = e.text; } else { var expression; - if (e.kind === 164) { + if (e.kind === 165) { if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8) { + e.argumentExpression.kind !== 9) { return undefined; } expression = e.expression; @@ -20110,25 +20462,25 @@ var ts; } var current = expression; while (current) { - if (current.kind === 66) { + if (current.kind === 67) { break; } - else if (current.kind === 163) { + else if (current.kind === 164) { current = current.expression; } else { return undefined; } } - enumType = checkExpression(expression); - if (!(enumType.symbol && (enumType.symbol.flags & 384))) { + enumType_1 = checkExpression(expression); + if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384))) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + var property = getPropertyOfObjectType(enumType_1, propertyName); if (!property || !(property.flags & 8)) { return undefined; } @@ -20137,6 +20489,8 @@ var ts; return undefined; } if (!isDefinedBefore(propertyDecl, member)) { + reportError = false; + error(e, ts.Diagnostics.A_member_initializer_in_a_const_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_const_enums); return undefined; } return getNodeLinks(propertyDecl).enumMemberValue; @@ -20170,7 +20524,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 214) { + if (declaration.kind !== 215) { return false; } var enumDeclaration = declaration; @@ -20193,8 +20547,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 211 || - (declaration.kind === 210 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 212 || + (declaration.kind === 211 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20216,7 +20570,7 @@ var ts; } function checkModuleDeclaration(node) { if (produceDiagnostics) { - var isAmbientExternalModule = node.name.kind === 8; + var isAmbientExternalModule = node.name.kind === 9; var contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -20224,7 +20578,7 @@ var ts; return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 8) { + if (!ts.isInAmbientContext(node) && node.name.kind === 9) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } @@ -20245,7 +20599,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 211); + var mergedClass = ts.getDeclarationOfKind(symbol, 212); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -20264,28 +20618,28 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 132) { + if (node.kind === 133) { node = node.left; } - else if (node.kind === 163) { + else if (node.kind === 164) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 66); + ts.Debug.assert(node.kind === 67); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 9) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 216 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 245 && !inAmbientExternalModule) { - error(moduleName, node.kind === 225 ? + var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 246 && !inAmbientExternalModule) { + error(moduleName, node.kind === 226 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -20304,7 +20658,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 227 ? + var message = node.kind === 228 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -20330,7 +20684,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221) { + if (importClause.namedBindings.kind === 222) { checkImportBinding(importClause.namedBindings); } else { @@ -20365,7 +20719,7 @@ var ts; } } else { - if (languageVersion >= 2) { + if (languageVersion >= 2 && !ts.isInAmbientContext(node)) { grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); } } @@ -20381,8 +20735,8 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 216 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 245 && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 217 && node.parent.parent.name.kind === 9; + if (node.parent.kind !== 246 && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -20395,7 +20749,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 245 && node.parent.kind !== 216 && node.parent.kind !== 215) { + if (node.parent.kind !== 246 && node.parent.kind !== 217 && node.parent.kind !== 216) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -20409,15 +20763,15 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) { return; } - var container = node.parent.kind === 245 ? node.parent : node.parent.parent; - if (container.kind === 215 && container.name.kind === 66) { + var container = node.parent.kind === 246 ? node.parent : node.parent.parent; + if (container.kind === 216 && container.name.kind === 67) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 66) { + if (node.expression.kind === 67) { markExportAsReferenced(node); } else { @@ -20434,10 +20788,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 245) { + if (node.kind === 246) { return node.statements; } - if (node.kind === 215 && node.body.kind === 216) { + if (node.kind === 216 && node.body.kind === 217) { return node.body.statements; } return emptyArray; @@ -20474,182 +20828,181 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 215: - case 211: + case 216: case 212: - case 210: + case 213: + case 211: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 134: - return checkTypeParameter(node); case 135: + return checkTypeParameter(node); + case 136: return checkParameter(node); + case 139: case 138: - case 137: return checkPropertyDeclaration(node); - case 149: case 150: - case 144: + case 151: case 145: - return checkSignatureDeclaration(node); case 146: return checkSignatureDeclaration(node); + case 147: + return checkSignatureDeclaration(node); + case 141: case 140: - case 139: return checkMethodDeclaration(node); - case 141: - return checkConstructorDeclaration(node); case 142: + return checkConstructorDeclaration(node); case 143: + case 144: return checkAccessorDeclaration(node); - case 148: + case 149: return checkTypeReferenceNode(node); - case 147: + case 148: return checkTypePredicate(node); - case 151: - return checkTypeQuery(node); case 152: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 153: - return checkArrayType(node); + return checkTypeLiteral(node); case 154: - return checkTupleType(node); + return checkArrayType(node); case 155: + return checkTupleType(node); case 156: - return checkUnionOrIntersectionType(node); case 157: + return checkUnionOrIntersectionType(node); + case 158: return checkSourceElement(node.type); - case 210: + case 211: return checkFunctionDeclaration(node); - case 189: - case 216: - return checkBlock(node); case 190: + case 217: + return checkBlock(node); + case 191: return checkVariableStatement(node); - case 192: - return checkExpressionStatement(node); case 193: - return checkIfStatement(node); + return checkExpressionStatement(node); case 194: - return checkDoStatement(node); + return checkIfStatement(node); case 195: - return checkWhileStatement(node); + return checkDoStatement(node); case 196: - return checkForStatement(node); + return checkWhileStatement(node); case 197: - return checkForInStatement(node); + return checkForStatement(node); case 198: - return checkForOfStatement(node); + return checkForInStatement(node); case 199: + return checkForOfStatement(node); case 200: - return checkBreakOrContinueStatement(node); case 201: - return checkReturnStatement(node); + return checkBreakOrContinueStatement(node); case 202: - return checkWithStatement(node); + return checkReturnStatement(node); case 203: - return checkSwitchStatement(node); + return checkWithStatement(node); case 204: - return checkLabeledStatement(node); + return checkSwitchStatement(node); case 205: - return checkThrowStatement(node); + return checkLabeledStatement(node); case 206: + return checkThrowStatement(node); + case 207: return checkTryStatement(node); - case 208: + case 209: return checkVariableDeclaration(node); - case 160: + case 161: return checkBindingElement(node); - case 211: - return checkClassDeclaration(node); case 212: - return checkInterfaceDeclaration(node); + return checkClassDeclaration(node); case 213: - return checkTypeAliasDeclaration(node); + return checkInterfaceDeclaration(node); case 214: - return checkEnumDeclaration(node); + return checkTypeAliasDeclaration(node); case 215: + return checkEnumDeclaration(node); + case 216: return checkModuleDeclaration(node); - case 219: + case 220: return checkImportDeclaration(node); - case 218: + case 219: return checkImportEqualsDeclaration(node); - case 225: + case 226: return checkExportDeclaration(node); - case 224: + case 225: return checkExportAssignment(node); - case 191: + case 192: checkGrammarStatementInAmbientContext(node); return; - case 207: + case 208: checkGrammarStatementInAmbientContext(node); return; - case 228: + case 229: return checkMissingDeclaration(node); } } function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 170: case 171: + case 172: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 183: + case 184: ts.forEach(node.members, checkSourceElement); break; + case 141: case 140: - case 139: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 141: case 142: case 143: - case 210: + case 144: + case 211: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 202: + case 203: checkFunctionAndClassExpressionBodies(node.expression); break; + case 137: case 136: - case 135: + case 139: case 138: - case 137: - case 158: case 159: case 160: case 161: case 162: - case 242: case 163: + case 243: case 164: case 165: case 166: case 167: - case 180: - case 187: case 168: - case 186: + case 181: + case 188: case 169: - case 173: + case 187: + case 170: case 174: case 175: - case 172: case 176: + case 173: case 177: case 178: case 179: + case 180: + case 183: case 182: - case 181: - case 189: - case 216: case 190: - case 192: + case 217: + case 191: case 193: case 194: case 195: @@ -20659,27 +21012,28 @@ var ts; case 199: case 200: case 201: - case 203: - case 217: - case 238: - case 239: + case 202: case 204: + case 218: + case 239: + case 240: case 205: case 206: - case 241: - case 208: + case 207: + case 242: case 209: - case 211: - case 214: - case 244: - case 224: + case 210: + case 212: + case 215: case 245: - case 237: - case 230: + case 225: + case 246: + case 238: case 231: - case 235: - case 236: case 232: + case 236: + case 237: + case 233: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -20757,7 +21111,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 202 && node.parent.statement === node) { + if (node.parent.kind === 203 && node.parent.statement === node) { return true; } node = node.parent; @@ -20779,34 +21133,37 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 245: + case 246: if (!ts.isExternalModule(location)) { break; } - case 215: + case 216: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 214: + case 215: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 183: + case 184: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 211: case 212: + case 213: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 170: + case 171: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); } break; } + if (ts.introducesArgumentsExoticObject(location)) { + copySymbol(argumentsSymbol, meaning); + } memberFlags = location.flags; location = location.parent; } @@ -20830,42 +21187,42 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 66 && + return name.kind === 67 && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 134: - case 211: + case 135: case 212: case 213: case 214: + case 215: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 132) { + while (node.parent && node.parent.kind === 133) { node = node.parent; } - return node.parent && node.parent.kind === 148; + return node.parent && node.parent.kind === 149; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 163) { + while (node.parent && node.parent.kind === 164) { node = node.parent; } - return node.parent && node.parent.kind === 185; + return node.parent && node.parent.kind === 186; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 132) { + while (nodeOnRightSide.parent.kind === 133) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 218) { + if (nodeOnRightSide.parent.kind === 219) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 224) { + if (nodeOnRightSide.parent.kind === 225) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -20877,10 +21234,10 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 224) { + if (entityName.parent.kind === 225) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 163) { + if (entityName.kind !== 164) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -20889,29 +21246,31 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 185 ? 793056 : 1536; + var meaning = entityName.parent.kind === 186 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 232) || (entityName.parent.kind === 231)) { + else if ((entityName.parent.kind === 233) || + (entityName.parent.kind === 232) || + (entityName.parent.kind === 235)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { if (ts.nodeIsMissing(entityName)) { return undefined; } - if (entityName.kind === 66) { + if (entityName.kind === 67) { var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 163) { + else if (entityName.kind === 164) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 132) { + else if (entityName.kind === 133) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -20920,54 +21279,65 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 148 ? 793056 : 1536; + var meaning = entityName.parent.kind === 149 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 235) { + else if (entityName.parent.kind === 236) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 147) { + if (entityName.parent.kind === 148) { return resolveEntityName(entityName, 1); } return undefined; } - function getSymbolInfo(node) { + function getSymbolAtLocation(node) { if (isInsideWithStatementBody(node)) { return undefined; } if (ts.isDeclarationName(node)) { return getSymbolOfNode(node.parent); } - if (node.kind === 66 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 224 - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + if (node.kind === 67) { + if (isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 225 + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); + } + else if (node.parent.kind === 161 && + node.parent.parent.kind === 159 && + node === node.parent.propertyName) { + var typeOfPattern = getTypeOfNode(node.parent.parent); + var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); + if (propertyDeclaration) { + return propertyDeclaration; + } + } } switch (node.kind) { - case 66: - case 163: - case 132: + case 67: + case 164: + case 133: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 94: - case 92: + case 95: + case 93: var type = checkExpression(node); return type.symbol; - case 118: + case 119: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 141) { + if (constructorDeclaration && constructorDeclaration.kind === 142) { return constructorDeclaration.parent.symbol; } return undefined; - case 8: + case 9: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 219 || node.parent.kind === 225) && + ((node.parent.kind === 220 || node.parent.kind === 226) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } - case 7: - if (node.parent.kind === 164 && node.parent.argumentExpression === node) { + case 8: + if (node.parent.kind === 165 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -20981,7 +21351,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 243) { + if (location && location.kind === 244) { return resolveEntityName(location.name, 107455); } return undefined; @@ -21004,7 +21374,7 @@ var ts; return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); } if (ts.isDeclaration(node)) { @@ -21012,14 +21382,14 @@ var ts; return getTypeOfSymbol(symbol); } if (ts.isDeclarationName(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); return symbol && getTypeOfSymbol(symbol); } if (ts.isBindingPattern(node)) { return getTypeForVariableLikeDeclaration(node.parent); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } @@ -21078,11 +21448,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 245) { + if (parentSymbol.flags & 512 && parentSymbol.valueDeclaration.kind === 246) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 215 || n.kind === 214) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 216 || n.kind === 215) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -21095,11 +21465,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 189: - case 217: - case 196: + case 190: + case 218: case 197: case 198: + case 199: return true; } return false; @@ -21125,22 +21495,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 218: - case 220: + case 219: case 221: - case 223: - case 227: + case 222: + case 224: + case 228: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 225: + case 226: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 224: - return node.expression && node.expression.kind === 66 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 225: + return node.expression && node.expression.kind === 67 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 245 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 246 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -21151,7 +21521,10 @@ var ts; if (target === unknownSymbol && compilerOptions.isolatedModules) { return true; } - return target !== unknownSymbol && target && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + return target !== unknownSymbol && + target && + target.flags & 107455 && + (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -21185,7 +21558,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 244) { + if (node.kind === 245) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -21199,13 +21572,14 @@ var ts; function isFunctionType(type) { return type.flags & 80896 && getSignaturesOfType(type, 0).length > 0; } - function getTypeReferenceSerializationKind(node) { - var symbol = resolveEntityName(node.typeName, 107455, true); - var constructorType = symbol ? getTypeOfSymbol(symbol) : undefined; + function getTypeReferenceSerializationKind(typeName) { + var valueSymbol = resolveEntityName(typeName, 107455, true); + var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; if (constructorType && isConstructorType(constructorType)) { return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; } - var type = getTypeFromTypeNode(node); + var typeSymbol = resolveEntityName(typeName, 793056, true); + var type = getDeclaredTypeOfSymbol(typeSymbol); if (type === unknownType) { return ts.TypeReferenceSerializationKind.Unknown; } @@ -21227,7 +21601,7 @@ var ts; else if (allConstituentTypesHaveKind(type, 8192)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, 4194304)) { + else if (allConstituentTypesHaveKind(type, 16777216)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -21269,13 +21643,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 160 || (n.parent.kind === 208 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 161 || (n.parent.kind === 209 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 241; + symbol.valueDeclaration.parent.kind !== 242; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -21315,7 +21689,8 @@ var ts; collectLinkedAliases: collectLinkedAliases, getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, - getTypeReferenceSerializationKind: getTypeReferenceSerializationKind + getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, + isOptionalParameter: isOptionalParameter }; } function initializeTypeChecker() { @@ -21396,7 +21771,7 @@ var ts; else if (languageVersion < 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } - else if (node.kind === 142 || node.kind === 143) { + else if (node.kind === 143 || node.kind === 144) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -21406,38 +21781,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 142: case 143: - case 141: + case 144: + case 142: + case 139: case 138: - case 137: + case 141: case 140: - case 139: - case 146: - case 215: + case 147: + case 216: + case 220: case 219: - case 218: + case 226: case 225: - case 224: - case 135: + case 136: break; - case 210: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 115) && - node.parent.kind !== 216 && node.parent.kind !== 245) { + case 211: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116) && + node.parent.kind !== 217 && node.parent.kind !== 246) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 211: case 212: - case 190: case 213: - if (node.modifiers && node.parent.kind !== 216 && node.parent.kind !== 245) { + case 191: + case 214: + if (node.modifiers && node.parent.kind !== 217 && node.parent.kind !== 246) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 214: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 71) && - node.parent.kind !== 216 && node.parent.kind !== 245) { + case 215: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72) && + node.parent.kind !== 217 && node.parent.kind !== 246) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -21452,14 +21827,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { + case 110: case 109: case 108: - case 107: var text = void 0; - if (modifier.kind === 109) { + if (modifier.kind === 110) { text = "public"; } - else if (modifier.kind === 108) { + else if (modifier.kind === 109) { text = "protected"; lastProtected = modifier; } @@ -21476,11 +21851,11 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 216 || node.parent.kind === 245) { + else if (node.parent.kind === 217 || node.parent.kind === 246) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256) { - if (modifier.kind === 107) { + if (modifier.kind === 108) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -21489,17 +21864,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 110: + case 111: if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 216 || node.parent.kind === 245) { + else if (node.parent.kind === 217 || node.parent.kind === 246) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 135) { + else if (node.kind === 136) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256) { @@ -21508,7 +21883,7 @@ var ts; flags |= 128; lastStatic = modifier; break; - case 79: + case 80: if (flags & 1) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -21521,42 +21896,42 @@ var ts; else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 211) { + else if (node.parent.kind === 212) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 135) { + else if (node.kind === 136) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; break; - case 119: + case 120: if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 211) { + else if (node.parent.kind === 212) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 135) { + else if (node.kind === 136) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 216) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; lastDeclare = modifier; break; - case 112: + case 113: if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 211) { - if (node.kind !== 140) { + if (node.kind !== 212) { + if (node.kind !== 141) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 211 && node.parent.flags & 256)) { + if (!(node.parent.kind === 212 && node.parent.flags & 256)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128) { @@ -21568,14 +21943,14 @@ var ts; } flags |= 256; break; - case 115: + case 116: if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 135) { + else if (node.kind === 136) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512; @@ -21583,7 +21958,7 @@ var ts; break; } } - if (node.kind === 141) { + if (node.kind === 142) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -21601,10 +21976,10 @@ var ts; } return; } - else if ((node.kind === 219 || node.kind === 218) && flags & 2) { + else if ((node.kind === 220 || node.kind === 219) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 135 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 136 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512) { @@ -21616,10 +21991,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 140: - case 210: - case 170: + case 141: + case 211: case 171: + case 172: if (!node.asteriskToken) { return false; } @@ -21667,16 +22042,14 @@ var ts; return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); } } - else if (parameter.questionToken || parameter.initializer) { + else if (parameter.questionToken) { seenOptionalParameter = true; - if (parameter.questionToken && parameter.initializer) { + if (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); - } + else if (seenOptionalParameter && !parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); } } } @@ -21686,7 +22059,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 171) { + if (node.kind === 172) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -21721,7 +22094,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 127 && parameter.type.kind !== 125) { + if (parameter.type.kind !== 128 && parameter.type.kind !== 126) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -21753,7 +22126,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 184) { + if (arg.kind === 185) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -21780,7 +22153,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 80) { + if (heritageClause.token === 81) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -21793,7 +22166,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 103); + ts.Debug.assert(heritageClause.token === 104); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -21808,14 +22181,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 80) { + if (heritageClause.token === 81) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 103); + ts.Debug.assert(heritageClause.token === 104); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } checkGrammarHeritageClause(heritageClause); @@ -21824,19 +22197,19 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 133) { + if (node.kind !== 134) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 178 && computedPropertyName.expression.operatorToken.kind === 23) { + if (computedPropertyName.expression.kind === 179 && computedPropertyName.expression.operatorToken.kind === 24) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 210 || - node.kind === 170 || - node.kind === 140); + ts.Debug.assert(node.kind === 211 || + node.kind === 171 || + node.kind === 141); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -21862,26 +22235,26 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_17 = prop.name; - if (prop.kind === 184 || - name_17.kind === 133) { + if (prop.kind === 185 || + name_17.kind === 134) { checkGrammarComputedPropertyName(name_17); continue; } var currentKind = void 0; - if (prop.kind === 242 || prop.kind === 243) { + if (prop.kind === 243 || prop.kind === 244) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_17.kind === 7) { + if (name_17.kind === 8) { checkGrammarNumericLiteral(name_17); } currentKind = Property; } - else if (prop.kind === 140) { + else if (prop.kind === 141) { currentKind = Property; } - else if (prop.kind === 142) { + else if (prop.kind === 143) { currentKind = GetAccessor; } - else if (prop.kind === 143) { + else if (prop.kind === 144) { currentKind = SetAccesor; } else { @@ -21913,7 +22286,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 236) { + if (attr.kind === 237) { continue; } var jsxAttr = attr; @@ -21925,7 +22298,7 @@ var ts; return grammarErrorOnNode(name_18, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 237 && !initializer.expression) { + if (initializer && initializer.kind === 238 && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -21934,24 +22307,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 209) { + if (forInOrOfStatement.initializer.kind === 210) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 197 + var diagnostic = forInOrOfStatement.kind === 198 ? 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 === 197 + var diagnostic = forInOrOfStatement.kind === 198 ? 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 === 197 + var diagnostic = forInOrOfStatement.kind === 198 ? 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); @@ -21974,10 +22347,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 142 && accessor.parameters.length) { + else if (kind === 143 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 143) { + else if (kind === 144) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -22002,7 +22375,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 133 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 134 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -22012,7 +22385,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 162) { + if (node.parent.kind === 163) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -22031,22 +22404,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 213) { 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 === 152) { + else if (node.parent.kind === 153) { 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 196: case 197: case 198: - case 194: + case 199: case 195: + case 196: return true; - case 204: + case 205: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -22058,9 +22431,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 204: + case 205: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 199 + var isMisplacedContinueLabel = node.kind === 200 && !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); @@ -22068,8 +22441,8 @@ var ts; return false; } break; - case 203: - if (node.kind === 200 && !node.label) { + case 204: + if (node.kind === 201 && !node.label) { return false; } break; @@ -22082,13 +22455,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 200 + var message = node.kind === 201 ? 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 === 200 + var message = node.kind === 201 ? 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); @@ -22100,7 +22473,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 159 || node.name.kind === 158) { + if (node.name.kind === 160 || node.name.kind === 159) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -22109,7 +22482,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 197 && node.parent.parent.kind !== 198) { + if (node.parent.parent.kind !== 198 && node.parent.parent.kind !== 199) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -22129,7 +22502,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 66) { + if (name.kind === 67) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -22138,7 +22511,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 184) { + if (element.kind !== 185) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -22155,15 +22528,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 193: case 194: case 195: - case 202: case 196: + case 203: case 197: case 198: + case 199: return false; - case 204: + case 205: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -22179,13 +22552,13 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 176) { + if (expression.kind === 177) { var unaryExpression = expression; - if (unaryExpression.operator === 34 || unaryExpression.operator === 35) { + if (unaryExpression.operator === 35 || unaryExpression.operator === 36) { expression = unaryExpression.operand; } } - if (expression.kind === 7) { + if (expression.kind === 8) { return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); } return false; @@ -22198,7 +22571,7 @@ var ts; var inAmbientContext = ts.isInAmbientContext(enumDecl); for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; - if (node.name.kind === 133) { + if (node.name.kind === 134) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -22241,7 +22614,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 66 && + return node.kind === 67 && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -22261,12 +22634,12 @@ var ts; return true; } } - else if (node.parent.kind === 212) { + else if (node.parent.kind === 213) { 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 === 152) { + else if (node.parent.kind === 153) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -22276,11 +22649,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 212 || + if (node.kind === 213 || + node.kind === 220 || node.kind === 219 || - node.kind === 218 || + node.kind === 226 || node.kind === 225 || - node.kind === 224 || (node.flags & 2) || (node.flags & (1 | 1024))) { return false; @@ -22290,7 +22663,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 190) { + if (ts.isDeclaration(decl) || decl.kind === 191) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -22309,7 +22682,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 189 || node.parent.kind === 216 || node.parent.kind === 245) { + if (node.parent.kind === 190 || node.parent.kind === 217 || node.parent.kind === 246) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -22382,7 +22755,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 219); + ts.Debug.assert(aliasEmitInfo.node.kind === 220); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -22455,10 +22828,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 208) { + if (declaration.kind === 209) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 222 || declaration.kind === 223 || declaration.kind === 220) { + else if (declaration.kind === 223 || declaration.kind === 224 || declaration.kind === 221) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -22469,7 +22842,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 219) { + if (moduleElementEmitInfo.node.kind === 220) { moduleElementEmitInfo.isVisible = true; } else { @@ -22477,12 +22850,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 215) { + if (nodeToCheck.kind === 216) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 215) { + if (nodeToCheck.kind === 216) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -22569,62 +22942,62 @@ var ts; } function emitType(type) { switch (type.kind) { - case 114: - case 127: - case 125: - case 117: + case 115: case 128: - case 100: - case 8: + case 126: + case 118: + case 129: + case 101: + case 9: return writeTextOfNode(currentSourceFile, type); - case 185: + case 186: return emitExpressionWithTypeArguments(type); - case 148: + case 149: return emitTypeReference(type); - case 151: + case 152: return emitTypeQuery(type); - case 153: - return emitArrayType(type); case 154: - return emitTupleType(type); + return emitArrayType(type); case 155: - return emitUnionType(type); + return emitTupleType(type); case 156: - return emitIntersectionType(type); + return emitUnionType(type); case 157: + return emitIntersectionType(type); + case 158: return emitParenType(type); - case 149: case 150: + case 151: return emitSignatureDeclarationWithJsDocComments(type); - case 152: + case 153: return emitTypeLiteral(type); - case 66: + case 67: return emitEntityName(type); - case 132: + case 133: return emitEntityName(type); - case 147: + case 148: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 66) { + if (entityName.kind === 67) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 132 ? entityName.left : entityName.expression; - var right = entityName.kind === 132 ? entityName.right : entityName.name; + var left = entityName.kind === 133 ? entityName.left : entityName.expression; + var right = entityName.kind === 133 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 218 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 219 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 66 || node.expression.kind === 163); + ts.Debug.assert(node.expression.kind === 67 || node.expression.kind === 164); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -22700,7 +23073,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 66) { + if (node.expression.kind === 67) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -22718,7 +23091,7 @@ var ts; } write(";"); writeLine(); - if (node.expression.kind === 66) { + if (node.expression.kind === 67) { var nodes = resolver.collectLinkedAliases(node.expression); writeAsynchronousModuleElements(nodes); } @@ -22736,10 +23109,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 218 || - (node.parent.kind === 245 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 219 || + (node.parent.kind === 246 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 245) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -22748,7 +23121,7 @@ var ts; }); } else { - if (node.kind === 219) { + if (node.kind === 220) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -22766,23 +23139,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 210: + case 211: return writeFunctionDeclaration(node); - case 190: + case 191: return writeVariableStatement(node); - case 212: + case 213: return writeInterfaceDeclaration(node); - case 211: + case 212: return writeClassDeclaration(node); - case 213: - return writeTypeAliasDeclaration(node); case 214: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 215: + return writeEnumDeclaration(node); + case 216: return writeModuleDeclaration(node); - case 218: - return writeImportEqualsDeclaration(node); case 219: + return writeImportEqualsDeclaration(node); + case 220: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -22796,7 +23169,7 @@ var ts; if (node.flags & 1024) { write("default "); } - else if (node.kind !== 212) { + else if (node.kind !== 213) { write("declare "); } } @@ -22843,7 +23216,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 221) { + if (namedBindings.kind === 222) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -22869,7 +23242,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 221) { + if (node.importClause.namedBindings.kind === 222) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -22925,7 +23298,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 216) { + while (node.body.kind !== 217) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -22942,14 +23315,18 @@ var ts; enclosingDeclaration = prevEnclosingDeclaration; } function writeTypeAliasDeclaration(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); writeTextOfNode(currentSourceFile, node.name); + emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); write(";"); writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, @@ -22986,7 +23363,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 140 && (node.parent.flags & 32); + return node.parent.kind === 141 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -22996,15 +23373,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 149 || - node.parent.kind === 150 || - (node.parent.parent && node.parent.parent.kind === 152)) { - ts.Debug.assert(node.parent.kind === 140 || - node.parent.kind === 139 || - node.parent.kind === 149 || + if (node.parent.kind === 150 || + node.parent.kind === 151 || + (node.parent.parent && node.parent.parent.kind === 153)) { + ts.Debug.assert(node.parent.kind === 141 || + node.parent.kind === 140 || node.parent.kind === 150 || - node.parent.kind === 144 || - node.parent.kind === 145); + node.parent.kind === 151 || + node.parent.kind === 145 || + node.parent.kind === 146); emitType(node.constraint); } else { @@ -23014,31 +23391,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 211: + case 212: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 212: + case 213: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 145: + case 146: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 144: + case 145: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 141: case 140: - case 139: 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 === 211) { + else if (node.parent.parent.kind === 212) { 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 210: + case 211: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -23068,7 +23445,7 @@ var ts; } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 211) { + if (node.parent.parent.kind === 212) { 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; @@ -23148,16 +23525,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 208 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 209 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 138 || node.kind === 137) && ts.hasQuestionToken(node)) { + if ((node.kind === 139 || node.kind === 138) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 138 || node.kind === 137) && node.parent.kind === 152) { + if ((node.kind === 139 || node.kind === 138) && node.parent.kind === 153) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -23166,14 +23543,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 208) { + if (node.kind === 209) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 138 || node.kind === 137) { + else if (node.kind === 139 || node.kind === 138) { if (node.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23181,7 +23558,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 211) { + else if (node.parent.kind === 212) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23207,7 +23584,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 184) { + if (element.kind !== 185) { elements.push(element); } } @@ -23273,7 +23650,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 142 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 143 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -23286,7 +23663,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 142 + return accessor.kind === 143 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -23295,7 +23672,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 143) { + if (accessorWithTypeAnnotation.kind === 144) { 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 : @@ -23341,17 +23718,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 210) { + if (node.kind === 211) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 140) { + else if (node.kind === 141) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 210) { + if (node.kind === 211) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 141) { + else if (node.kind === 142) { write("constructor"); } else { @@ -23368,11 +23745,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 145 || node.kind === 150) { + if (node.kind === 146 || node.kind === 151) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 146) { + if (node.kind === 147) { write("["); } else { @@ -23381,20 +23758,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 146) { + if (node.kind === 147) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 149 || node.kind === 150; - if (isFunctionTypeOrConstructorType || node.parent.kind === 152) { + var isFunctionTypeOrConstructorType = node.kind === 150 || node.kind === 151; + if (isFunctionTypeOrConstructorType || node.parent.kind === 153) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 141 && !(node.flags & 32)) { + else if (node.kind !== 142 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -23405,23 +23782,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 145: + case 146: 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 144: + case 145: 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 146: + case 147: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; + case 141: case 140: - case 139: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23429,7 +23806,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 211) { + else if (node.parent.kind === 212) { 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 : @@ -23442,7 +23819,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 210: + case 211: 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 : @@ -23470,13 +23847,13 @@ var ts; else { writeTextOfNode(currentSourceFile, node.name); } - if (node.initializer || ts.hasQuestionToken(node)) { + if (resolver.isOptionalParameter(node)) { write("?"); } decreaseIndent(); - if (node.parent.kind === 149 || - node.parent.kind === 150 || - node.parent.parent.kind === 152) { + if (node.parent.kind === 150 || + node.parent.kind === 151 || + node.parent.parent.kind === 153) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -23492,22 +23869,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 141: + case 142: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 145: + case 146: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 144: + case 145: return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + case 141: case 140: - case 139: if (node.parent.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -23515,7 +23892,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 211) { + else if (node.parent.parent.kind === 212) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23527,7 +23904,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 210: + case 211: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23538,12 +23915,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 158) { + if (bindingPattern.kind === 159) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 159) { + else if (bindingPattern.kind === 160) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -23562,21 +23939,20 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 184) { + if (bindingElement.kind === 185) { write(" "); } - else if (bindingElement.kind === 160) { + else if (bindingElement.kind === 161) { if (bindingElement.propertyName) { writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); - emitBindingPattern(bindingElement.name); } - else if (bindingElement.name) { + if (bindingElement.name) { if (ts.isBindingPattern(bindingElement.name)) { emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 66); + ts.Debug.assert(bindingElement.name.kind === 67); if (bindingElement.dotDotDotToken) { write("..."); } @@ -23588,39 +23964,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 210: - case 215: - case 218: - case 212: case 211: + case 216: + case 219: case 213: + case 212: case 214: + case 215: return emitModuleElement(node, isModuleElementVisible(node)); - case 190: + case 191: return emitModuleElement(node, isVariableStatementVisible(node)); - case 219: + case 220: return emitModuleElement(node, !node.importClause); - case 225: + case 226: return emitExportDeclaration(node); + case 142: case 141: case 140: - case 139: return writeFunctionDeclaration(node); - case 145: - case 144: case 146: + case 145: + case 147: return emitSignatureDeclarationWithJsDocComments(node); - case 142: case 143: + case 144: return emitAccessorDeclaration(node); + case 139: case 138: - case 137: return emitPropertyDeclaration(node); - case 244: + case 245: return emitEnumMemberDeclaration(node); - case 224: + case 225: return emitExportAssignment(node); - case 245: + case 246: return emitSourceFile(node); } } @@ -23629,7 +24005,7 @@ var ts; ? referencedFile.fileName : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + : ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); referencePathsOutput += "/// " + newLine; } @@ -23685,17 +24061,17 @@ var ts; emitFile(jsFilePath, sourceFile); } }); - if (compilerOptions.out) { - emitFile(compilerOptions.out); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } else { if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, ts.forEach(host.getSourceFiles(), shouldEmitJsx) ? ".jsx" : ".js"); + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!ts.isDeclarationFile(targetSourceFile) && compilerOptions.out) { - emitFile(compilerOptions.out); + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); @@ -23748,7 +24124,7 @@ var ts; var writeEmittedFiles = writeJavaScriptFile; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; - var emit = emitNodeWithoutSourceMap; + var emit = emitNodeWithCommentsAndWithoutSourcemap; var emitStart = function (node) { }; var emitEnd = function (node) { }; var emitToken = emitTokenText; @@ -23819,7 +24195,7 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 ? + var baseName = expr.kind === 9 ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; return makeUniqueName(baseName); } @@ -23831,19 +24207,19 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 66: + case 67: return makeUniqueName(node.text); + case 216: case 215: - case 214: return generateNameForModuleOrEnum(node); - case 219: - case 225: + case 220: + case 226: return generateNameForImportOrExportDeclaration(node); - case 210: case 211: - case 224: + case 212: + case 225: return generateNameForExportDefault(); - case 183: + case 184: return generateNameForClassExpression(); } } @@ -23897,7 +24273,7 @@ var ts; function base64VLQFormatEncode(inValue) { function base64FormatEncode(inValue) { if (inValue < 64) { - return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(inValue); + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); } throw TypeError(inValue + ": not a 64 based value"); } @@ -23982,7 +24358,7 @@ var ts; var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { var name_22 = node.name; - if (!name_22 || name_22.kind !== 133) { + if (!name_22 || name_22.kind !== 134) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -23999,18 +24375,18 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 210 || - node.kind === 170 || + else if (node.kind === 211 || + node.kind === 171 || + node.kind === 141 || node.kind === 140 || - node.kind === 139 || - node.kind === 142 || node.kind === 143 || - node.kind === 215 || - node.kind === 211 || - node.kind === 214) { + node.kind === 144 || + node.kind === 216 || + node.kind === 212 || + node.kind === 215) { if (node.name) { var name_23 = node.name; - scopeName = name_23.kind === 133 + scopeName = name_23.kind === 134 ? ts.getTextOfNode(name_23) : node.name.text; } @@ -24109,7 +24485,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node); } - if (node.kind !== 245) { + if (node.kind !== 246) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node); recordEmitNodeEndSpan(node); @@ -24120,8 +24496,11 @@ var ts; } } } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithSourceMap; + emit = emitNodeWithCommentsAndWithSourcemap; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -24133,7 +24512,7 @@ var ts; ts.writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); } function createTempVariable(flags) { - var result = ts.createSynthesizedNode(66); + var result = ts.createSynthesizedNode(67); result.text = makeTempVariableName(flags); return result; } @@ -24243,7 +24622,9 @@ var ts; write(", "); } } - emitNode(nodes[start + i]); + var node = nodes[start + i]; + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); leadingComma = true; } if (trailingComma) { @@ -24269,7 +24650,7 @@ var ts; } } function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 7 && text.length > 1) { + if (node.kind === 8 && text.length > 1) { switch (text.charCodeAt(1)) { case 98: case 66: @@ -24282,7 +24663,7 @@ var ts; } function emitLiteral(node) { var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { @@ -24294,23 +24675,23 @@ var ts; } function getLiteralText(node) { if (languageVersion < 2 && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); + return getQuotedEscapedLiteralText("\"", node.text, "\""); } if (node.parent) { return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); } switch (node.kind) { - case 8: - return getQuotedEscapedLiteralText('"', node.text, '"'); - case 10: - return getQuotedEscapedLiteralText('`', node.text, '`'); + case 9: + return getQuotedEscapedLiteralText("\"", node.text, "\""); case 11: - return getQuotedEscapedLiteralText('`', node.text, '${'); + return getQuotedEscapedLiteralText("`", node.text, "`"); case 12: - return getQuotedEscapedLiteralText('}', node.text, '${'); + return getQuotedEscapedLiteralText("`", node.text, "${"); case 13: - return getQuotedEscapedLiteralText('}', node.text, '`'); - case 7: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8: return node.text; } ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); @@ -24320,15 +24701,15 @@ var ts; } function emitDownlevelRawTemplateLiteral(node) { var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - var isLast = node.kind === 10 || node.kind === 13; + var isLast = node.kind === 11 || node.kind === 14; text = text.substring(1, text.length - (isLast ? 1 : 2)); text = text.replace(/\r\n?/g, "\n"); text = ts.escapeString(text); - write('"' + text + '"'); + write("\"" + text + "\""); } function emitDownlevelTaggedTemplateArray(node, literalEmitter) { write("["); - if (node.template.kind === 10) { + if (node.template.kind === 11) { literalEmitter(node.template); } else { @@ -24354,11 +24735,11 @@ var ts; emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); write("("); emit(tempVariable); - if (node.template.kind === 180) { + if (node.template.kind === 181) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 178 - && templateSpan.expression.operatorToken.kind === 23; + var needsParens = templateSpan.expression.kind === 179 + && templateSpan.expression.operatorToken.kind === 24; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -24381,7 +24762,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 169 + var needsParens = templateSpan.expression.kind !== 170 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); @@ -24414,11 +24795,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 165: case 166: - return parent.expression === template; case 167: - case 169: + return parent.expression === template; + case 168: + case 170: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -24426,20 +24807,20 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 178: + case 179: switch (expression.operatorToken.kind) { - case 36: case 37: case 38: + case 39: return 1; - case 34: case 35: + case 36: return 0; default: return -1; } - case 181: - case 179: + case 182: + case 180: return -1; default: return 1; @@ -24452,10 +24833,10 @@ var ts; } function jsxEmitReact(node) { function emitTagName(name) { - if (name.kind === 66 && ts.isIntrinsicJsxName(name.text)) { - write('"'); + if (name.kind === 67 && ts.isIntrinsicJsxName(name.text)) { + write("\""); emit(name); - write('"'); + write("\""); } else { emit(name); @@ -24463,9 +24844,9 @@ var ts; } function emitAttributeName(name) { if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write('"'); + write("\""); emit(name); - write('"'); + write("\""); } else { emit(name); @@ -24491,36 +24872,36 @@ var ts; } else { var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 236; })) { + if (ts.forEach(attrs, function (attr) { return attr.kind === 237; })) { write("React.__spread("); var haveOpenedObjectLiteral = false; - for (var i_2 = 0; i_2 < attrs.length; i_2++) { - if (attrs[i_2].kind === 236) { - if (i_2 === 0) { + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 237) { + if (i_1 === 0) { write("{}, "); } if (haveOpenedObjectLiteral) { write("}"); haveOpenedObjectLiteral = false; } - if (i_2 > 0) { + if (i_1 > 0) { write(", "); } - emit(attrs[i_2].expression); + emit(attrs[i_1].expression); } else { - ts.Debug.assert(attrs[i_2].kind === 235); + ts.Debug.assert(attrs[i_1].kind === 236); if (haveOpenedObjectLiteral) { write(", "); } else { haveOpenedObjectLiteral = true; - if (i_2 > 0) { + if (i_1 > 0) { write(", "); } write("{"); } - emitJsxAttribute(attrs[i_2]); + emitJsxAttribute(attrs[i_1]); } } if (haveOpenedObjectLiteral) @@ -24540,15 +24921,15 @@ var ts; } if (children) { for (var i = 0; i < children.length; i++) { - if (children[i].kind === 237 && !(children[i].expression)) { + if (children[i].kind === 238 && !(children[i].expression)) { continue; } - if (children[i].kind === 233) { + if (children[i].kind === 234) { var text = getTextToEmit(children[i]); if (text !== undefined) { - write(', "'); + write(", \""); write(text); - write('"'); + write("\""); } } else { @@ -24560,11 +24941,11 @@ var ts; write(")"); emitTrailingComments(openingNode); } - if (node.kind === 230) { + if (node.kind === 231) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 231); + ts.Debug.assert(node.kind === 232); emitJsxElement(node); } } @@ -24584,11 +24965,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 236) { + if (attribs[i].kind === 237) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 235); + ts.Debug.assert(attribs[i].kind === 236); emitJsxAttribute(attribs[i]); } } @@ -24596,11 +24977,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 231)) { + if (node.attributes.length > 0 || (node.kind === 232)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 231) { + if (node.kind === 232) { write("/>"); } else { @@ -24619,20 +25000,20 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 230) { + if (node.kind === 231) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 231); + ts.Debug.assert(node.kind === 232); emitJsxOpeningOrSelfClosingElement(node); } } function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 160); - if (node.kind === 8) { + ts.Debug.assert(node.kind !== 161); + if (node.kind === 9) { emitLiteral(node); } - else if (node.kind === 133) { + else if (node.kind === 134) { if (ts.nodeIsDecorated(node.parent)) { if (!computedPropertyNamesToGeneratedNames) { computedPropertyNamesToGeneratedNames = []; @@ -24651,7 +25032,7 @@ var ts; } else { write("\""); - if (node.kind === 7) { + if (node.kind === 8) { write(node.text); } else { @@ -24663,58 +25044,60 @@ var ts; function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 161: - case 178: - case 165: - case 238: - case 133: + case 162: case 179: - case 136: - case 172: - case 194: - case 164: - case 224: - case 192: - case 185: - case 196: + case 166: + case 239: + case 134: + case 180: + case 137: + case 173: + case 195: + case 165: + case 225: + case 193: + case 186: case 197: case 198: - case 193: - case 231: + case 199: + case 194: case 232: - case 166: - case 169: - case 177: - case 176: - case 201: - case 243: - case 182: - case 203: + case 233: + case 237: + case 238: case 167: - case 187: - case 205: + case 170: + case 178: + case 177: + case 202: + case 244: + case 183: + case 204: case 168: - case 173: + case 188: + case 206: + case 169: case 174: - case 195: - case 202: - case 181: + case 175: + case 196: + case 203: + case 182: return true; - case 160: - case 244: - case 135: - case 242: - case 138: - case 208: + case 161: + case 245: + case 136: + case 243: + case 139: + case 209: return parent.initializer === node; - case 163: + case 164: return parent.expression === node; + case 172: case 171: - case 170: return parent.body === node; - case 218: + case 219: return parent.moduleReference === node; - case 132: + case 133: return parent.left === node; } return false; @@ -24726,7 +25109,7 @@ var ts; } var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 245) { + if (container.kind === 246) { if (languageVersion < 2 && compilerOptions.module !== 4) { write("exports."); } @@ -24739,12 +25122,12 @@ var ts; else if (languageVersion < 2) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 220) { + if (declaration.kind === 221) { write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 ? '["default"]' : ".default"); + write(languageVersion === 0 ? "[\"default\"]" : ".default"); return; } - else if (declaration.kind === 223) { + else if (declaration.kind === 224) { write(getGeneratedNameForNode(declaration.parent.parent.parent)); write("."); writeTextOfNode(currentSourceFile, declaration.propertyName || declaration.name); @@ -24761,13 +25144,13 @@ var ts; } function isNameOfNestedRedeclaration(node) { if (languageVersion < 2) { - var parent_7 = node.parent; - switch (parent_7.kind) { - case 160: - case 211: - case 214: - case 208: - return parent_7.name === node && resolver.isNestedRedeclaration(parent_7); + var parent_6 = node.parent; + switch (parent_6.kind) { + case 161: + case 212: + case 215: + case 209: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); } } return false; @@ -24841,7 +25224,7 @@ var ts; emit(node.expression); } function emitYieldExpression(node) { - write(ts.tokenToString(111)); + write(ts.tokenToString(112)); if (node.asteriskToken) { write("*"); } @@ -24855,7 +25238,7 @@ var ts; if (needsParenthesis) { write("("); } - write(ts.tokenToString(111)); + write(ts.tokenToString(112)); write(" "); emit(node.expression); if (needsParenthesis) { @@ -24863,22 +25246,22 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 178 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 179 && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 179 && node.parent.condition === node) { + else if (node.parent.kind === 180 && node.parent.condition === node) { return true; } return false; } function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { - case 66: - case 161: - case 163: + case 67: + case 162: case 164: case 165: - case 169: + case 166: + case 170: return false; } return true; @@ -24895,17 +25278,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 182) { + if (e.kind === 183) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 161) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 182) { + while (i < length && elements[i].kind !== 183) { i++; } write("["); @@ -24928,7 +25311,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 182; + return node.kind === 183; } function emitArrayLiteral(node) { var elements = node.elements; @@ -24989,7 +25372,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 142 || property.kind === 143) { + if (property.kind === 143 || property.kind === 144) { var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { continue; @@ -25040,13 +25423,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 242) { + if (property.kind === 243) { emit(property.initializer); } - else if (property.kind === 243) { + else if (property.kind === 244) { emitExpressionIdentifier(property.name); } - else if (property.kind === 140) { + else if (property.kind === 141) { emitFunctionDeclaration(property); } else { @@ -25078,7 +25461,7 @@ var ts; var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 133) { + if (properties[i].name.kind === 134) { numInitialNonComputedProperties = i; break; } @@ -25092,35 +25475,35 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(178, startsOnNewLine); + var result = ts.createSynthesizedNode(179, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(163); + var result = ts.createSynthesizedNode(164); result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(20); + result.dotToken = ts.createSynthesizedNode(21); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(164); + var result = ts.createSynthesizedNode(165); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; } function parenthesizeForAccess(expr) { - while (expr.kind === 168 || expr.kind === 186) { + while (expr.kind === 169 || expr.kind === 187) { expr = expr.expression; } if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 166 && - expr.kind !== 7) { + expr.kind !== 167 && + expr.kind !== 8) { return expr; } - var node = ts.createSynthesizedNode(169); + var node = ts.createSynthesizedNode(170); node.expression = expr; return node; } @@ -25142,11 +25525,12 @@ var ts; function emitPropertyAssignment(node) { emit(node.name); write(": "); + emitTrailingCommentsOfPosition(node.initializer.pos); emit(node.initializer); } function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 245; + return container && container.kind !== 246; } function emitShorthandPropertyAssignment(node) { writeTextOfNode(currentSourceFile, node.name); @@ -25156,20 +25540,25 @@ var ts; } } function tryEmitConstantValue(node) { - if (compilerOptions.isolatedModules) { - return false; - } - var constantValue = resolver.getConstantValue(node); + var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 163 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 164 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; } return false; } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 164 || node.kind === 165 + ? resolver.getConstantValue(node) + : undefined; + } function indentIfOnDifferentLines(parent, node1, node2, valueToWriteWhenNotIndenting) { var realNodesAreOnDifferentLines = !ts.nodeIsSynthesized(parent) && !nodeEndIsOnSameLineAsNodeStart(node1, node2); var synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine(node2); @@ -25192,9 +25581,15 @@ var ts; emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); var shouldEmitSpace; - if (!indentedBeforeDot && node.expression.kind === 7) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(20)) < 0; + if (!indentedBeforeDot) { + if (node.expression.kind === 8) { + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21)) < 0; + } + else { + var constantValue = tryGetConstEnumValue(node.expression); + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } } if (shouldEmitSpace) { write(" ."); @@ -25212,7 +25607,7 @@ var ts; emit(node.right); } function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 66) { + if (node.left.kind === 67) { emitEntityNameAsExpression(node.left, useFallback); } else if (useFallback) { @@ -25228,11 +25623,11 @@ var ts; emitEntityNameAsExpression(node.left, false); } write("."); - emitNodeWithoutSourceMap(node.right); + emit(node.right); } function emitEntityNameAsExpression(node, useFallback) { switch (node.kind) { - case 66: + case 67: if (useFallback) { write("typeof "); emitExpressionIdentifier(node); @@ -25240,7 +25635,7 @@ var ts; } emitExpressionIdentifier(node); break; - case 132: + case 133: emitQualifiedNameAsExpression(node, useFallback); break; } @@ -25255,16 +25650,16 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 182; }); + return ts.forEach(elements, function (e) { return e.kind === 183; }); } function skipParentheses(node) { - while (node.kind === 169 || node.kind === 168 || node.kind === 186) { + while (node.kind === 170 || node.kind === 169 || node.kind === 187) { node = node.expression; } return node; } function emitCallTarget(node) { - if (node.kind === 66 || node.kind === 94 || node.kind === 92) { + if (node.kind === 67 || node.kind === 95 || node.kind === 93) { emit(node); return node; } @@ -25279,18 +25674,18 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 163) { + if (expr.kind === 164) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 164) { + else if (expr.kind === 165) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); write("]"); } - else if (expr.kind === 92) { + else if (expr.kind === 93) { target = expr; write("_super"); } @@ -25299,7 +25694,7 @@ var ts; } write(".apply("); if (target) { - if (target.kind === 92) { + if (target.kind === 93) { emitThis(target); } else { @@ -25319,13 +25714,13 @@ var ts; return; } var superCall = false; - if (node.expression.kind === 92) { + if (node.expression.kind === 93) { emitSuper(node.expression); superCall = true; } else { emit(node.expression); - superCall = node.expression.kind === 163 && node.expression.expression.kind === 92; + superCall = node.expression.kind === 164 && node.expression.expression.kind === 93; } if (superCall && languageVersion < 2) { write(".call("); @@ -25376,20 +25771,20 @@ var ts; } } function emitParenExpression(node) { - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 171) { - if (node.expression.kind === 168 || node.expression.kind === 186) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172) { + if (node.expression.kind === 169 || node.expression.kind === 187) { var operand = node.expression.expression; - while (operand.kind === 168 || operand.kind === 186) { + while (operand.kind === 169 || operand.kind === 187) { operand = operand.expression; } - if (operand.kind !== 176 && + if (operand.kind !== 177 && + operand.kind !== 175 && operand.kind !== 174 && operand.kind !== 173 && - operand.kind !== 172 && - operand.kind !== 177 && - operand.kind !== 166 && - !(operand.kind === 165 && node.parent.kind === 166) && - !(operand.kind === 170 && node.parent.kind === 165)) { + operand.kind !== 178 && + operand.kind !== 167 && + !(operand.kind === 166 && node.parent.kind === 167) && + !(operand.kind === 171 && node.parent.kind === 166)) { emit(operand); return; } @@ -25400,25 +25795,25 @@ var ts; write(")"); } function emitDeleteExpression(node) { - write(ts.tokenToString(75)); + write(ts.tokenToString(76)); write(" "); emit(node.expression); } function emitVoidExpression(node) { - write(ts.tokenToString(100)); + write(ts.tokenToString(101)); write(" "); emit(node.expression); } function emitTypeOfExpression(node) { - write(ts.tokenToString(98)); + write(ts.tokenToString(99)); write(" "); emit(node.expression); } function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 66 || ts.nodeIsSynthesized(node)) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 67 || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 208 || node.parent.kind === 160); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 || node.parent.kind === 161); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); @@ -25432,12 +25827,12 @@ var ts; write("\", "); } write(ts.tokenToString(node.operator)); - if (node.operand.kind === 176) { + if (node.operand.kind === 177) { var operand = node.operand; - if (node.operator === 34 && (operand.operator === 34 || operand.operator === 39)) { + if (node.operator === 35 && (operand.operator === 35 || operand.operator === 40)) { write(" "); } - else if (node.operator === 35 && (operand.operator === 35 || operand.operator === 40)) { + else if (node.operator === 36 && (operand.operator === 36 || operand.operator === 41)) { write(" "); } } @@ -25454,7 +25849,7 @@ var ts; write("\", "); write(ts.tokenToString(node.operator)); emit(node.operand); - if (node.operator === 39) { + if (node.operator === 40) { write(") - 1)"); } else { @@ -25475,10 +25870,10 @@ var ts; } var current = node; while (current) { - if (current.kind === 245) { + if (current.kind === 246) { return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); } - else if (ts.isFunctionLike(current) || current.kind === 216) { + else if (ts.isFunctionLike(current) || current.kind === 217) { return false; } else { @@ -25487,13 +25882,13 @@ var ts; } } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operatorToken.kind === 54 && - (node.left.kind === 162 || node.left.kind === 161)) { - emitDestructuring(node, node.parent.kind === 192); + if (languageVersion < 2 && node.operatorToken.kind === 55 && + (node.left.kind === 163 || node.left.kind === 162)) { + emitDestructuring(node, node.parent.kind === 193); } else { - var exportChanged = node.operatorToken.kind >= 54 && - node.operatorToken.kind <= 65 && + var exportChanged = node.operatorToken.kind >= 55 && + node.operatorToken.kind <= 66 && isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); if (exportChanged) { write(exportFunctionForFile + "(\""); @@ -25501,7 +25896,7 @@ var ts; write("\", "); } emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 ? " " : undefined); + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); @@ -25536,36 +25931,36 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 189) { + if (node && node.kind === 190) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { if (isSingleLineEmptyBlock(node)) { - emitToken(14, node.pos); + emitToken(15, node.pos); write(" "); - emitToken(15, node.statements.end); + emitToken(16, node.statements.end); return; } - emitToken(14, node.pos); + emitToken(15, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 216) { - ts.Debug.assert(node.parent.kind === 215); + if (node.kind === 217) { + ts.Debug.assert(node.parent.kind === 216); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 216) { + if (node.kind === 217) { emitTempDeclarations(true); } decreaseIndent(); writeLine(); - emitToken(15, node.statements.end); + emitToken(16, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 189) { + if (node.kind === 190) { write(" "); emit(node); } @@ -25577,20 +25972,20 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 171); + emitParenthesizedIf(node.expression, node.expression.kind === 172); write(";"); } function emitIfStatement(node) { - var endPos = emitToken(85, node.pos); + var endPos = emitToken(86, node.pos); write(" "); - endPos = emitToken(16, endPos); + endPos = emitToken(17, endPos); emit(node.expression); - emitToken(17, node.expression.end); + emitToken(18, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(77, node.thenStatement.end); - if (node.elseStatement.kind === 193) { + emitToken(78, node.thenStatement.end); + if (node.elseStatement.kind === 194) { write(" "); emit(node.elseStatement); } @@ -25602,7 +25997,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 189) { + if (node.statement.kind === 190) { write(" "); } else { @@ -25622,13 +26017,13 @@ var ts; if (shouldHoistVariable(decl, true)) { return false; } - var tokenKind = 99; + var tokenKind = 100; if (decl && languageVersion >= 2) { if (ts.isLet(decl)) { - tokenKind = 105; + tokenKind = 106; } else if (ts.isConst(decl)) { - tokenKind = 71; + tokenKind = 72; } } if (startPos !== undefined) { @@ -25637,13 +26032,13 @@ var ts; } else { switch (tokenKind) { - case 99: + case 100: write("var "); break; - case 105: + case 106: write("let "); break; - case 71: + case 72: write("const "); break; } @@ -25668,10 +26063,10 @@ var ts; return started; } function emitForStatement(node) { - var endPos = emitToken(83, node.pos); + var endPos = emitToken(84, node.pos); write(" "); - endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 209) { + endPos = emitToken(17, endPos); + if (node.initializer && node.initializer.kind === 210) { var variableDeclarationList = node.initializer; var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); if (startIsEmitted) { @@ -25692,13 +26087,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 198) { + if (languageVersion < 2 && node.kind === 199) { return emitDownLevelForOfStatement(node); } - var endPos = emitToken(83, node.pos); + var endPos = emitToken(84, node.pos); write(" "); - endPos = emitToken(16, endPos); - if (node.initializer.kind === 209) { + endPos = emitToken(17, endPos); + if (node.initializer.kind === 210) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); @@ -25708,14 +26103,14 @@ var ts; else { emit(node.initializer); } - if (node.kind === 197) { + if (node.kind === 198) { write(" in "); } else { write(" of "); } emit(node.expression); - emitToken(17, node.expression.end); + emitToken(18, node.expression.end); emitEmbeddedStatement(node.statement); } function emitDownLevelForOfStatement(node) { @@ -25739,10 +26134,10 @@ var ts; // all destructuring. // Note also that because an extra statement is needed to assign to the LHS, // for-of bodies are always emitted as blocks. - var endPos = emitToken(83, node.pos); + var endPos = emitToken(84, node.pos); write(" "); - endPos = emitToken(16, endPos); - var rhsIsIdentifier = node.expression.kind === 66; + endPos = emitToken(17, endPos); + var rhsIsIdentifier = node.expression.kind === 67; var counter = createTempVariable(268435456); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0); emitStart(node.expression); @@ -25762,7 +26157,7 @@ var ts; emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); emitEnd(node.initializer); write("; "); @@ -25770,13 +26165,13 @@ var ts; emitNodeWithoutSourceMap(counter); write("++"); emitEnd(node.initializer); - emitToken(17, node.expression.end); + emitToken(18, node.expression.end); write(" {"); writeLine(); increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 209) { + if (node.initializer.kind === 210) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -25785,7 +26180,7 @@ var ts; emitDestructuring(declaration, false, rhsIterationValue); } else { - emitNodeWithoutSourceMap(declaration); + emitNodeWithCommentsAndWithoutSourcemap(declaration); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -25797,17 +26192,17 @@ var ts; } } else { - var assignmentExpression = createBinaryExpression(node.initializer, 54, rhsIterationValue, false); - if (node.initializer.kind === 161 || node.initializer.kind === 162) { + var assignmentExpression = createBinaryExpression(node.initializer, 55, rhsIterationValue, false); + if (node.initializer.kind === 162 || node.initializer.kind === 163) { emitDestructuring(assignmentExpression, true, undefined); } else { - emitNodeWithoutSourceMap(assignmentExpression); + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); } } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 189) { + if (node.statement.kind === 190) { emitLines(node.statement.statements); } else { @@ -25819,12 +26214,12 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 200 ? 67 : 72, node.pos); + emitToken(node.kind === 201 ? 68 : 73, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { - emitToken(91, node.pos); + emitToken(92, node.pos); emitOptional(" ", node.expression); write(";"); } @@ -25835,21 +26230,21 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(93, node.pos); + var endPos = emitToken(94, node.pos); write(" "); - emitToken(16, endPos); + emitToken(17, endPos); emit(node.expression); - endPos = emitToken(17, node.expression.end); + endPos = emitToken(18, node.expression.end); write(" "); emitCaseBlock(node.caseBlock, endPos); } function emitCaseBlock(node, startPos) { - emitToken(14, startPos); + emitToken(15, startPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(15, node.clauses.end); + emitToken(16, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === @@ -25864,7 +26259,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 238) { + if (node.kind === 239) { write("case "); emit(node.expression); write(":"); @@ -25899,16 +26294,16 @@ var ts; } function emitCatchClause(node) { writeLine(); - var endPos = emitToken(69, node.pos); + var endPos = emitToken(70, node.pos); write(" "); - emitToken(16, endPos); + emitToken(17, endPos); emit(node.variableDeclaration); - emitToken(17, node.variableDeclaration ? node.variableDeclaration.end : endPos); + emitToken(18, node.variableDeclaration ? node.variableDeclaration.end : endPos); write(" "); emitBlock(node.block); } function emitDebuggerStatement(node) { - emitToken(73, node.pos); + emitToken(74, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -25919,7 +26314,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 215); + } while (node && node.kind !== 216); return node; } function emitContainingModuleName(node) { @@ -25938,16 +26333,33 @@ var ts; write("exports."); } } - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); emitEnd(node.name); } function createVoidZero() { - var zero = ts.createSynthesizedNode(7); + var zero = ts.createSynthesizedNode(8); zero.text = "0"; - var result = ts.createSynthesizedNode(174); + var result = ts.createSynthesizedNode(175); result.expression = zero; return result; } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 246) { + ts.Debug.assert(!!(node.flags & 1024) || node.kind === 225); + if (compilerOptions.module === 1 || compilerOptions.module === 2 || compilerOptions.module === 3) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1) { + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } function emitExportMemberAssignment(node) { if (node.flags & 1) { writeLine(); @@ -25958,7 +26370,7 @@ var ts; write("default"); } else { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } write("\", "); emitDeclarationName(node); @@ -25966,6 +26378,7 @@ var ts; } else { if (node.flags & 1024) { + emitEs6ExportDefaultCompat(node); if (languageVersion === 0) { write("exports[\"default\"]"); } @@ -25984,44 +26397,48 @@ var ts; } } function emitExportMemberAssignments(name) { + if (compilerOptions.module === 4) { + return; + } if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); - if (compilerOptions.module === 4) { - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(specifier.name); - write("\", "); - emitExpressionIdentifier(name); - write(")"); - emitEnd(specifier.name); - } - else { - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - } + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); write(";"); } } } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(compilerOptions.module === 4); + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; var canDefineTempVariablesInPlace = false; - if (root.kind === 208) { + if (root.kind === 209) { var isExported = ts.getCombinedNodeFlags(root) & 1; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 135) { + else if (root.kind === 136) { canDefineTempVariablesInPlace = true; } - if (root.kind === 178) { + if (root.kind === 179) { emitAssignmentExpression(root); } else { @@ -26032,11 +26449,11 @@ var ts; if (emitCount++) { write(", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 208 || name.parent.kind === 160); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 || name.parent.kind === 161); var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); if (exportChanged) { write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(name); + emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } if (isVariableDeclarationOrBindingElement) { @@ -26052,7 +26469,7 @@ var ts; } } function ensureIdentifier(expr) { - if (expr.kind !== 66) { + if (expr.kind !== 67) { var identifier = createTempVariable(0); if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); @@ -26064,37 +26481,37 @@ var ts; } function createDefaultValueCheck(value, defaultValue) { value = ensureIdentifier(value); - var equals = ts.createSynthesizedNode(178); + var equals = ts.createSynthesizedNode(179); equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(31); + equals.operatorToken = ts.createSynthesizedNode(32); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(179); + var cond = ts.createSynthesizedNode(180); cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(51); + cond.questionToken = ts.createSynthesizedNode(52); cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(52); + cond.colonToken = ts.createSynthesizedNode(53); cond.whenFalse = whenFalse; return cond; } function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(7); + var node = ts.createSynthesizedNode(8); node.text = "" + value; return node; } function createPropertyAccessForDestructuringProperty(object, propName) { var syntheticName = ts.createSynthesizedNode(propName.kind); syntheticName.text = propName.text; - if (syntheticName.kind !== 66) { + if (syntheticName.kind !== 67) { return createElementAccessExpression(object, syntheticName); } return createPropertyAccessExpression(object, syntheticName); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(165); - var sliceIdentifier = ts.createSynthesizedNode(66); + var call = ts.createSynthesizedNode(166); + var sliceIdentifier = ts.createSynthesizedNode(67); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); call.arguments = ts.createSynthesizedNodeArray(); @@ -26108,7 +26525,7 @@ var ts; } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 242 || p.kind === 243) { + if (p.kind === 243 || p.kind === 244) { var propName = p.name; emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); } @@ -26121,8 +26538,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 184) { - if (e.kind !== 182) { + if (e.kind !== 185) { + if (e.kind !== 183) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); } else if (i === elements.length - 1) { @@ -26132,14 +26549,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 178 && target.operatorToken.kind === 54) { + if (target.kind === 179 && target.operatorToken.kind === 55) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 162) { + if (target.kind === 163) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 161) { + else if (target.kind === 162) { emitArrayLiteralAssignment(target, value); } else { @@ -26149,18 +26566,21 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (isAssignmentExpressionStatement) { + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 169) { + if (root.parent.kind !== 170) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 169) { + if (root.parent.kind !== 170) { write(")"); } } @@ -26180,11 +26600,11 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 158) { + if (pattern.kind === 159) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 184) { + else if (element.kind !== 185) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } @@ -26215,15 +26635,15 @@ var ts; var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 16384) && (getCombinedFlagsForIdentifier(node.name) & 16384); if (isUninitializedLet && - node.parent.parent.kind !== 197 && - node.parent.parent.kind !== 198) { + node.parent.parent.kind !== 198 && + node.parent.parent.kind !== 199) { initializer = createVoidZero(); } } var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); if (exportChanged) { write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); write("\", "); } emitModuleMemberName(node); @@ -26234,11 +26654,11 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 184) { + if (node.kind === 185) { return; } var name = node.name; - if (name.kind === 66) { + if (name.kind === 67) { emitExportMemberAssignments(name); } else if (ts.isBindingPattern(name)) { @@ -26246,7 +26666,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 208 && node.parent.kind !== 160)) { + if (!node.parent || (node.parent.kind !== 209 && node.parent.kind !== 161)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -26254,7 +26674,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 245; + node.parent.kind === 246; } function emitVariableStatement(node) { var startIsEmitted = false; @@ -26352,9 +26772,9 @@ var ts; emitEnd(parameter); write(" { "); emitStart(parameter); - emitNodeWithoutSourceMap(paramName); + emitNodeWithCommentsAndWithoutSourcemap(paramName); write(" = "); - emitNodeWithoutSourceMap(initializer); + emitNodeWithCommentsAndWithoutSourcemap(initializer); emitEnd(parameter); write("; }"); } @@ -26373,7 +26793,7 @@ var ts; emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -26394,7 +26814,7 @@ var ts; increaseIndent(); writeLine(); emitStart(restParam); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -26403,26 +26823,26 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 142 ? "get " : "set "); + write(node.kind === 143 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 171 && languageVersion >= 2; + return node.kind === 172 && languageVersion >= 2; } function emitDeclarationName(node) { if (node.name) { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } else { write(getGeneratedNameForNode(node)); } } function shouldEmitFunctionName(node) { - if (node.kind === 170) { + if (node.kind === 171) { return !!node.name; } - if (node.kind === 210) { + if (node.kind === 211) { return !!node.name || languageVersion < 2; } } @@ -26430,9 +26850,12 @@ var ts; if (ts.nodeIsMissing(node.body)) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== 140 && node.kind !== 139) { + if (node.kind !== 141 && node.kind !== 140 && + node.parent && node.parent.kind !== 243 && + node.parent.kind !== 166) { emitLeadingComments(node); } + emitStart(node); if (!shouldEmitAsArrowFunction(node)) { if (isES6ExportedDeclaration(node)) { write("export "); @@ -26450,10 +26873,11 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 210 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 211 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } - if (node.kind !== 140 && node.kind !== 139) { + emitEnd(node); + if (node.kind !== 141 && node.kind !== 140) { emitTrailingComments(node); } } @@ -26485,7 +26909,7 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 171; + var isArrowFunction = node.kind === 172; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096) !== 0; var args; if (!isArrowFunction) { @@ -26528,7 +26952,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 189) { + if (node.body.kind === 190) { emitBlockFunctionBody(node, node.body); } else { @@ -26576,10 +27000,10 @@ var ts; } write(" "); var current = body; - while (current.kind === 168) { + while (current.kind === 169) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 162); + emitParenthesizedIf(body, current.kind === 163); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -26645,17 +27069,17 @@ var ts; emitLeadingCommentsOfPosition(body.statements.end); decreaseIndent(); } - emitToken(15, body.statements.end); + emitToken(16, body.statements.end); scopeEmitEnd(); } function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 192) { + if (statement && statement.kind === 193) { var expr = statement.expression; - if (expr && expr.kind === 165) { + if (expr && expr.kind === 166) { var func = expr.expression; - if (func && func.kind === 92) { + if (func && func.kind === 93) { return statement; } } @@ -26679,24 +27103,24 @@ var ts; }); } function emitMemberAccessForPropertyName(memberName) { - if (memberName.kind === 8 || memberName.kind === 7) { + if (memberName.kind === 9 || memberName.kind === 8) { write("["); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 133) { + else if (memberName.kind === 134) { emitComputedPropertyName(memberName); } else { write("."); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); } } function getInitializedProperties(node, isStatic) { var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 138 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { + if (member.kind === 139 && isStatic === ((member.flags & 128) !== 0) && member.initializer) { properties.push(member); } } @@ -26736,11 +27160,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 188) { + if (member.kind === 189) { writeLine(); write(";"); } - else if (member.kind === 140 || node.kind === 139) { + else if (member.kind === 141 || node.kind === 140) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -26752,14 +27176,12 @@ var ts; emitMemberAccessForPropertyName(member.name); emitEnd(member.name); write(" = "); - emitStart(member); emitFunctionDeclaration(member); emitEnd(member); - emitEnd(member); write(";"); emitTrailingComments(member); } - else if (member.kind === 142 || member.kind === 143) { + else if (member.kind === 143 || member.kind === 144) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -26809,22 +27231,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 140 || node.kind === 139) && !member.body) { + if ((member.kind === 141 || node.kind === 140) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 140 || - member.kind === 142 || - member.kind === 143) { + else if (member.kind === 141 || + member.kind === 143 || + member.kind === 144) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 128) { write("static "); } - if (member.kind === 142) { + if (member.kind === 143) { write("get "); } - else if (member.kind === 143) { + else if (member.kind === 144) { write("set "); } if (member.asteriskToken) { @@ -26835,7 +27257,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 188) { + else if (member.kind === 189) { writeLine(); write(";"); } @@ -26856,10 +27278,10 @@ var ts; function emitConstructorWorker(node, baseTypeElement) { var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { - if (member.kind === 141 && !member.body) { + if (member.kind === 142 && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - if (member.kind === 138 && member.initializer && (member.flags & 128) === 0) { + if (member.kind === 139 && member.initializer && (member.flags & 128) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -26890,18 +27312,21 @@ var ts; } } } + var startIndex = 0; write(" {"); scopeEmitStart(node, "constructor"); increaseIndent(); if (ctor) { + startIndex = emitDirectivePrologues(ctor.body.statements, true); emitDetachedComments(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); + var superCall; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -26928,7 +27353,7 @@ var ts; if (superCall) { statements = statements.slice(1); } - emitLines(statements); + emitLinesStartingAt(statements, startIndex); } emitTempDeclarations(true); writeLine(); @@ -26936,7 +27361,7 @@ var ts; emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(15, ctor ? ctor.body.statements.end : node.members.end); + emitToken(16, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -26959,7 +27384,7 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 211) { + if (node.kind === 212) { if (thisNodeIsDecorated) { if (isES6ExportedDeclaration(node) && !(node.flags & 1024)) { write("export "); @@ -26976,7 +27401,7 @@ var ts; } } var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 183; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0); @@ -27003,7 +27428,7 @@ var ts; emitMemberFunctionsForES6AndHigher(node); decreaseIndent(); writeLine(); - emitToken(15, node.members.end); + emitToken(16, node.members.end); scopeEmitEnd(); if (thisNodeIsDecorated) { write(";"); @@ -27043,7 +27468,7 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 211) { + if (node.kind === 212) { if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); } @@ -27081,7 +27506,7 @@ var ts; writeLine(); emitDecoratorsOfClass(node); writeLine(); - emitToken(15, node.members.end, function () { + emitToken(16, node.members.end, function () { write("return "); emitDeclarationName(node); }); @@ -27093,7 +27518,7 @@ var ts; computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; decreaseIndent(); writeLine(); - emitToken(15, node.members.end); + emitToken(16, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -27101,11 +27526,11 @@ var ts; emit(baseTypeNode.expression); } write(")"); - if (node.kind === 211) { + if (node.kind === 212) { write(";"); } emitEnd(node); - if (node.kind === 211) { + if (node.kind === 212) { emitExportMemberAssignment(node); } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { @@ -27179,13 +27604,13 @@ var ts; } else { decorators = member.decorators; - if (member.kind === 140) { + if (member.kind === 141) { functionLikeMember = member; } } writeLine(); emitStart(member); - if (member.kind !== 138) { + if (member.kind !== 139) { write("Object.defineProperty("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -27215,7 +27640,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - if (member.kind !== 138) { + if (member.kind !== 139) { write(", Object.getOwnPropertyDescriptor("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -27254,45 +27679,45 @@ var ts; } function shouldEmitTypeMetadata(node) { switch (node.kind) { - case 140: - case 142: + case 141: case 143: - case 138: + case 144: + case 139: return true; } return false; } function shouldEmitReturnTypeMetadata(node) { switch (node.kind) { - case 140: + case 141: return true; } return false; } function shouldEmitParamTypesMetadata(node) { switch (node.kind) { - case 211: - case 140: - case 143: + case 212: + case 141: + case 144: return true; } return false; } function emitSerializedTypeOfNode(node) { switch (node.kind) { - case 211: + case 212: write("Function"); return; - case 138: + case 139: emitSerializedTypeNode(node.type); return; - case 135: + case 136: emitSerializedTypeNode(node.type); return; - case 142: + case 143: emitSerializedTypeNode(node.type); return; - case 143: + case 144: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -27303,43 +27728,46 @@ var ts; write("void 0"); } function emitSerializedTypeNode(node) { + if (!node) { + return; + } switch (node.kind) { - case 100: + case 101: write("void 0"); return; - case 157: + case 158: emitSerializedTypeNode(node.type); return; - case 149: case 150: + case 151: write("Function"); return; - case 153: case 154: + case 155: write("Array"); return; - case 147: - case 117: + case 148: + case 118: write("Boolean"); return; - case 127: - case 8: + case 128: + case 9: write("String"); return; - case 125: + case 126: write("Number"); return; - case 128: + case 129: write("Symbol"); return; - case 148: + case 149: emitSerializedTypeReferenceNode(node); return; - case 151: case 152: - case 155: + case 153: case 156: - case 114: + case 157: + case 115: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -27348,8 +27776,13 @@ var ts; write("Object"); } function emitSerializedTypeReferenceNode(node) { - var typeName = node.typeName; - var result = resolver.getTypeReferenceSerializationKind(node); + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); switch (result) { case ts.TypeReferenceSerializationKind.Unknown: var temp = createAndRecordTempVariable(0); @@ -27398,7 +27831,7 @@ var ts; function emitSerializedParameterTypesOfNode(node) { if (node) { var valueDeclaration; - if (node.kind === 211) { + if (node.kind === 212) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -27414,10 +27847,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 153) { + if (parameterType.kind === 154) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 148 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 149 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -27434,7 +27867,7 @@ var ts; } } function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node)) { + if (node && ts.isFunctionLike(node) && node.type) { emitSerializedTypeNode(node.type); return; } @@ -27511,7 +27944,7 @@ var ts; emitLines(node.members); decreaseIndent(); writeLine(); - emitToken(15, node.members.end); + emitToken(16, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -27570,7 +28003,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 215) { + if (moduleDeclaration.body.kind === 216) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -27605,7 +28038,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 216) { + if (node.body.kind === 217) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -27624,7 +28057,7 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(15, moduleBlock.statements.end); + emitToken(16, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); @@ -27637,7 +28070,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 66 && node.parent === currentSourceFile) { + if (!isES6ExportedDeclaration(node) && node.name.kind === 67 && node.parent === currentSourceFile) { if (compilerOptions.module === 4 && (node.flags & 1)) { writeLine(); write(exportFunctionForFile + "(\""); @@ -27649,29 +28082,41 @@ var ts; emitExportMemberAssignments(node.name); } } + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } function emitRequire(moduleName) { - if (moduleName.kind === 8) { + if (moduleName.kind === 9) { write("require("); - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - emitToken(17, moduleName.end); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18, moduleName.end); } else { write("require()"); } } function getNamespaceDeclarationNode(node) { - if (node.kind === 218) { + if (node.kind === 219) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 221) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 219 && node.importClause && !!node.importClause.name; + return node.kind === 220 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -27698,7 +28143,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 221) { + if (node.importClause.namedBindings.kind === 222) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -27724,7 +28169,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 218 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 219 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -27736,7 +28181,7 @@ var ts; write(" = "); } else { - var isNakedImport = 219 && !node.importClause; + var isNakedImport = 220 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -27782,16 +28227,29 @@ var ts; (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); + var variableDeclarationIsHoisted = shouldHoistVariable(node, true); + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1)) { + write("var "); + } } - else if (!(node.flags & 1)) { - write("var "); + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); } emitModuleMemberName(node); write(" = "); emit(node.moduleReference); + if (isExported) { + write(")"); + } write(";"); emitEnd(node); emitExportImportAssignments(node); @@ -27819,11 +28277,11 @@ var ts; emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); write(" = "); write(generatedName); write("."); - emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); } @@ -27845,7 +28303,6 @@ var ts; } else { if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - emitStart(node); write("export "); if (node.exportClause) { write("{ "); @@ -27857,10 +28314,9 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - emitNodeWithoutSourceMap(node.moduleSpecifier); + emit(node.moduleSpecifier); } write(";"); - emitEnd(node); } } } @@ -27873,13 +28329,11 @@ var ts; if (needsComma) { write(", "); } - emitStart(specifier); if (specifier.propertyName) { - emitNodeWithoutSourceMap(specifier.propertyName); + emit(specifier.propertyName); write(" as "); } - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier); + emit(specifier.name); needsComma = true; } } @@ -27892,8 +28346,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 210 && - expression.kind !== 211) { + if (expression.kind !== 211 && + expression.kind !== 212) { write(";"); } emitEnd(node); @@ -27907,6 +28361,7 @@ var ts; write(")"); } else { + emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0) { write("[\"default\"] = "); @@ -27929,18 +28384,18 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 219: + case 220: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 218: - if (node.moduleReference.kind === 229 && resolver.isReferencedAliasDeclaration(node)) { + case 219: + if (node.moduleReference.kind === 230 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 225: + case 226: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -27958,7 +28413,7 @@ var ts; } } break; - case 224: + case 225: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -27983,17 +28438,17 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); } - if (node.kind === 219 && node.importClause) { + if (node.kind === 220 && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 225 && node.moduleSpecifier) { + if (node.kind === 226 && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } function getExternalModuleNameText(importNode) { var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 8) { - return getLiteralText(moduleName); + if (moduleName.kind === 9) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); } return undefined; } @@ -28005,8 +28460,8 @@ var ts; var started = false; for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; - var skipNode = importNode.kind === 225 || - (importNode.kind === 219 && !importNode.importClause); + var skipNode = importNode.kind === 226 || + (importNode.kind === 220 && !importNode.importClause); if (skipNode) { continue; } @@ -28031,7 +28486,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0; _a < externalImports.length; _a++) { var externalImport = externalImports[_a]; - if (externalImport.kind === 225 && externalImport.exportClause) { + if (externalImport.kind === 226 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -28060,7 +28515,7 @@ var ts; } for (var _d = 0; _d < externalImports.length; _d++) { var externalImport = externalImports[_d]; - if (externalImport.kind !== 225) { + if (externalImport.kind !== 226) { continue; } var exportDecl = externalImport; @@ -28082,6 +28537,8 @@ var ts; write("function " + exportStarFunction + "(m) {"); increaseIndent(); writeLine(); + write("var exports = {};"); + writeLine(); write("for(var n in m) {"); increaseIndent(); writeLine(); @@ -28089,17 +28546,19 @@ var ts; if (localNames) { write("&& !" + localNames + ".hasOwnProperty(n)"); } - write(") " + exportFunctionForFile + "(n, m[n]);"); + write(") exports[n] = m[n];"); decreaseIndent(); writeLine(); write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); decreaseIndent(); writeLine(); write("}"); return exportStarFunction; } function writeExportedName(node) { - if (node.kind !== 66 && node.flags & 1024) { + if (node.kind !== 67 && node.flags & 1024) { return; } if (started) { @@ -28110,8 +28569,8 @@ var ts; } writeLine(); write("'"); - if (node.kind === 66) { - emitNodeWithoutSourceMap(node); + if (node.kind === 67) { + emitNodeWithCommentsAndWithoutSourcemap(node); } else { emitDeclarationName(node); @@ -28130,7 +28589,7 @@ var ts; var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; - var name_26 = local.kind === 66 + var name_26 = local.kind === 67 ? local : local.name; if (name_26) { @@ -28145,13 +28604,13 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 211 || local.kind === 215 || local.kind === 214) { + if (local.kind === 212 || local.kind === 216 || local.kind === 215) { emitDeclarationName(local); } else { emit(local); } - var flags = ts.getCombinedNodeFlags(local.kind === 66 ? local.parent : local); + var flags = ts.getCombinedNodeFlags(local.kind === 67 ? local.parent : local); if (flags & 1) { if (!exportedDeclarations) { exportedDeclarations = []; @@ -28179,21 +28638,21 @@ var ts; if (node.flags & 2) { return; } - if (node.kind === 210) { + if (node.kind === 211) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 211) { + if (node.kind === 212) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 214) { + if (node.kind === 215) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -28202,7 +28661,7 @@ var ts; } return; } - if (node.kind === 215) { + if (node.kind === 216) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -28211,10 +28670,10 @@ var ts; } return; } - if (node.kind === 208 || node.kind === 160) { + if (node.kind === 209 || node.kind === 161) { if (shouldHoistVariable(node, false)) { var name_27 = node.name; - if (name_27.kind === 66) { + if (name_27.kind === 67) { if (!hoistedVars) { hoistedVars = []; } @@ -28226,6 +28685,13 @@ var ts; } return; } + if (ts.isInternalModuleImportEqualsDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } if (ts.isBindingPattern(node)) { ts.forEach(node.elements, visit); return; @@ -28240,12 +28706,12 @@ var ts; return false; } return (ts.getCombinedNodeFlags(node) & 49152) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 245; + ts.getEnclosingBlockScopeContainer(node).kind === 246; } function isCurrentFileSystemExternalModule() { return compilerOptions.module === 4 && ts.isExternalModule(currentSourceFile); } - function emitSystemModuleBody(node, startIndex) { + function emitSystemModuleBody(node, dependencyGroups, startIndex) { emitVariableDeclarationsForImports(); writeLine(); var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); @@ -28254,7 +28720,7 @@ var ts; write("return {"); increaseIndent(); writeLine(); - emitSetters(exportStarFunction); + emitSetters(exportStarFunction, dependencyGroups); writeLine(); emitExecute(node, startIndex); decreaseIndent(); @@ -28262,75 +28728,64 @@ var ts; write("}"); emitTempDeclarations(true); } - function emitSetters(exportStarFunction) { + function emitSetters(exportStarFunction, dependencyGroups) { write("setters:["); - for (var i = 0; i < externalImports.length; ++i) { + for (var i = 0; i < dependencyGroups.length; ++i) { if (i !== 0) { write(","); } writeLine(); increaseIndent(); - var importNode = externalImports[i]; - var importVariableName = getLocalNameForExternalImport(importNode) || ""; - var parameterName = "_" + importVariableName; + var group = dependencyGroups[i]; + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); write("function (" + parameterName + ") {"); - switch (importNode.kind) { - case 219: - if (!importNode.importClause) { - break; - } - case 218: - ts.Debug.assert(importVariableName !== ""); - increaseIndent(); - writeLine(); - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - var defaultName = importNode.kind === 219 - ? importNode.importClause.name - : importNode.name; - if (defaultName) { - emitExportMemberAssignments(defaultName); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 220: + if (!entry.importClause) { + break; + } + case 219: + ts.Debug.assert(importVariableName !== ""); writeLine(); - } - if (importNode.kind === 219 && - importNode.importClause.namedBindings) { - var namedBindings = importNode.importClause.namedBindings; - if (namedBindings.kind === 221) { - emitExportMemberAssignments(namedBindings.name); + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 226: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { writeLine(); - } - else { - for (var _a = 0, _b = namedBindings.elements; _a < _b.length; _a++) { - var element = _b[_a]; - emitExportMemberAssignments(element.name || element.propertyName); - writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); } + decreaseIndent(); + writeLine(); + write("});"); } - } - decreaseIndent(); - break; - case 225: - ts.Debug.assert(importVariableName !== ""); - increaseIndent(); - if (importNode.exportClause) { - for (var _c = 0, _d = importNode.exportClause.elements; _c < _d.length; _c++) { - var e = _d[_c]; + else { writeLine(); - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(e.name); - write("\", " + parameterName + "[\""); - emitNodeWithoutSourceMap(e.propertyName || e.name); - write("\"]);"); + write(exportStarFunction + "(" + parameterName + ");"); } - } - else { writeLine(); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - decreaseIndent(); - break; + break; + } } + decreaseIndent(); write("}"); decreaseIndent(); } @@ -28343,14 +28798,25 @@ var ts; for (var i = startIndex; i < node.statements.length; ++i) { var statement = node.statements[i]; switch (statement.kind) { - case 225: - case 219: - case 218: - case 210: + case 211: + case 220: continue; + case 226: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportSpecifierInSystemModule(element); + } + } + continue; + case 219: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + continue; + } + default: + writeLine(); + emit(statement); } - writeLine(); - emit(statement); } decreaseIndent(); writeLine(); @@ -28366,8 +28832,19 @@ var ts; write("\"" + node.moduleName + "\", "); } write("["); + var groupIndices = {}; + var dependencyGroups = []; for (var i = 0; i < externalImports.length; ++i) { var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } if (i !== 0) { write(", "); } @@ -28376,8 +28853,9 @@ var ts; write("], function(" + exportFunctionForFile + ") {"); writeLine(); increaseIndent(); + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, startIndex); + emitSystemModuleBody(node, dependencyGroups, startIndex); decreaseIndent(); writeLine(); write("});"); @@ -28435,6 +28913,7 @@ var ts; } } function emitAMDModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); @@ -28454,6 +28933,7 @@ var ts; write("});"); } function emitCommonJSModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); @@ -28462,6 +28942,7 @@ var ts; emitExportEquals(false); } function emitUMDModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); emitAMDDependencies(node, false); @@ -28481,6 +28962,7 @@ var ts; exportSpecifiers = undefined; exportEquals = undefined; hasExportStars = false; + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); emitTempDeclarations(true); @@ -28506,7 +28988,7 @@ var ts; break; } } - function trimReactWhitespace(node) { + function trimReactWhitespaceAndApplyEntities(node) { var result = undefined; var text = ts.getTextOfNode(node); var firstNonWhitespace = 0; @@ -28516,7 +28998,7 @@ var ts; if (ts.isLineBreak(c)) { if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + '" + \' \' + "' : '') + part; + result = (result ? result + "\" + ' ' + \"" : "") + part; } firstNonWhitespace = -1; } @@ -28529,15 +29011,25 @@ var ts; } if (firstNonWhitespace !== -1) { var part = text.substr(firstNonWhitespace); - result = (result ? result + '" + \' \' + "' : '') + part; + result = (result ? result + "\" + ' ' + \"" : "") + part; + } + if (result) { + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); } return result; } function getTextToEmit(node) { switch (compilerOptions.jsx) { case 2: - var text = trimReactWhitespace(node); - if (text.length === 0) { + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { return undefined; } else { @@ -28551,13 +29043,13 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2: - write('"'); - write(trimReactWhitespace(node)); - write('"'); + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); break; case 1: default: - write(ts.getTextOfNode(node, true)); + writer.writeLiteral(ts.getTextOfNode(node, true)); break; } } @@ -28566,9 +29058,9 @@ var ts; switch (compilerOptions.jsx) { case 1: default: - write('{'); + write("{"); emit(node.expression); - write('}'); + write("}"); break; case 2: emit(node.expression); @@ -28600,10 +29092,7 @@ var ts; } } } - function emitSourceFileNode(node) { - writeLine(); - emitDetachedComments(node); - var startIndex = emitDirectivePrologues(node.statements, false); + function emitEmitHelpers(node) { if (!compilerOptions.noEmitHelpers) { if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { writeLines(extendsHelper); @@ -28625,6 +29114,12 @@ var ts; awaiterEmitted = true; } } + } + function emitSourceFileNode(node) { + writeLine(); + emitShebang(); + emitDetachedComments(node); + var startIndex = emitDirectivePrologues(node.statements, false); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { if (languageVersion >= 2) { emitES6Module(node, startIndex); @@ -28647,47 +29142,63 @@ var ts; exportSpecifiers = undefined; exportEquals = undefined; hasExportStars = false; + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); emitTempDeclarations(true); } emitLeadingComments(node.endOfFileToken); } - function emitNodeWithoutSourceMap(node) { - if (!node) { - return; - } - if (node.flags & 2) { - return emitOnlyPinnedOrTripleSlashComments(node); + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2) { + return emitOnlyPinnedOrTripleSlashComments(node); + } + if (isSpecializedCommentHandling(node)) { + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } } - var emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { - emitLeadingComments(node); + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); } - emitJavaScriptWorker(node); - if (emitComments) { - emitTrailingComments(node); + } + function isSpecializedCommentHandling(node) { + switch (node.kind) { + case 213: + case 211: + case 220: + case 219: + case 214: + case 225: + return true; } } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 212: - case 210: - case 219: - case 218: - case 213: - case 224: - return false; - case 190: + case 191: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 215: + case 216: return shouldEmitModuleDeclaration(node); - case 214: + case 215: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 189 && + ts.Debug.assert(!isSpecializedCommentHandling(node)); + if (node.kind !== 190 && node.parent && - node.parent.kind === 171 && + node.parent.kind === 172 && node.parent.body === node && compilerOptions.target <= 1) { return false; @@ -28696,170 +29207,170 @@ var ts; } function emitJavaScriptWorker(node) { switch (node.kind) { - case 66: + case 67: return emitIdentifier(node); - case 135: + case 136: return emitParameter(node); + case 141: case 140: - case 139: return emitMethod(node); - case 142: case 143: + case 144: return emitAccessor(node); - case 94: + case 95: return emitThis(node); - case 92: + case 93: return emitSuper(node); - case 90: + case 91: return write("null"); - case 96: + case 97: return write("true"); - case 81: + case 82: return write("false"); - case 7: case 8: case 9: case 10: case 11: case 12: case 13: + case 14: return emitLiteral(node); - case 180: + case 181: return emitTemplateExpression(node); - case 187: + case 188: return emitTemplateSpan(node); - case 230: case 231: + case 232: return emitJsxElement(node); - case 233: + case 234: return emitJsxText(node); - case 237: + case 238: return emitJsxExpression(node); - case 132: + case 133: return emitQualifiedName(node); - case 158: - return emitObjectBindingPattern(node); case 159: - return emitArrayBindingPattern(node); + return emitObjectBindingPattern(node); case 160: - return emitBindingElement(node); + return emitArrayBindingPattern(node); case 161: - return emitArrayLiteral(node); + return emitBindingElement(node); case 162: + return emitArrayLiteral(node); + case 163: return emitObjectLiteral(node); - case 242: - return emitPropertyAssignment(node); case 243: + return emitPropertyAssignment(node); + case 244: return emitShorthandPropertyAssignment(node); - case 133: + case 134: return emitComputedPropertyName(node); - case 163: - return emitPropertyAccess(node); case 164: - return emitIndexedAccess(node); + return emitPropertyAccess(node); case 165: - return emitCallExpression(node); + return emitIndexedAccess(node); case 166: - return emitNewExpression(node); + return emitCallExpression(node); case 167: - return emitTaggedTemplateExpression(node); + return emitNewExpression(node); case 168: + return emitTaggedTemplateExpression(node); + case 169: return emit(node.expression); - case 186: + case 187: return emit(node.expression); - case 169: - return emitParenExpression(node); - case 210: case 170: + return emitParenExpression(node); + case 211: case 171: - return emitFunctionDeclaration(node); case 172: - return emitDeleteExpression(node); + return emitFunctionDeclaration(node); case 173: - return emitTypeOfExpression(node); + return emitDeleteExpression(node); case 174: - return emitVoidExpression(node); + return emitTypeOfExpression(node); case 175: - return emitAwaitExpression(node); + return emitVoidExpression(node); case 176: - return emitPrefixUnaryExpression(node); + return emitAwaitExpression(node); case 177: - return emitPostfixUnaryExpression(node); + return emitPrefixUnaryExpression(node); case 178: - return emitBinaryExpression(node); + return emitPostfixUnaryExpression(node); case 179: + return emitBinaryExpression(node); + case 180: return emitConditionalExpression(node); - case 182: + case 183: return emitSpreadElementExpression(node); - case 181: + case 182: return emitYieldExpression(node); - case 184: + case 185: return; - case 189: - case 216: - return emitBlock(node); case 190: - return emitVariableStatement(node); + case 217: + return emitBlock(node); case 191: - return write(";"); + return emitVariableStatement(node); case 192: - return emitExpressionStatement(node); + return write(";"); case 193: - return emitIfStatement(node); + return emitExpressionStatement(node); case 194: - return emitDoStatement(node); + return emitIfStatement(node); case 195: - return emitWhileStatement(node); + return emitDoStatement(node); case 196: + return emitWhileStatement(node); + case 197: return emitForStatement(node); + case 199: case 198: - case 197: return emitForInOrForOfStatement(node); - case 199: case 200: - return emitBreakOrContinueStatement(node); case 201: - return emitReturnStatement(node); + return emitBreakOrContinueStatement(node); case 202: - return emitWithStatement(node); + return emitReturnStatement(node); case 203: + return emitWithStatement(node); + case 204: return emitSwitchStatement(node); - case 238: case 239: + case 240: return emitCaseOrDefaultClause(node); - case 204: - return emitLabelledStatement(node); case 205: - return emitThrowStatement(node); + return emitLabelledStatement(node); case 206: + return emitThrowStatement(node); + case 207: return emitTryStatement(node); - case 241: + case 242: return emitCatchClause(node); - case 207: - return emitDebuggerStatement(node); case 208: + return emitDebuggerStatement(node); + case 209: return emitVariableDeclaration(node); - case 183: + case 184: return emitClassExpression(node); - case 211: - return emitClassDeclaration(node); case 212: + return emitClassDeclaration(node); + case 213: return emitInterfaceDeclaration(node); - case 214: + case 215: return emitEnumDeclaration(node); - case 244: + case 245: return emitEnumMember(node); - case 215: + case 216: return emitModuleDeclaration(node); - case 219: + case 220: return emitImportDeclaration(node); - case 218: + case 219: return emitImportEqualsDeclaration(node); - case 225: + case 226: return emitExportDeclaration(node); - case 224: + case 225: return emitExportAssignment(node); - case 245: + case 246: return emitSourceFileNode(node); } } @@ -28887,7 +29398,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 245 || node.pos !== node.parent.pos) { + if (node.parent.kind === 246 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -28899,7 +29410,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 245 || node.end !== node.parent.end) { + if (node.parent.kind === 246 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -28919,6 +29430,10 @@ var ts; var trailingComments = filterComments(getTrailingCommentsToEmit(node), compilerOptions.removeComments); ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } + function emitTrailingCommentsOfPosition(pos) { + var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), compilerOptions.removeComments); + ts.emitComments(currentSourceFile, writer, trailingComments, true, newLine, writeComment); + } function emitLeadingCommentsOfPosition(pos) { var leadingComments; if (hasDetachedComments(pos)) { @@ -28964,6 +29479,12 @@ var ts; } } } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } function isPinnedOrTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; @@ -28984,6 +29505,261 @@ var ts; } } ts.emitFiles = emitFiles; + var entities = { + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }; })(ts || (ts = {})); /// /// @@ -28993,7 +29769,8 @@ var ts; ts.emitTime = 0; ts.ioReadTime = 0; ts.ioWriteTime = 0; - ts.version = "1.5.3"; + var emptyArray = []; + ts.version = "1.6.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -29010,6 +29787,49 @@ var ts; return undefined; } ts.findConfigFile = findConfigFile; + function resolveTripleslashReference(moduleName, containingFile) { + var basePath = ts.getDirectoryPath(containingFile); + var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName); + return ts.normalizePath(referencedFileName); + } + ts.resolveTripleslashReference = resolveTripleslashReference; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + return legacyNameResolver(moduleName, containingFile, compilerOptions, host); + } + ts.resolveModuleName = resolveModuleName; + function legacyNameResolver(moduleName, containingFile, compilerOptions, host) { + if (moduleName.indexOf('!') != -1) { + return { resolvedFileName: undefined, failedLookupLocations: [] }; + } + var searchPath = ts.getDirectoryPath(containingFile); + var searchName; + var failedLookupLocations = []; + var referencedSourceFile; + while (true) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + if (extension === ".tsx" && !compilerOptions.jsx) { + return undefined; + } + var candidate = searchName + extension; + if (host.fileExists(candidate)) { + return candidate; + } + else { + failedLookupLocations.push(candidate); + } + }); + if (referencedSourceFile) { + break; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations }; + } function createCompilerHost(options, setParentNodes) { var currentDirectory; var existingDirectories = {}; @@ -29072,7 +29892,9 @@ var ts; getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return newLine; } + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, + readFile: function (fileName) { return ts.sys.readFile(fileName); } }; } ts.createCompilerHost = createCompilerHost; @@ -29107,7 +29929,7 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; - function createProgram(rootNames, options, host) { + function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; var diagnostics = ts.createDiagnosticCollection(); @@ -29118,14 +29940,30 @@ var ts; var skipDefaultLib = options.noLib; var start = new Date().getTime(); host = host || createCompilerHost(options); + var resolveModuleNamesWorker = host.resolveModuleNames || + (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); }); var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); }); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); - if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (oldProgram) { + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx)) { + oldProgram = undefined; + } + } + if (!tryReuseStructureFromOldProgram()) { + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + if (!skipDefaultLib) { + processRootFile(host.getDefaultLibFileName(options), true); + } } verifyCompilerOptions(); + oldProgram = undefined; ts.programTime += new Date().getTime() - start; program = { + getRootFileNames: function () { return rootNames; }, getSourceFile: getSourceFile, getSourceFiles: function () { return files; }, getCompilerOptions: function () { return options; }, @@ -29157,6 +29995,58 @@ var ts; } return classifiableNames; } + function tryReuseStructureFromOldProgram() { + if (!oldProgram) { + return false; + } + ts.Debug.assert(!oldProgram.structureIsReused); + var oldRootNames = oldProgram.getRootFileNames(); + if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { + return false; + } + var newSourceFiles = []; + for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { + var oldSourceFile = _a[_i]; + var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + if (!newSourceFile) { + return false; + } + if (oldSourceFile !== newSourceFile) { + if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { + return false; + } + if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { + return false; + } + collectExternalModuleReferences(newSourceFile); + if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { + return false; + } + if (resolveModuleNamesWorker) { + var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); + for (var i = 0; i < moduleNames.length; ++i) { + var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]); + if (oldResolution !== resolutions[i]) { + return false; + } + } + } + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + } + else { + newSourceFile = oldSourceFile; + } + newSourceFiles.push(newSourceFile); + } + for (var _b = 0; _b < newSourceFiles.length; _b++) { + var file = newSourceFiles[_b]; + filesByName.set(file.fileName, file); + } + files = newSourceFiles; + oldProgram.structureIsReused = true; + return true; + } function getEmitHost(writeFileCallback) { return { getCanonicalFileName: function (fileName) { return host.getCanonicalFileName(fileName); }, @@ -29183,7 +30073,7 @@ var ts; if (options.noEmitOnError && getPreEmitDiagnostics(program, undefined, cancellationToken).length > 0) { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; @@ -29264,14 +30154,51 @@ var ts; function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib); } + function fileReferenceIsEqualTo(a, b) { + return a.fileName === b.fileName; + } + function moduleNameIsEqualTo(a, b) { + return a.text === b.text; + } + function collectExternalModuleReferences(file) { + if (file.imports) { + return; + } + var imports; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 220: + case 219: + case 226: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + break; + } + if (!moduleNameExpr.text) { + break; + } + (imports || (imports = [])).push(moduleNameExpr); + break; + case 216: + if (node.name.kind === 9 && (node.flags & 2 || ts.isDeclarationFile(file))) { + ts.forEachChild(node.body, function (node) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && + ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9) { + var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); + if (moduleName) { + (imports || (imports = [])).push(moduleName); + } + } + }); + } + break; + } + } + file.imports = imports || emptyArray; + } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var start; - var length; var diagnosticArgument; - if (refEnd !== undefined && refPos !== undefined) { - start = refPos; - length = refEnd - refPos; - } var diagnostic; if (hasExtension(fileName)) { if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { @@ -29302,15 +30229,15 @@ var ts; } } if (diagnostic) { - if (refFile) { - diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); + if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); } } } - function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { + function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (filesByName.contains(canonicalName)) { return getSourceFileFromCache(fileName, canonicalName, false); @@ -29322,8 +30249,8 @@ var ts; return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); } var file = 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)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, 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)); @@ -29333,11 +30260,11 @@ var ts; if (file) { skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; filesByName.set(canonicalAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - var basePath = ts.getDirectoryPath(fileName); processReferencedFiles(file, basePath); - processImportedModules(file, basePath); } + processImportedModules(file, basePath); if (isDefaultLib) { file.isDefaultLib = true; files.unshift(file); @@ -29353,7 +30280,12 @@ var ts; 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)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } + else { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } } } return file; @@ -29361,49 +30293,30 @@ var ts; } 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); + var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); + processSourceFile(referencedFileName, false, file, ref.pos, ref.end); }); } function processImportedModules(file, basePath) { - ts.forEach(file.statements, function (node) { - if (node.kind === 219 || node.kind === 218 || node.kind === 225) { - var moduleNameExpr = ts.getExternalModuleName(node); - if (moduleNameExpr && moduleNameExpr.kind === 8) { - var moduleNameText = moduleNameExpr.text; - if (moduleNameText) { - var searchPath = basePath; - var searchName; - while (true) { - searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { - break; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } - } + collectExternalModuleReferences(file); + if (file.imports.length) { + file.resolvedModules = {}; + var moduleNames = ts.map(file.imports, function (name) { return name.text; }); + var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); + for (var i = 0; i < file.imports.length; ++i) { + var resolution = resolutions[i]; + ts.setResolvedModuleName(file, moduleNames[i], resolution); + if (resolution && !options.noResolve) { + findModuleSourceFile(resolution, file.imports[i]); } } - else if (node.kind === 215 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { - ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { - var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); - var moduleName = nameLiteral.text; - if (moduleName) { - var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); - } - } - }); - } - }); + } + else { + file.resolvedModules = undefined; + } + return; function findModuleSourceFile(fileName, nameLiteral) { - return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end); } } function computeCommonSourceDirectory(sourceFiles) { @@ -29455,28 +30368,28 @@ var ts; } function verifyCompilerOptions() { if (options.isolatedModules) { - if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_isolatedModules)); - } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + } + if (options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { @@ -29484,16 +30397,20 @@ var ts; diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } + if (options.out && options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + } 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)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } var languageVersion = options.target || 0; + var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { if (!options.module && languageVersion < 2) { @@ -29515,7 +30432,7 @@ var ts; if (options.outDir || options.sourceRoot || (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + (!outFile || firstExternalModuleSourceFile !== undefined))) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); } @@ -29527,16 +30444,22 @@ var ts; } } 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.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + } + if (options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + } + if (options.outDir) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== 2) { @@ -29587,128 +30510,128 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 194) { + if (node.parent.kind === 195) { return spanInPreviousNode(node); } - if (node.parent.kind === 196) { + if (node.parent.kind === 197) { return textSpan(node); } - if (node.parent.kind === 178 && node.parent.operatorToken.kind === 23) { + if (node.parent.kind === 179 && node.parent.operatorToken.kind === 24) { return textSpan(node); } - if (node.parent.kind === 171 && node.parent.body === node) { + if (node.parent.kind === 172 && node.parent.body === node) { return textSpan(node); } } switch (node.kind) { - case 190: + case 191: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 208: + case 209: + case 139: case 138: - case 137: return spanInVariableDeclaration(node); - case 135: + case 136: return spanInParameterDeclaration(node); - case 210: + case 211: + case 141: case 140: - case 139: - case 142: case 143: - case 141: - case 170: + case 144: + case 142: case 171: + case 172: return spanInFunctionDeclaration(node); - case 189: + case 190: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 216: + case 217: return spanInBlock(node); - case 241: + case 242: return spanInBlock(node.block); - case 192: + case 193: return textSpan(node.expression); - case 201: + case 202: return textSpan(node.getChildAt(0), node.expression); - case 195: + case 196: return textSpan(node, ts.findNextToken(node.expression, node)); - case 194: + case 195: return spanInNode(node.statement); - case 207: + case 208: return textSpan(node.getChildAt(0)); - case 193: + case 194: return textSpan(node, ts.findNextToken(node.expression, node)); - case 204: + case 205: return spanInNode(node.statement); + case 201: case 200: - case 199: return textSpan(node.getChildAt(0), node.label); - case 196: - return spanInForStatement(node); case 197: + return spanInForStatement(node); case 198: + case 199: return textSpan(node, ts.findNextToken(node.expression, node)); - case 203: + case 204: return textSpan(node, ts.findNextToken(node.expression, node)); - case 238: case 239: + case 240: return spanInNode(node.statements[0]); - case 206: + case 207: return spanInBlock(node.tryBlock); - case 205: + case 206: return textSpan(node, node.expression); - case 224: + case 225: return textSpan(node, node.expression); - case 218: - return textSpan(node, node.moduleReference); case 219: + return textSpan(node, node.moduleReference); + case 220: return textSpan(node, node.moduleSpecifier); - case 225: + case 226: return textSpan(node, node.moduleSpecifier); - case 215: + case 216: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 211: - case 214: - case 244: - case 165: + case 212: + case 215: + case 245: case 166: + case 167: return textSpan(node); - case 202: + case 203: return spanInNode(node.statement); - case 212: case 213: + case 214: return undefined; - case 22: + case 23: case 1: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); - case 23: + case 24: return spanInPreviousNode(node); - case 14: - return spanInOpenBraceToken(node); case 15: - return spanInCloseBraceToken(node); + return spanInOpenBraceToken(node); case 16: - return spanInOpenParenToken(node); + return spanInCloseBraceToken(node); case 17: + return spanInOpenParenToken(node); + case 18: return spanInCloseParenToken(node); - case 52: + case 53: return spanInColonToken(node); - case 26: - case 24: + case 27: + case 25: return spanInGreaterThanOrLessThanToken(node); - case 101: + case 102: return spanInWhileKeyword(node); - case 77: - case 69: - case 82: + case 78: + case 70: + case 83: return spanInNextNode(node); default: - if (node.parent.kind === 242 && node.parent.name === node) { + if (node.parent.kind === 243 && node.parent.name === node) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 168 && node.parent.type === node) { + if (node.parent.kind === 169 && node.parent.type === node) { return spanInNode(node.parent.expression); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { @@ -29718,12 +30641,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 197 || - variableDeclaration.parent.parent.kind === 198) { + if (variableDeclaration.parent.parent.kind === 198 || + variableDeclaration.parent.parent.kind === 199) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 190; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 196 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 191; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 197 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -29769,7 +30692,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 211 && functionDeclaration.kind !== 141); + (functionDeclaration.parent.kind === 212 && functionDeclaration.kind !== 142); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -29789,23 +30712,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 215: + case 216: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 195: - case 193: - case 197: + case 196: + case 194: case 198: + case 199: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 196: + case 197: 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 === 209) { + if (forStatement.initializer.kind === 210) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -29824,34 +30747,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 214: + case 215: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 211: + case 212: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 217: + case 218: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 216: + case 217: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 214: - case 211: + case 215: + case 212: return textSpan(node); - case 189: + case 190: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 241: + case 242: return spanInNode(ts.lastOrUndefined(node.parent.statements)); ; - case 217: + case 218: var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); if (lastClause) { @@ -29863,24 +30786,24 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 194) { + if (node.parent.kind === 195) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 170: - case 210: case 171: + case 211: + case 172: + case 141: case 140: - case 139: - case 142: case 143: - case 141: - case 195: - case 194: + case 144: + case 142: case 196: + case 195: + case 197: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -29888,19 +30811,19 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 242) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 243) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 168) { + if (node.parent.kind === 169) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 194) { + if (node.parent.kind === 195) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -29978,7 +30901,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 171; + return ts.isFunctionBlock(node) && node.parent.kind !== 172; } var depth = 0; var maxDepth = 20; @@ -29990,30 +30913,30 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 189: + case 190: if (!ts.isFunctionBlock(n)) { - var parent_8 = n.parent; - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent_8.kind === 194 || - parent_8.kind === 197 || - parent_8.kind === 198 || - parent_8.kind === 196 || - parent_8.kind === 193 || - parent_8.kind === 195 || - parent_8.kind === 202 || - parent_8.kind === 241) { - addOutliningSpan(parent_8, openBrace, closeBrace, autoCollapse(n)); + var parent_7 = n.parent; + var openBrace = ts.findChildOfKind(n, 15, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16, sourceFile); + if (parent_7.kind === 195 || + parent_7.kind === 198 || + parent_7.kind === 199 || + parent_7.kind === 197 || + parent_7.kind === 194 || + parent_7.kind === 196 || + parent_7.kind === 203 || + parent_7.kind === 242) { + addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_8.kind === 206) { - var tryStatement = parent_8; + if (parent_7.kind === 207) { + var tryStatement = parent_7; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_8, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 82, sourceFile); + var finallyKeyword = ts.findChildOfKind(tryStatement, 83, sourceFile); if (finallyKeyword) { addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); break; @@ -30029,25 +30952,25 @@ var ts; }); break; } - case 216: { - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); + case 217: { + var openBrace = ts.findChildOfKind(n, 15, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 211: case 212: - case 214: - case 162: - case 217: { - var openBrace = ts.findChildOfKind(n, 14, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15, sourceFile); + case 213: + case 215: + case 163: + case 218: { + var openBrace = ts.findChildOfKind(n, 15, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 161: - var openBracket = ts.findChildOfKind(n, 18, sourceFile); - var closeBracket = ts.findChildOfKind(n, 19, sourceFile); + case 162: + var openBracket = ts.findChildOfKind(n, 19, sourceFile); + var closeBracket = ts.findChildOfKind(n, 20, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); break; } @@ -30115,9 +31038,9 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 66 || - node.kind === 8 || - node.kind === 7) { + if (node.kind === 67 || + node.kind === 9 || + node.kind === 8) { return node.text; } } @@ -30129,7 +31052,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 133) { + else if (declaration.name.kind === 134) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -30146,7 +31069,7 @@ var ts; } return true; } - if (expression.kind === 163) { + if (expression.kind === 164) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -30157,7 +31080,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 133) { + if (declaration.name.kind === 134) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -30221,14 +31144,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 215: + case 216: do { current = current.parent; - } while (current.kind === 215); - case 211: - case 214: + } while (current.kind === 216); case 212: - case 210: + case 215: + case 213: + case 211: indent++; } current = current.parent; @@ -30239,26 +31162,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 190: + case 191: ts.forEach(node.declarationList.declarations, visit); break; - case 158: case 159: + case 160: ts.forEach(node.elements, visit); break; - case 225: + case 226: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 219: + case 220: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221) { + if (importClause.namedBindings.kind === 222) { childNodes.push(importClause.namedBindings); } else { @@ -30267,20 +31190,20 @@ var ts; } } break; - case 160: - case 208: + case 161: + case 209: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 211: - case 214: case 212: case 215: - case 210: - case 218: - case 223: - case 227: + case 213: + case 216: + case 211: + case 219: + case 224: + case 228: childNodes.push(node); break; } @@ -30315,17 +31238,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 211: - case 214: case 212: + case 215: + case 213: topLevelNodes.push(node); break; - case 215: + case 216: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 210: + case 211: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -30336,9 +31259,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 210) { - if (functionDeclaration.body && functionDeclaration.body.kind === 189) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 210 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 211) { + if (functionDeclaration.body && functionDeclaration.body.kind === 190) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 211 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -30391,7 +31314,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 135: + case 136: if (ts.isBindingPattern(node.name)) { break; } @@ -30399,34 +31322,34 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 141: case 140: - case 139: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 142: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); case 143: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 144: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 146: + case 147: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 244: + case 245: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 144: - return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); case 145: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 146: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + case 139: case 138: - case 137: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 210: + case 211: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 208: - case 160: + case 209: + case 161: var variableDeclarationNode; var name_29; - if (node.kind === 160) { + if (node.kind === 161) { name_29 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 208) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 209) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -30445,13 +31368,13 @@ var ts; else { return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.variableElement); } - case 141: + case 142: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 227: - case 223: - case 218: - case 220: + case 228: + case 224: + case 219: case 221: + case 222: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -30481,27 +31404,27 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 245: + case 246: return createSourceFileItem(node); - case 211: + case 212: return createClassItem(node); - case 214: + case 215: return createEnumItem(node); - case 212: + case 213: return createIterfaceItem(node); - case 215: + case 216: return createModuleItem(node); - case 210: + case 211: return createFunctionItem(node); } return undefined; function getModuleName(moduleDeclaration) { - if (moduleDeclaration.name.kind === 8) { + if (moduleDeclaration.name.kind === 9) { return getTextOfNode(moduleDeclaration.name); } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 215) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 216) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -30513,7 +31436,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 189) { + if (node.body && node.body.kind === 190) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -30534,7 +31457,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 141 && member; + return member.kind === 142 && member; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { @@ -30555,19 +31478,19 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 133; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 134; }); } function removeDynamicallyNamedProperties(node) { return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 215) { + while (node.body.kind === 216) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 245 + return node.kind === 246 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -31058,14 +31981,14 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 165) { + if (argumentInfo.invocation.kind !== 166) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; - var name = expression.kind === 66 + var name = expression.kind === 67 ? expression - : expression.kind === 163 + : expression.kind === 164 ? expression.name : undefined; if (!name || !name.text) { @@ -31094,10 +32017,10 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 165 || node.parent.kind === 166) { + if (node.parent.kind === 166 || node.parent.kind === 167) { var callExpression = node.parent; - if (node.kind === 24 || - node.kind === 16) { + if (node.kind === 25 || + node.kind === 17) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -31125,24 +32048,24 @@ var ts; }; } } - else if (node.kind === 10 && node.parent.kind === 167) { + else if (node.kind === 11 && node.parent.kind === 168) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 11 && node.parent.parent.kind === 167) { + else if (node.kind === 12 && node.parent.parent.kind === 168) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 180); + ts.Debug.assert(templateExpression.kind === 181); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 187 && node.parent.parent.parent.kind === 167) { + else if (node.parent.kind === 188 && node.parent.parent.parent.kind === 168) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 180); - if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { + ts.Debug.assert(templateExpression.kind === 181); + if (node.kind === 14 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); @@ -31159,7 +32082,7 @@ var ts; if (child === node) { break; } - if (child.kind !== 23) { + if (child.kind !== 24) { argumentIndex++; } } @@ -31167,8 +32090,8 @@ var ts; } function getArgumentCount(argumentsList) { var listChildren = argumentsList.getChildren(); - var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 23; }); - if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23) { + var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 24; }); + if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 24) { argumentCount++; } return argumentCount; @@ -31184,7 +32107,7 @@ var ts; return spanIndex + 1; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { - var argumentCount = tagExpression.template.kind === 10 + var argumentCount = tagExpression.template.kind === 11 ? 1 : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); @@ -31205,7 +32128,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 180) { + if (template.kind === 181) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -31214,7 +32137,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 245; n = n.parent) { + for (var n = node; n.kind !== 246; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -31264,10 +32187,10 @@ var ts; ts.addRange(prefixDisplayParts, callTargetDisplayParts); } if (isTypeParameterList) { - prefixDisplayParts.push(ts.punctuationPart(24)); + prefixDisplayParts.push(ts.punctuationPart(25)); var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; - suffixDisplayParts.push(ts.punctuationPart(26)); + suffixDisplayParts.push(ts.punctuationPart(27)); var parameterParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); }); @@ -31278,10 +32201,10 @@ var ts; return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); }); ts.addRange(prefixDisplayParts, typeParameterParts); - prefixDisplayParts.push(ts.punctuationPart(16)); + prefixDisplayParts.push(ts.punctuationPart(17)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; - suffixDisplayParts.push(ts.punctuationPart(17)); + suffixDisplayParts.push(ts.punctuationPart(18)); } var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); @@ -31291,7 +32214,7 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], + separatorDisplayParts: [ts.punctuationPart(24), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -31314,12 +32237,11 @@ var ts; var displayParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); }); - var isOptional = ts.hasQuestionToken(parameter.valueDeclaration); return { name: parameter.name, documentation: parameter.getDocumentationComment(), displayParts: displayParts, - isOptional: isOptional + isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration) }; } function createSignatureHelpParameterForTypeParameter(typeParameter) { @@ -31395,101 +32317,101 @@ var ts; return false; } switch (n.kind) { - case 211: case 212: - case 214: - case 162: - case 158: - case 152: - case 189: - case 216: + case 213: + case 215: + case 163: + case 159: + case 153: + case 190: case 217: - return nodeEndsWith(n, 15, sourceFile); - case 241: + case 218: + return nodeEndsWith(n, 16, sourceFile); + case 242: return isCompletedNode(n.block, sourceFile); - case 166: + case 167: if (!n.arguments) { return true; } - case 165: - case 169: - case 157: - return nodeEndsWith(n, 17, sourceFile); - case 149: + case 166: + case 170: + case 158: + return nodeEndsWith(n, 18, sourceFile); case 150: + case 151: return isCompletedNode(n.type, sourceFile); - case 141: case 142: case 143: - case 210: - case 170: - case 140: - case 139: - case 145: case 144: + case 211: case 171: + case 141: + case 140: + case 146: + case 145: + case 172: if (n.body) { return isCompletedNode(n.body, sourceFile); } if (n.type) { return isCompletedNode(n.type, sourceFile); } - return hasChildOfKind(n, 17, sourceFile); - case 215: + return hasChildOfKind(n, 18, sourceFile); + case 216: return n.body && isCompletedNode(n.body, sourceFile); - case 193: + case 194: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 192: + case 193: return isCompletedNode(n.expression, sourceFile); - case 161: - case 159: - case 164: - case 133: - case 154: - return nodeEndsWith(n, 19, sourceFile); - case 146: + case 162: + case 160: + case 165: + case 134: + case 155: + return nodeEndsWith(n, 20, sourceFile); + case 147: if (n.type) { return isCompletedNode(n.type, sourceFile); } - return hasChildOfKind(n, 19, sourceFile); - case 238: + return hasChildOfKind(n, 20, sourceFile); case 239: + case 240: return false; - case 196: case 197: case 198: - case 195: + case 199: + case 196: return isCompletedNode(n.statement, sourceFile); - case 194: - var hasWhileKeyword = findChildOfKind(n, 101, sourceFile); + case 195: + var hasWhileKeyword = findChildOfKind(n, 102, sourceFile); if (hasWhileKeyword) { - return nodeEndsWith(n, 17, sourceFile); + return nodeEndsWith(n, 18, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 151: + case 152: return isCompletedNode(n.exprName, sourceFile); - case 173: - case 172: case 174: - case 181: + case 173: + case 175: case 182: + case 183: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 167: + case 168: return isCompletedNode(n.template, sourceFile); - case 180: + case 181: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 187: + case 188: return ts.nodeIsPresent(n.literal); - case 176: + case 177: return isCompletedNode(n.operand, sourceFile); - case 178: - return isCompletedNode(n.right, sourceFile); case 179: + return isCompletedNode(n.right, sourceFile); + case 180: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -31503,7 +32425,7 @@ var ts; if (last.kind === expectedLastToken) { return true; } - else if (last.kind === 22 && children.length !== 1) { + else if (last.kind === 23 && children.length !== 1) { return children[children.length - 2].kind === expectedLastToken; } } @@ -31532,7 +32454,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 268 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 269 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -31638,7 +32560,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 245); + ts.Debug.assert(startNode !== undefined || n.kind === 246); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -31653,6 +32575,39 @@ var ts; } } ts.findPrecedingToken = findPrecedingToken; + function isInString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return token && token.kind === 9 && position > token.getStart(); + } + ts.isInString = isInString; + function isInComment(sourceFile, position) { + return isInCommentHelper(sourceFile, position, undefined); + } + ts.isInComment = isInComment; + function isInCommentHelper(sourceFile, position, predicate) { + var token = getTokenAtPosition(sourceFile, position); + if (token && position <= token.getStart()) { + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return predicate ? + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 ? position <= c.end : position < c.end) && + predicate(c); }) : + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 ? position <= c.end : position < c.end); }); + } + return false; + } + ts.isInCommentHelper = isInCommentHelper; + function hasDocComment(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return ts.forEach(commentRanges, jsDocPrefix); + function jsDocPrefix(c) { + var text = sourceFile.text; + return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*'; + } + } + ts.hasDocComment = hasDocComment; function nodeHasTokens(n) { return n.getWidth() !== 0; } @@ -31677,32 +32632,32 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 148 || node.kind === 165) { + if (node.kind === 149 || node.kind === 166) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 211 || node.kind === 212) { + if (ts.isFunctionLike(node) || node.kind === 212 || node.kind === 213) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 131; + return n.kind >= 0 && n.kind <= 132; } ts.isToken = isToken; function isWord(kind) { - return kind === 66 || ts.isKeyword(kind); + return kind === 67 || ts.isKeyword(kind); } ts.isWord = isWord; function isPropertyName(kind) { - return kind === 8 || kind === 7 || isWord(kind); + return kind === 9 || kind === 8 || isWord(kind); } function isComment(kind) { return kind === 2 || kind === 3; } ts.isComment = isComment; function isPunctuation(kind) { - return 14 <= kind && kind <= 65; + return 15 <= kind && kind <= 66; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { @@ -31712,9 +32667,9 @@ var ts; ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function isAccessibilityModifier(kind) { switch (kind) { - case 109: - case 107: + case 110: case 108: + case 109: return true; } return false; @@ -31740,7 +32695,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 135; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 136; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -31875,6 +32830,11 @@ var ts; return displayPart(text, ts.SymbolDisplayPartKind.text); } ts.textPart = textPart; + var carriageReturnLineFeed = "\r\n"; + function getNewLineOrDefaultFromHost(host) { + return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed; + } + ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost; function lineBreakPart() { return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak); } @@ -31915,7 +32875,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 223 || location.parent.kind === 227) && + (location.parent.kind === 224 || location.parent.kind === 228) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -31998,25 +32958,25 @@ var ts; function shouldRescanGreaterThanToken(node) { if (node) { switch (node.kind) { - case 28: - case 61: + case 29: case 62: + case 63: + case 44: case 43: - case 42: return true; } } return false; } function shouldRescanSlashToken(container) { - return container.kind === 9; + return container.kind === 10; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || - container.kind === 13; + return container.kind === 13 || + container.kind === 14; } function startsWithSlashToken(t) { - return t === 37 || t === 58; + return t === 38 || t === 59; } function readTokenInfo(n) { if (!isOnToken()) { @@ -32042,7 +33002,7 @@ var ts; scanner.scan(); } var currentToken = scanner.getToken(); - if (expectedScanAction === 1 && currentToken === 26) { + if (expectedScanAction === 1 && currentToken === 27) { currentToken = scanner.reScanGreaterToken(); ts.Debug.assert(n.kind === currentToken); lastScanAction = 1; @@ -32052,7 +33012,7 @@ var ts; ts.Debug.assert(n.kind === currentToken); lastScanAction = 2; } - else if (expectedScanAction === 3 && currentToken === 15) { + else if (expectedScanAction === 3 && currentToken === 16) { currentToken = scanner.reScanTemplateToken(); lastScanAction = 3; } @@ -32173,8 +33133,8 @@ var ts; return startLine === endLine; }; FormattingContext.prototype.BlockIsOnOneLine = function (node) { - var openBrace = ts.findChildOfKind(node, 14, this.sourceFile); - var closeBrace = ts.findChildOfKind(node, 15, this.sourceFile); + var openBrace = ts.findChildOfKind(node, 15, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 16, this.sourceFile); if (openBrace && closeBrace) { var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; @@ -32317,79 +33277,78 @@ var ts; /// this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1)); - this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 51), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(51, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(51, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - 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, 77), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 101), 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, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16, 78), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16, 102), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.FromTokens([18, 20, 24, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeOpenBracket = 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(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([66, 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, 76, 97, 82, 77]); - 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.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67, 3]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18, 3, 77, 98, 83, 78]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); + this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(39, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40, 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, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(39, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(40, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(35, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 40), 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([99, 95, 89, 75, 91, 98]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([105, 71]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); - this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); - this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(84, 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(100, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(91, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 76, 77, 68]), 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([97, 82]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([120, 126]), 66), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(40, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35, 35), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35, 40), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(41, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36, 41), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100, 96, 90, 76, 92, 99]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106, 72]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(101, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(92, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18, 77, 78, 69]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([98, 83]), 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([121, 127]), 67), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); this.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(118, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([122, 124]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112, 70, 119, 74, 78, 79, 80, 120, 103, 86, 104, 122, 123, 107, 109, 108, 126, 110]), 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([80, 103])), 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(33, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 66), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(51, 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, 26), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(26, formatting.Shared.TokenRange.FromTokens([16, 18, 26, 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.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(53, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([112, 66, 79, 74, 70, 110, 109, 107, 108, 120, 126, 18, 36])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); - this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(84, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); - this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(36, formatting.Shared.TokenRange.FromTokens([66, 16])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(111, 36), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([111, 36]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(119, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123, 125]), 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113, 71, 120, 75, 79, 80, 81, 121, 104, 87, 105, 123, 124, 108, 110, 109, 127, 111]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81, 104])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22, 67), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.FromTokens([18, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.FromTokens([17, 19, 27, 24])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8)); + this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), 8)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(54, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([113, 67, 80, 75, 71, 111, 110, 108, 109, 121, 127, 19, 37])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(85, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37, formatting.Shared.TokenRange.FromTokens([67, 17])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(112, 37), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112, 37]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -32427,6 +33386,7 @@ var ts; this.NoSpaceAfterOpenAngularBracket, this.NoSpaceBeforeCloseAngularBracket, this.NoSpaceAfterCloseAngularBracket, + this.NoSpaceAfterTypeAssertion, this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, @@ -32436,32 +33396,37 @@ var ts; this.NoSpaceBeforeSemicolon, this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.NoSpaceBeforeOpenBracket, + 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.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24, 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(84, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); - this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(84, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8)); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, 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, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17, 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, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); } Rules.prototype.getRuleName = function (rule) { var o = this; @@ -32473,31 +33438,31 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 196; + return context.contextNode.kind === 197; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 178: case 179: - case 186: - case 147: + case 180: + case 187: + case 148: return true; - case 160: - case 213: - case 218: - case 208: - case 135: - case 244: + case 161: + case 214: + case 219: + case 209: + case 136: + case 245: + case 139: case 138: - case 137: - return context.currentTokenSpan.kind === 54 || context.nextTokenSpan.kind === 54; - case 197: - return context.currentTokenSpan.kind === 87 || context.nextTokenSpan.kind === 87; + return context.currentTokenSpan.kind === 55 || context.nextTokenSpan.kind === 55; case 198: - return context.currentTokenSpan.kind === 131 || context.nextTokenSpan.kind === 131; + return context.currentTokenSpan.kind === 88 || context.nextTokenSpan.kind === 88; + case 199: + return context.currentTokenSpan.kind === 132 || context.nextTokenSpan.kind === 132; } return false; }; @@ -32505,7 +33470,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 179; + return context.contextNode.kind === 180; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -32546,91 +33511,91 @@ var ts; return true; } switch (node.kind) { - case 189: + case 190: + case 218: + case 163: case 217: - case 162: - case 216: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 210: + case 211: + case 141: case 140: - case 139: - case 142: case 143: case 144: - case 170: - case 141: + case 145: case 171: - case 212: + case 142: + case 172: + case 213: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 210 || context.contextNode.kind === 170; + return context.contextNode.kind === 211 || context.contextNode.kind === 171; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 211: case 212: - case 214: - case 152: + case 213: case 215: + case 153: + case 216: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 211: - case 215: - case 214: - case 189: - case 241: + case 212: case 216: - case 203: + case 215: + case 190: + case 242: + case 217: + case 204: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 193: - case 203: - case 196: + case 194: + case 204: case 197: case 198: + case 199: + case 196: + case 207: case 195: - case 206: - case 194: - case 202: - case 241: + case 203: + case 242: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 162; + return context.contextNode.kind === 163; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 165; + return context.contextNode.kind === 166; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 166; + return context.contextNode.kind === 167; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); }; Rules.IsPreviousTokenNotComma = function (context) { - return context.currentTokenSpan.kind !== 23; + return context.currentTokenSpan.kind !== 24; }; Rules.IsSameLineTokenContext = function (context) { return context.TokensAreOnSameLine(); @@ -32648,52 +33613,58 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 136; + return node.kind === 137; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 209 && + return context.currentTokenParent.kind === 210 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 215; + return context.contextNode.kind === 216; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 152; + return context.contextNode.kind === 153; }; - Rules.IsTypeArgumentOrParameter = function (token, parent) { - if (token.kind !== 24 && token.kind !== 26) { + Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { + if (token.kind !== 25 && token.kind !== 27) { return false; } switch (parent.kind) { - case 148: - case 211: + case 149: + case 169: case 212: - case 210: - case 170: + case 184: + case 213: + case 211: case 171: + case 172: + case 141: case 140: - case 139: - case 144: case 145: - case 165: + case 146: case 166: + case 167: + case 186: return true; default: return false; } }; - Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || - Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + Rules.IsTypeArgumentOrParameterOrAssertionContext = function (context) { + return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); + }; + Rules.IsTypeAssertionContext = function (context) { + return context.contextNode.kind === 169; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 100 && context.currentTokenParent.kind === 174; + return context.currentTokenSpan.kind === 101 && context.currentTokenParent.kind === 175; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 181 && context.contextNode.expression !== undefined; + return context.contextNode.kind === 182 && context.contextNode.expression !== undefined; }; return Rules; })(); @@ -32716,7 +33687,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 131 + 1; + this.mapRowLength = 132 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -32893,7 +33864,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 131; token++) { + for (var token = 0; token <= 132; token++) { result.push(token); } return result; @@ -32935,17 +33906,17 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(67, 131); - TokenRange.BinaryOperators = TokenRange.FromRange(24, 65); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([87, 88, 131, 113, 121]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([39, 40, 48, 47]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 66, 16, 18, 14, 94, 89]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([66, 16, 94, 89]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([66, 17, 19, 89]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([66, 16, 94, 89]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([66, 17, 19, 89]); + TokenRange.Keywords = TokenRange.FromRange(68, 132); + TokenRange.BinaryOperators = TokenRange.FromRange(25, 66); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([88, 89, 132, 114, 122]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([40, 41, 49, 48]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8, 67, 17, 19, 15, 95, 90]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([67, 17, 95, 90]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([67, 18, 20, 90]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([67, 17, 95, 90]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([67, 18, 20, 90]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([66, 125, 127, 117, 128, 100, 114]); + TokenRange.TypeNames = TokenRange.FromTokens([67, 126, 128, 118, 129, 101, 115]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -33021,6 +33992,16 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeCloseParen); rules.push(this.globalRules.NoSpaceBetweenParens); } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) { + rules.push(this.globalRules.SpaceAfterOpenBracket); + rules.push(this.globalRules.SpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenBracket); + rules.push(this.globalRules.NoSpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } if (options.InsertSpaceAfterSemicolonInForStatements) { rules.push(this.globalRules.SpaceAfterSemicolonInFor); } @@ -33071,11 +34052,11 @@ var ts; } formatting.formatOnEnter = formatOnEnter; function formatOnSemicolon(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 22, sourceFile, options, rulesProvider, 3); + return formatOutermostParent(position, 23, sourceFile, options, rulesProvider, 3); } formatting.formatOnSemicolon = formatOnSemicolon; function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 15, sourceFile, options, rulesProvider, 4); + return formatOutermostParent(position, 16, sourceFile, options, rulesProvider, 4); } formatting.formatOnClosingCurly = formatOnClosingCurly; function formatDocument(sourceFile, rulesProvider, options) { @@ -33123,17 +34104,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 211: case 212: + case 213: return ts.rangeContainsRange(parent.members, node); - case 215: - var body = parent.body; - return body && body.kind === 189 && ts.rangeContainsRange(body.statements, node); - case 245: - case 189: case 216: + var body = parent.body; + return body && body.kind === 190 && ts.rangeContainsRange(body.statements, node); + case 246: + case 190: + case 217: return ts.rangeContainsRange(parent.statements, node); - case 241: + case 242: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -33258,9 +34239,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 245 || - parent.kind === 238 || - parent.kind === 239) { + parent.kind === 246 || + parent.kind === 239 || + parent.kind === 240) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -33293,18 +34274,18 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 211: return 70; - case 212: return 104; - case 210: return 84; - case 214: return 214; - case 142: return 120; - case 143: return 126; - case 140: + case 212: return 71; + case 213: return 105; + case 211: return 85; + case 215: return 215; + case 143: return 121; + case 144: return 127; + case 141: if (node.asteriskToken) { - return 36; + return 37; } - case 138: - case 135: + case 139: + case 136: return node.name.kind; } } @@ -33312,8 +34293,8 @@ var ts; return { getIndentationForComment: function (kind) { switch (kind) { - case 15: - case 19: + case 16: + case 20: return indentation + delta; } return indentation; @@ -33325,15 +34306,15 @@ var ts; } } switch (kind) { - case 14: case 15: - case 18: - case 19: case 16: + case 19: + case 20: case 17: - case 77: - case 101: - case 53: + case 18: + case 78: + case 102: + case 54: return indentation; default: return nodeStartLine !== line ? indentation + delta : indentation; @@ -33413,7 +34394,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 136 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 137 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -33703,49 +34684,49 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 189: - case 216: + case 190: + case 217: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 142: + case 211: + case 171: case 141: - case 210: - case 170: case 140: - case 139: - case 171: + case 172: if (node.typeParameters === list) { - return 24; + return 25; } else if (node.parameters === list) { - return 16; + return 17; } break; - case 165: case 166: + case 167: if (node.typeArguments === list) { - return 24; + return 25; } else if (node.arguments === list) { - return 16; + return 17; } break; - case 148: + case 149: if (node.typeArguments === list) { - return 24; + return 25; } } return 0; } function getCloseTokenForOpenToken(kind) { switch (kind) { - case 16: - return 17; - case 24: - return 26; + case 17: + return 18; + case 25: + return 27; } return 0; } @@ -33815,17 +34796,17 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || - precedingToken.kind === 9 || + var precedingTokenIsLiteral = precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || - precedingToken.kind === 13; + precedingToken.kind === 13 || + precedingToken.kind === 14; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 23 && precedingToken.parent.kind !== 178) { + if (precedingToken.kind === 24 && precedingToken.parent.kind !== 179) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -33923,7 +34904,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 245 || !parentAndChildShareLine); + (parent.kind === 246 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -33934,10 +34915,10 @@ var ts; if (!nextToken) { return false; } - if (nextToken.kind === 14) { + if (nextToken.kind === 15) { return true; } - else if (nextToken.kind === 15) { + else if (nextToken.kind === 16) { var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; return lineAtPosition === nextTokenStartLine; } @@ -33947,8 +34928,8 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 193 && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 77, sourceFile); + if (parent.kind === 194 && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 78, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -33959,23 +34940,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 148: + case 149: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 162: + case 163: return node.parent.properties; - case 161: + case 162: return node.parent.elements; - case 210: - case 170: + case 211: case 171: + case 172: + case 141: case 140: - case 139: - case 144: - case 145: { + case 145: + case 146: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -33986,8 +34967,8 @@ var ts; } break; } - case 166: - case 165: { + case 167: + case 166: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -34012,11 +34993,11 @@ var ts; } } function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) { - if (node.kind === 17) { + if (node.kind === 18) { return -1; } - if (node.parent && (node.parent.kind === 165 || - node.parent.kind === 166) && + if (node.parent && (node.parent.kind === 166 || + node.parent.kind === 167) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -34034,10 +35015,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 165: case 166: - case 163: + case 167: case 164: + case 165: node = node.expression; break; default: @@ -34052,7 +35033,7 @@ var ts; var node = list[index]; var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); for (var i = index - 1; i >= 0; --i) { - if (list[i].kind === 23) { + if (list[i].kind === 24) { continue; } var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; @@ -34092,28 +35073,30 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 211: case 212: - case 214: - case 161: - case 189: - case 216: + case 213: + case 215: case 162: - case 152: - case 154: + case 190: case 217: + case 163: + case 153: + case 155: + case 218: + case 240: case 239: - case 238: - case 169: - case 165: + case 170: + case 164: case 166: - case 190: - case 208: - case 224: - case 201: - case 179: + case 167: + case 191: + case 209: + case 225: + case 202: + case 180: + case 160: case 159: - case 158: + case 231: return true; } return false; @@ -34123,22 +35106,22 @@ var ts; return true; } switch (parent) { - case 194: case 195: - case 197: - case 198: case 196: - case 193: - case 210: - case 170: - case 140: - case 139: - case 144: + case 198: + case 199: + case 197: + case 194: + case 211: case 171: case 141: + case 140: + case 145: + case 172: case 142: case 143: - return child !== 189; + case 144: + return child !== 190; default: return false; } @@ -34238,7 +35221,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(268, nodes.pos, nodes.end, 4096, this); + var list = createNode(269, nodes.pos, nodes.end, 4096, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -34257,7 +35240,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 132) { + if (this.kind >= 133) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -34299,24 +35282,20 @@ var ts; 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 < 132) { - return child; - } - return child.getFirstToken(sourceFile); + var children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; } + var child = children[0]; + return child.kind < 133 ? child : 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 < 132) { - return child; - } - return child.getLastToken(sourceFile); + var child = ts.lastOrUndefined(children); + if (!child) { + return undefined; } + return child.kind < 133 ? child : child.getLastToken(sourceFile); }; return NodeObject; })(); @@ -34358,7 +35337,7 @@ var ts; ts.forEach(declarations, function (declaration, indexOfDeclaration) { if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 135) { + if (canUseParsedParamTagComments && declaration.kind === 136) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -34366,13 +35345,13 @@ var ts; } }); } - if (declaration.kind === 215 && declaration.body.kind === 215) { + if (declaration.kind === 216 && declaration.body.kind === 216) { return; } - while (declaration.kind === 215 && declaration.parent.kind === 215) { + while (declaration.kind === 216 && declaration.parent.kind === 216) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 208 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 209 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -34608,6 +35587,11 @@ var ts; TypeObject.prototype.getNumberIndexType = function () { return this.checker.getIndexTypeOfType(this, 1); }; + TypeObject.prototype.getBaseTypes = function () { + return this.flags & (1024 | 2048) + ? this.checker.getBaseTypes(this) + : undefined; + }; return TypeObject; })(); var SignatureObject = (function () { @@ -34677,9 +35661,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 133) { + if (declaration.name.kind === 134) { var expr = declaration.name.expression; - if (expr.kind === 163) { + if (expr.kind === 164) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -34689,9 +35673,9 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 66 || - node.kind === 8 || - node.kind === 7) { + if (node.kind === 67 || + node.kind === 9 || + node.kind === 8) { return node.text; } } @@ -34699,9 +35683,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 210: + case 211: + case 141: case 140: - case 139: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -34718,62 +35702,62 @@ var ts; ts.forEachChild(node, visit); } break; - case 211: case 212: case 213: case 214: case 215: - case 218: - case 227: - case 223: - case 218: - case 220: + case 216: + case 219: + case 228: + case 224: + case 219: case 221: - case 142: + case 222: case 143: - case 152: + case 144: + case 153: addDeclaration(node); - case 141: - case 190: - case 209: - case 158: + case 142: + case 191: + case 210: case 159: - case 216: + case 160: + case 217: ts.forEachChild(node, visit); break; - case 189: + case 190: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 135: + case 136: if (!(node.flags & 112)) { break; } - case 208: - case 160: + case 209: + case 161: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 244: + case 245: + case 139: case 138: - case 137: addDeclaration(node); break; - case 225: + case 226: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 219: + case 220: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221) { + if (importClause.namedBindings.kind === 222) { addDeclaration(importClause.namedBindings); } else { @@ -34915,14 +35899,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 170) { + if (declaration.kind === 171) { return true; } - if (declaration.kind !== 208 && declaration.kind !== 210) { + if (declaration.kind !== 209 && declaration.kind !== 211) { return false; } - for (var parent_9 = declaration.parent; !ts.isFunctionBlock(parent_9); parent_9 = parent_9.parent) { - if (parent_9.kind === 245 || parent_9.kind === 216) { + for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { + if (parent_8.kind === 246 || parent_8.kind === 217) { return false; } } @@ -35027,37 +36011,57 @@ var ts; sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } - function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { - var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + function transpileModule(input, transpileOptions) { + var options = transpileOptions.compilerOptions ? ts.clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions(); options.isolatedModules = true; options.allowNonTsExtensions = true; options.noLib = true; options.noResolve = true; - var inputFileName = fileName || "module.ts"; + var inputFileName = transpileOptions.fileName || "module.ts"; var sourceFile = ts.createSourceFile(inputFileName, input, options.target); - if (moduleName) { - sourceFile.moduleName = moduleName; + if (transpileOptions.moduleName) { + sourceFile.moduleName = transpileOptions.moduleName; } + sourceFile.renamedDependencies = transpileOptions.renamedDependencies; var newLine = ts.getNewLineCharacter(options); var outputText; + var sourceMapText; var compilerHost = { getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { - ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); - outputText = text; + if (ts.fileExtensionIs(name, ".map")) { + ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); + sourceMapText = text; + } + else { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + } }, getDefaultLibFileName: function () { return "lib.d.ts"; }, useCaseSensitiveFileNames: function () { return false; }, getCanonicalFileName: function (fileName) { return fileName; }, getCurrentDirectory: function () { return ""; }, - getNewLine: function () { return newLine; } + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return fileName === inputFileName; }, + readFile: function (fileName) { return ""; } }; var program = ts.createProgram([inputFileName], options, compilerHost); - ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile)); - ts.addRange(diagnostics, program.getOptionsDiagnostics()); + var diagnostics; + if (transpileOptions.reportDiagnostics) { + diagnostics = []; + ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile)); + ts.addRange(diagnostics, program.getOptionsDiagnostics()); + } program.emit(); ts.Debug.assert(outputText !== undefined, "Output generation failed"); - return outputText; + return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText }; + } + ts.transpileModule = transpileModule; + function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { + var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName }); + ts.addRange(diagnostics, output.diagnostics); + return output.outputText; } ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { @@ -35112,11 +36116,12 @@ var ts; ? (function (fileName) { return fileName; }) : (function (fileName) { return fileName.toLowerCase(); }); } + ts.createGetCanonicalFileName = createGetCanonicalFileName; function createDocumentRegistry(useCaseSensitiveFileNames) { var buckets = {}; var getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); function getKeyFromCompilationSettings(settings) { - return "_" + settings.target; + return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx; } function getBucketForCompilationSettings(settings, createIfMissing) { var key = getKeyFromCompilationSettings(settings); @@ -35197,6 +36202,7 @@ var ts; if (readImportFiles === void 0) { readImportFiles = true; } var referencedFiles = []; var importedFiles = []; + var ambientExternalModules; var isNoDefaultLib = false; function processTripleSlashDirectives() { var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); @@ -35212,6 +36218,12 @@ var ts; } }); } + function recordAmbientExternalModule() { + if (!ambientExternalModules) { + ambientExternalModules = []; + } + ambientExternalModules.push(scanner.getTokenValue()); + } function recordModuleName() { var importPath = scanner.getTokenValue(); var pos = scanner.getTokenPos(); @@ -35225,66 +36237,76 @@ var ts; scanner.setText(sourceText); var token = scanner.scan(); while (token !== 1) { - if (token === 86) { + if (token === 120) { token = scanner.scan(); - if (token === 8) { + if (token === 123) { + token = scanner.scan(); + if (token === 9) { + recordAmbientExternalModule(); + continue; + } + } + } + else if (token === 87) { + token = scanner.scan(); + if (token === 9) { recordModuleName(); continue; } else { - if (token === 66) { + if (token === 67 || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 130) { + if (token === 131) { token = scanner.scan(); - if (token === 8) { + if (token === 9) { recordModuleName(); continue; } } - else if (token === 54) { + else if (token === 55) { token = scanner.scan(); - if (token === 124) { + if (token === 125) { token = scanner.scan(); - if (token === 16) { + if (token === 17) { token = scanner.scan(); - if (token === 8) { + if (token === 9) { recordModuleName(); continue; } } } } - else if (token === 23) { + else if (token === 24) { token = scanner.scan(); } else { continue; } } - if (token === 14) { + if (token === 15) { token = scanner.scan(); - while (token !== 15) { + while (token !== 16) { token = scanner.scan(); } - if (token === 15) { + if (token === 16) { token = scanner.scan(); - if (token === 130) { + if (token === 131) { token = scanner.scan(); - if (token === 8) { + if (token === 9) { recordModuleName(); } } } } - else if (token === 36) { + else if (token === 37) { token = scanner.scan(); - if (token === 113) { + if (token === 114) { token = scanner.scan(); - if (token === 66) { + if (token === 67 || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 130) { + if (token === 131) { token = scanner.scan(); - if (token === 8) { + if (token === 9) { recordModuleName(); } } @@ -35293,28 +36315,28 @@ var ts; } } } - else if (token === 79) { + else if (token === 80) { token = scanner.scan(); - if (token === 14) { + if (token === 15) { token = scanner.scan(); - while (token !== 15) { + while (token !== 16) { token = scanner.scan(); } - if (token === 15) { + if (token === 16) { token = scanner.scan(); - if (token === 130) { + if (token === 131) { token = scanner.scan(); - if (token === 8) { + if (token === 9) { recordModuleName(); } } } } - else if (token === 36) { + else if (token === 37) { token = scanner.scan(); - if (token === 130) { + if (token === 131) { token = scanner.scan(); - if (token === 8) { + if (token === 9) { recordModuleName(); } } @@ -35328,12 +36350,12 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; } ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 204 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 205 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -35341,17 +36363,17 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 66 && - (node.parent.kind === 200 || node.parent.kind === 199) && + return node.kind === 67 && + (node.parent.kind === 201 || node.parent.kind === 200) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 66 && - node.parent.kind === 204 && + return node.kind === 67 && + node.parent.kind === 205 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 204; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 205; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -35362,55 +36384,55 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 132 && node.parent.right === node; + return node.parent.kind === 133 && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 163 && node.parent.name === node; + return node && node.parent && node.parent.kind === 164 && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 165 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 166 && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 166 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 167 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 215 && node.parent.name === node; + return node.parent.kind === 216 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 66 && + return node.kind === 67 && ts.isFunctionLike(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 66 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 242 || node.parent.kind === 243) && node.parent.name === node; + return (node.kind === 67 || node.kind === 9 || node.kind === 8) && + (node.parent.kind === 243 || node.parent.kind === 244) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { - if (node.kind === 8 || node.kind === 7) { + if (node.kind === 9 || node.kind === 8) { switch (node.parent.kind) { + case 139: case 138: - case 137: - case 242: - case 244: + case 243: + case 245: + case 141: case 140: - case 139: - case 142: case 143: - case 215: + case 144: + case 216: return node.parent.name === node; - case 164: + case 165: return node.parent.argumentExpression === node; } } return false; } function isNameOfExternalModuleImportOrDeclaration(node) { - if (node.kind === 8) { + if (node.kind === 9) { return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } @@ -35441,7 +36463,7 @@ var ts; } } var keywordCompletions = []; - for (var i = 67; i <= 131; i++) { + for (var i = 68; i <= 132; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -35456,17 +36478,17 @@ var ts; return undefined; } switch (node.kind) { - case 245: + case 246: + case 141: case 140: - case 139: - case 210: - case 170: - case 142: - case 143: case 211: + case 171: + case 143: + case 144: case 212: - case 214: + case 213: case 215: + case 216: return node; } } @@ -35474,38 +36496,38 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 215: return ScriptElementKind.moduleElement; - case 211: return ScriptElementKind.classElement; - case 212: return ScriptElementKind.interfaceElement; - case 213: return ScriptElementKind.typeElement; - case 214: return ScriptElementKind.enumElement; - case 208: + case 216: return ScriptElementKind.moduleElement; + case 212: return ScriptElementKind.classElement; + case 213: return ScriptElementKind.interfaceElement; + case 214: return ScriptElementKind.typeElement; + case 215: return ScriptElementKind.enumElement; + case 209: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 210: return ScriptElementKind.functionElement; - case 142: return ScriptElementKind.memberGetAccessorElement; - case 143: return ScriptElementKind.memberSetAccessorElement; + case 211: return ScriptElementKind.functionElement; + case 143: return ScriptElementKind.memberGetAccessorElement; + case 144: return ScriptElementKind.memberSetAccessorElement; + case 141: case 140: - case 139: return ScriptElementKind.memberFunctionElement; + case 139: case 138: - case 137: return ScriptElementKind.memberVariableElement; - case 146: return ScriptElementKind.indexSignatureElement; - case 145: return ScriptElementKind.constructSignatureElement; - case 144: return ScriptElementKind.callSignatureElement; - case 141: return ScriptElementKind.constructorImplementationElement; - case 134: return ScriptElementKind.typeParameterElement; - case 244: return ScriptElementKind.variableElement; - case 135: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 218: - case 223: - case 220: - case 227: + case 147: return ScriptElementKind.indexSignatureElement; + case 146: return ScriptElementKind.constructSignatureElement; + case 145: return ScriptElementKind.callSignatureElement; + case 142: return ScriptElementKind.constructorImplementationElement; + case 135: return ScriptElementKind.typeParameterElement; + case 245: return ScriptElementKind.variableElement; + case 136: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 219: + case 224: case 221: + case 228: + case 222: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -35573,17 +36595,33 @@ var ts; } var oldSettings = program && program.getCompilerOptions(); var newSettings = hostCache.compilationSettings(); - var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; - var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { + var changesInCompilationSettingsAffectSyntax = oldSettings && + (oldSettings.target !== newSettings.target || + oldSettings.module !== newSettings.module || + oldSettings.noResolve !== newSettings.noResolve || + oldSettings.jsx !== newSettings.jsx); + var compilerHost = { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, - getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, + getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); } - }); + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + fileExists: function (fileName) { + ts.Debug.assert(!host.resolveModuleNames); + return hostCache.getOrCreateEntry(fileName) !== undefined; + }, + readFile: function (fileName) { + var entry = hostCache.getOrCreateEntry(fileName); + return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + } + }; + if (host.resolveModuleNames) { + compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); if (program) { var oldSourceFiles = program.getSourceFiles(); for (var _i = 0; _i < oldSourceFiles.length; _i++) { @@ -35671,44 +36709,44 @@ var ts; return false; } switch (node.kind) { - case 218: + case 219: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 224: + case 225: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 211: + case 212: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 240: + case 241: var heritageClause = node; - if (heritageClause.token === 103) { + if (heritageClause.token === 104) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 212: + case 213: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 215: + case 216: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 213: + case 214: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 140: - case 139: case 141: + case 140: case 142: case 143: - case 170: - case 210: + case 144: case 171: - case 210: + case 211: + case 172: + case 211: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -35716,20 +36754,20 @@ var ts; return true; } break; - case 190: + case 191: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 208: + case 209: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 165: case 166: + case 167: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -35737,7 +36775,7 @@ var ts; return true; } break; - case 135: + case 136: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -35753,17 +36791,17 @@ var ts; return true; } break; - case 138: + case 139: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 214: + case 215: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 168: + case 169: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 136: + case 137: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -35789,17 +36827,17 @@ var ts; for (var _i = 0; _i < modifiers.length; _i++) { var modifier = modifiers[_i]; switch (modifier.kind) { - case 109: - case 107: + case 110: case 108: - case 119: + case 109: + case 120: diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); return true; - case 110: - case 79: - case 71: - case 74: - case 112: + case 111: + case 80: + case 72: + case 75: + case 113: } } } @@ -35873,13 +36911,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_10 = contextToken.parent, kind = contextToken.kind; - if (kind === 20) { - if (parent_10.kind === 163) { + var parent_9 = contextToken.parent, kind = contextToken.kind; + if (kind === 21) { + if (parent_9.kind === 164) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_10.kind === 132) { + else if (parent_9.kind === 133) { node = contextToken.parent.left; isRightOfDot = true; } @@ -35887,7 +36925,7 @@ var ts; return undefined; } } - else if (kind === 24 && sourceFile.languageVariant === 1) { + else if (kind === 25 && sourceFile.languageVariant === 1) { isRightOfOpenTag = true; location = contextToken; } @@ -35920,7 +36958,7 @@ var ts; function getTypeScriptMemberSymbols() { isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 66 || node.kind === 132 || node.kind === 163) { + if (node.kind === 67 || node.kind === 133 || node.kind === 164) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeChecker.getAliasedSymbol(symbol); @@ -35966,7 +37004,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType; - if ((jsxContainer.kind === 231) || (jsxContainer.kind === 232)) { + if ((jsxContainer.kind === 232) || (jsxContainer.kind === 233)) { attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { symbols = filterJsxAttributes(typeChecker.getPropertiesOfType(attrsType), jsxContainer.attributes); @@ -36008,41 +37046,41 @@ var ts; if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { - case 23: - return containingNodeKind === 165 - || containingNodeKind === 141 - || containingNodeKind === 166 - || containingNodeKind === 161 - || containingNodeKind === 178 - || containingNodeKind === 149; - case 16: - return containingNodeKind === 165 - || containingNodeKind === 141 - || containingNodeKind === 166 - || containingNodeKind === 169 - || containingNodeKind === 157; - case 18: - return containingNodeKind === 161 - || containingNodeKind === 146 - || containingNodeKind === 133; - case 122: + case 24: + return containingNodeKind === 166 + || containingNodeKind === 142 + || containingNodeKind === 167 + || containingNodeKind === 162 + || containingNodeKind === 179 + || containingNodeKind === 150; + case 17: + return containingNodeKind === 166 + || containingNodeKind === 142 + || containingNodeKind === 167 + || containingNodeKind === 170 + || containingNodeKind === 158; + case 19: + return containingNodeKind === 162 + || containingNodeKind === 147 + || containingNodeKind === 134; case 123: + case 124: return true; - case 20: - return containingNodeKind === 215; - case 14: - return containingNodeKind === 211; - case 54: - return containingNodeKind === 208 - || containingNodeKind === 178; - case 11: - return containingNodeKind === 180; + case 21: + return containingNodeKind === 216; + case 15: + return containingNodeKind === 212; + case 55: + return containingNodeKind === 209 + || containingNodeKind === 179; case 12: - return containingNodeKind === 187; - case 109: - case 107: + return containingNodeKind === 181; + case 13: + return containingNodeKind === 188; + case 110: case 108: - return containingNodeKind === 138; + case 109: + return containingNodeKind === 139; } switch (previousToken.getText()) { case "public": @@ -36054,8 +37092,8 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { - if (contextToken.kind === 8 - || contextToken.kind === 9 + if (contextToken.kind === 9 + || contextToken.kind === 10 || ts.isTemplateLiteralKind(contextToken.kind)) { var start_3 = contextToken.getStart(); var end = contextToken.getEnd(); @@ -36064,7 +37102,7 @@ var ts; } if (position === end) { return !!contextToken.isUnterminated - || contextToken.kind === 9; + || contextToken.kind === 10; } } return false; @@ -36073,15 +37111,23 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 162) { + if (objectLikeContainer.kind === 163) { isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 158) { + else if (objectLikeContainer.kind === 159) { isNewIdentifierLocation = false; - typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); - existingMembers = objectLikeContainer.elements; + var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); + if (ts.isVariableLike(rootDeclaration)) { + if (rootDeclaration.initializer || rootDeclaration.type) { + typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); + existingMembers = objectLikeContainer.elements; + } + } + else { + ts.Debug.fail("Root declaration is not variable-like."); + } } else { ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind); @@ -36096,9 +37142,9 @@ var ts; return true; } function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 222 ? - 219 : - 225; + var declarationKind = namedImportsOrExports.kind === 223 ? + 220 : + 226; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -36117,11 +37163,11 @@ var ts; function tryGetObjectLikeCompletionContainer(contextToken) { if (contextToken) { switch (contextToken.kind) { - case 14: - case 23: - var parent_11 = contextToken.parent; - if (parent_11 && (parent_11.kind === 162 || parent_11.kind === 158)) { - return parent_11; + case 15: + case 24: + var parent_10 = contextToken.parent; + if (parent_10 && (parent_10.kind === 163 || parent_10.kind === 159)) { + return parent_10; } break; } @@ -36131,11 +37177,11 @@ var ts; function tryGetNamedImportsOrExportsForCompletion(contextToken) { if (contextToken) { switch (contextToken.kind) { - case 14: - case 23: + case 15: + case 24: switch (contextToken.parent.kind) { - case 222: - case 226: + case 223: + case 227: return contextToken.parent; } } @@ -36144,21 +37190,31 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_12 = contextToken.parent; + var parent_11 = contextToken.parent; switch (contextToken.kind) { - case 25: - case 37: - case 66: - if (parent_12 && (parent_12.kind === 231 || parent_12.kind === 232)) { - return parent_12; + case 26: + case 38: + case 67: + case 236: + case 237: + if (parent_11 && (parent_11.kind === 232 || parent_11.kind === 233)) { + return parent_11; } break; - case 15: - if (parent_12 && - parent_12.kind === 237 && - parent_12.parent && - parent_12.parent.kind === 235) { - return parent_12.parent.parent; + case 9: + if (parent_11 && ((parent_11.kind === 236) || (parent_11.kind === 237))) { + return parent_11.parent; + } + break; + case 16: + if (parent_11 && + parent_11.kind === 238 && + parent_11.parent && + (parent_11.parent.kind === 236)) { + return parent_11.parent.parent; + } + if (parent_11 && parent_11.kind === 237) { + return parent_11.parent; } break; } @@ -36167,16 +37223,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 170: case 171: - case 210: + case 172: + case 211: + case 141: case 140: - case 139: - case 142: case 143: case 144: case 145: case 146: + case 147: return true; } return false; @@ -36184,65 +37240,65 @@ var ts; function isSolelyIdentifierDefinitionLocation(contextToken) { var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { - case 23: - return containingNodeKind === 208 || - containingNodeKind === 209 || - containingNodeKind === 190 || - containingNodeKind === 214 || - isFunction(containingNodeKind) || - containingNodeKind === 211 || + case 24: + return containingNodeKind === 209 || containingNodeKind === 210 || + containingNodeKind === 191 || + containingNodeKind === 215 || + isFunction(containingNodeKind) || containingNodeKind === 212 || - containingNodeKind === 159; - case 20: - return containingNodeKind === 159; - case 52: + containingNodeKind === 211 || + containingNodeKind === 213 || + containingNodeKind === 160; + case 21: + return containingNodeKind === 160; + case 53: + return containingNodeKind === 161; + case 19: return containingNodeKind === 160; - case 18: - return containingNodeKind === 159; - case 16: - return containingNodeKind === 241 || + case 17: + return containingNodeKind === 242 || isFunction(containingNodeKind); - case 14: - return containingNodeKind === 214 || - containingNodeKind === 212 || - containingNodeKind === 152; - case 22: - return containingNodeKind === 137 && + case 15: + return containingNodeKind === 215 || + containingNodeKind === 213 || + containingNodeKind === 153; + case 23: + return containingNodeKind === 138 && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 212 || - contextToken.parent.parent.kind === 152); - case 24: - return containingNodeKind === 211 || - containingNodeKind === 210 || - containingNodeKind === 212 || + (contextToken.parent.parent.kind === 213 || + contextToken.parent.parent.kind === 153); + case 25: + return containingNodeKind === 212 || + containingNodeKind === 211 || + containingNodeKind === 213 || isFunction(containingNodeKind); - case 110: - return containingNodeKind === 138; - case 21: - return containingNodeKind === 135 || + case 111: + return containingNodeKind === 139; + case 22: + return containingNodeKind === 136 || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 159); - case 109: - case 107: + contextToken.parent.parent.kind === 160); + case 110: case 108: - return containingNodeKind === 135; - case 113: - containingNodeKind === 223 || - containingNodeKind === 227 || - containingNodeKind === 221; - case 70: - case 78: - case 104: - case 84: - case 99: - case 120: - case 126: - case 86: - case 105: + case 109: + return containingNodeKind === 136; + case 114: + containingNodeKind === 224 || + containingNodeKind === 228 || + containingNodeKind === 222; case 71: - case 111: - case 129: + case 79: + case 105: + case 85: + case 100: + case 121: + case 127: + case 87: + case 106: + case 72: + case 112: + case 130: return true; } switch (contextToken.getText()) { @@ -36260,7 +37316,7 @@ var ts; return false; } function isDotOfNumericLiteral(contextToken) { - if (contextToken.kind === 7) { + if (contextToken.kind === 8) { var text = contextToken.getFullText(); return text.charAt(text.length - 1) === "."; } @@ -36288,16 +37344,16 @@ var ts; var existingMemberNames = {}; for (var _i = 0; _i < existingMembers.length; _i++) { var m = existingMembers[_i]; - if (m.kind !== 242 && - m.kind !== 243 && - m.kind !== 160) { + if (m.kind !== 243 && + m.kind !== 244 && + m.kind !== 161) { continue; } if (m.getStart() <= position && position <= m.getEnd()) { continue; } var existingName = void 0; - if (m.kind === 160 && m.propertyName) { + if (m.kind === 161 && m.propertyName) { existingName = m.propertyName.text; } else { @@ -36314,7 +37370,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 235) { + if (attr.kind === 236) { seenNames[attr.name.text] = true; } } @@ -36434,7 +37490,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32) - return ts.getDeclarationOfKind(symbol, 183) ? + return ts.getDeclarationOfKind(symbol, 184) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384) return ScriptElementKind.enumElement; @@ -36530,14 +37586,14 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 163) { + if (location.parent && location.parent.kind === 164) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression; - if (location.kind === 165 || location.kind === 166) { + if (location.kind === 166 || location.kind === 167) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -36549,7 +37605,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 166 || callExpression.expression.kind === 92; + var useConstructSignatures = callExpression.kind === 167 || callExpression.expression.kind === 93; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -36564,7 +37620,7 @@ var ts; pushTypePart(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(89)); + displayParts.push(ts.keywordPart(90)); displayParts.push(ts.spacePart()); } addFullSymbolName(symbol); @@ -36579,10 +37635,10 @@ var ts; case ScriptElementKind.letElement: case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: - displayParts.push(ts.punctuationPart(52)); + displayParts.push(ts.punctuationPart(53)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(89)); + displayParts.push(ts.keywordPart(90)); displayParts.push(ts.spacePart()); } if (!(type.flags & 65536)) { @@ -36597,21 +37653,21 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 118 && location.parent.kind === 141)) { + (location.kind === 119 && location.parent.kind === 142)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 141 ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 142 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 141) { + if (functionDeclaration.kind === 142) { symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 144 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 145 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -36620,11 +37676,11 @@ var ts; } } if (symbolFlags & 32 && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 183)) { + if (ts.getDeclarationOfKind(symbol, 184)) { pushTypePart(ScriptElementKind.localClassElement); } else { - displayParts.push(ts.keywordPart(70)); + displayParts.push(ts.keywordPart(71)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); @@ -36632,61 +37688,61 @@ var ts; } if ((symbolFlags & 64) && (semanticMeaning & 2)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(104)); + displayParts.push(ts.keywordPart(105)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(129)); + displayParts.push(ts.keywordPart(130)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54)); + displayParts.push(ts.operatorPart(55)); displayParts.push(ts.spacePart()); ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); } if (symbolFlags & 384) { addNewLineIfDisplayPartsExist(); if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { - displayParts.push(ts.keywordPart(71)); + displayParts.push(ts.keywordPart(72)); displayParts.push(ts.spacePart()); } - displayParts.push(ts.keywordPart(78)); + displayParts.push(ts.keywordPart(79)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 215); - var isNamespace = declaration && declaration.name && declaration.name.kind === 66; - displayParts.push(ts.keywordPart(isNamespace ? 123 : 122)); + var declaration = ts.getDeclarationOfKind(symbol, 216); + var isNamespace = declaration && declaration.name && declaration.name.kind === 67; + displayParts.push(ts.keywordPart(isNamespace ? 124 : 123)); 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.textPart("type parameter")); + displayParts.push(ts.punctuationPart(18)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.keywordPart(88)); displayParts.push(ts.spacePart()); if (symbol.parent) { addFullSymbolName(symbol.parent, enclosingDeclaration); writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 134).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 135).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 145) { - displayParts.push(ts.keywordPart(89)); + if (signatureDeclaration.kind === 146) { + displayParts.push(ts.keywordPart(90)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 144 && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 145 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); @@ -36695,11 +37751,11 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 244) { + if (declaration.kind === 245) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54)); + displayParts.push(ts.operatorPart(55)); displayParts.push(ts.spacePart()); displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); } @@ -36707,26 +37763,26 @@ var ts; } if (symbolFlags & 8388608) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(86)); + displayParts.push(ts.keywordPart(87)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 218) { + if (declaration.kind === 219) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54)); + displayParts.push(ts.operatorPart(55)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(124)); - displayParts.push(ts.punctuationPart(16)); - displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); + displayParts.push(ts.keywordPart(125)); displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); + displayParts.push(ts.punctuationPart(18)); } else { var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54)); + displayParts.push(ts.operatorPart(55)); displayParts.push(ts.spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -36742,7 +37798,7 @@ var ts; if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { - displayParts.push(ts.punctuationPart(52)); + displayParts.push(ts.punctuationPart(53)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { @@ -36800,9 +37856,9 @@ var ts; displayParts.push(ts.textOrKeywordPart(symbolKind)); return; default: - displayParts.push(ts.punctuationPart(16)); - displayParts.push(ts.textOrKeywordPart(symbolKind)); displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.textOrKeywordPart(symbolKind)); + displayParts.push(ts.punctuationPart(18)); return; } } @@ -36810,12 +37866,12 @@ var ts; ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32)); if (allSignatures.length > 1) { displayParts.push(ts.spacePart()); - displayParts.push(ts.punctuationPart(16)); - displayParts.push(ts.operatorPart(34)); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.operatorPart(35)); displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral)); displayParts.push(ts.spacePart()); displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); - displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.punctuationPart(18)); } documentation = signature.getDocumentationComment(); } @@ -36840,11 +37896,11 @@ var ts; var symbol = typeChecker.getSymbolAtLocation(node); if (!symbol) { switch (node.kind) { - case 66: - case 163: - case 132: - case 94: - case 92: + case 67: + case 164: + case 133: + case 95: + case 93: var type = typeChecker.getTypeAtLocation(node); if (type) { return { @@ -36893,10 +37949,10 @@ var ts; } return result; function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { - if (isNewExpressionTarget(location) || location.kind === 118) { + if (isNewExpressionTarget(location) || location.kind === 119) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 211); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 212); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -36912,8 +37968,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 141) || - (!selectConstructors && (d.kind === 210 || d.kind === 140 || d.kind === 139))) { + if ((selectConstructors && d.kind === 142) || + (!selectConstructors && (d.kind === 211 || d.kind === 141 || d.kind === 140))) { declarations.push(d); if (d.body) definition = d; @@ -36964,11 +38020,11 @@ var ts; } if (symbol.flags & 8388608) { var declaration = symbol.declarations[0]; - if (node.kind === 66 && node.parent === declaration) { + if (node.kind === 67 && node.parent === declaration) { symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 243) { + if (node.parent.kind === 244) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -37039,9 +38095,9 @@ var ts; }; } function getSemanticDocumentHighlights(node) { - if (node.kind === 66 || - node.kind === 94 || - node.kind === 92 || + if (node.kind === 67 || + node.kind === 95 || + node.kind === 93 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, false, false); @@ -37090,77 +38146,77 @@ var ts; function getHighlightSpans(node) { if (node) { switch (node.kind) { - case 85: - case 77: - if (hasKind(node.parent, 193)) { + case 86: + case 78: + if (hasKind(node.parent, 194)) { return getIfElseOccurrences(node.parent); } break; - case 91: - if (hasKind(node.parent, 201)) { + case 92: + if (hasKind(node.parent, 202)) { return getReturnOccurrences(node.parent); } break; - case 95: - if (hasKind(node.parent, 205)) { + case 96: + if (hasKind(node.parent, 206)) { return getThrowOccurrences(node.parent); } break; - case 69: - if (hasKind(parent(parent(node)), 206)) { + case 70: + if (hasKind(parent(parent(node)), 207)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; - case 97: - case 82: - if (hasKind(parent(node), 206)) { + case 98: + case 83: + if (hasKind(parent(node), 207)) { return getTryCatchFinallyOccurrences(node.parent); } break; - case 93: - if (hasKind(node.parent, 203)) { + case 94: + if (hasKind(node.parent, 204)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 68: - case 74: - if (hasKind(parent(parent(parent(node))), 203)) { + case 69: + case 75: + if (hasKind(parent(parent(parent(node))), 204)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; - case 67: - case 72: - if (hasKind(node.parent, 200) || hasKind(node.parent, 199)) { - return getBreakOrContinueStatementOccurences(node.parent); + case 68: + case 73: + if (hasKind(node.parent, 201) || hasKind(node.parent, 200)) { + return getBreakOrContinueStatementOccurrences(node.parent); } break; - case 83: - if (hasKind(node.parent, 196) || - hasKind(node.parent, 197) || - hasKind(node.parent, 198)) { + case 84: + if (hasKind(node.parent, 197) || + hasKind(node.parent, 198) || + hasKind(node.parent, 199)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 101: - case 76: - if (hasKind(node.parent, 195) || hasKind(node.parent, 194)) { + case 102: + case 77: + if (hasKind(node.parent, 196) || hasKind(node.parent, 195)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 118: - if (hasKind(node.parent, 141)) { + case 119: + if (hasKind(node.parent, 142)) { return getConstructorOccurrences(node.parent); } break; - case 120: - case 126: - if (hasKind(node.parent, 142) || hasKind(node.parent, 143)) { + case 121: + case 127: + if (hasKind(node.parent, 143) || hasKind(node.parent, 144)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 190)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 191)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -37172,10 +38228,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 205) { + if (node.kind === 206) { statementAccumulator.push(node); } - else if (node.kind === 206) { + else if (node.kind === 207) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -37196,17 +38252,17 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_13 = child.parent; - if (ts.isFunctionBlock(parent_13) || parent_13.kind === 245) { - return parent_13; + var parent_12 = child.parent; + if (ts.isFunctionBlock(parent_12) || parent_12.kind === 246) { + return parent_12; } - if (parent_13.kind === 206) { - var tryStatement = parent_13; + if (parent_12.kind === 207) { + var tryStatement = parent_12; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_13; + child = parent_12; } return undefined; } @@ -37215,7 +38271,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 200 || node.kind === 199) { + if (node.kind === 201 || node.kind === 200) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -37231,15 +38287,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 203: - if (statement.kind === 199) { + case 204: + if (statement.kind === 200) { continue; } - case 196: case 197: case 198: + case 199: + case 196: case 195: - case 194: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -37256,24 +38312,24 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 211 || - container.kind === 183 || - (declaration.kind === 135 && hasKind(container, 141)))) { + if (!(container.kind === 212 || + container.kind === 184 || + (declaration.kind === 136 && hasKind(container, 142)))) { return undefined; } } - else if (modifier === 110) { - if (!(container.kind === 211 || container.kind === 183)) { + else if (modifier === 111) { + if (!(container.kind === 212 || container.kind === 184)) { return undefined; } } - else if (modifier === 79 || modifier === 119) { - if (!(container.kind === 216 || container.kind === 245)) { + else if (modifier === 80 || modifier === 120) { + if (!(container.kind === 217 || container.kind === 246)) { return undefined; } } - else if (modifier === 112) { - if (!(container.kind === 211 || declaration.kind === 211)) { + else if (modifier === 113) { + if (!(container.kind === 212 || declaration.kind === 212)) { return undefined; } } @@ -37284,8 +38340,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 216: - case 245: + case 217: + case 246: if (modifierFlag & 256) { nodes = declaration.members.concat(declaration); } @@ -37293,15 +38349,15 @@ var ts; nodes = container.statements; } break; - case 141: + case 142: nodes = container.parameters.concat(container.parent.members); break; - case 211: - case 183: + case 212: + case 184: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 141 && member; + return member.kind === 142 && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -37322,19 +38378,19 @@ var ts; return ts.map(keywords, getHighlightSpanForNode); function getFlagFromModifier(modifier) { switch (modifier) { - case 109: + case 110: return 16; - case 107: - return 32; case 108: + return 32; + case 109: return 64; - case 110: + case 111: return 128; - case 79: + case 80: return 1; - case 119: + case 120: return 2; - case 112: + case 113: return 256; default: ts.Debug.fail(); @@ -37354,13 +38410,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 142); tryPushAccessorKeyword(accessorDeclaration.symbol, 143); + tryPushAccessorKeyword(accessorDeclaration.symbol, 144); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 120, 126); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 121, 127); }); } } } @@ -37369,18 +38425,18 @@ var ts; var keywords = []; ts.forEach(declarations, function (declaration) { ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 118); + return pushKeywordIf(keywords, token, 119); }); }); return ts.map(keywords, getHighlightSpanForNode); } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 83, 101, 76)) { - if (loopNode.kind === 194) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 84, 102, 77)) { + if (loopNode.kind === 195) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 101)) { + if (pushKeywordIf(keywords, loopTokens[i], 102)) { break; } } @@ -37389,22 +38445,22 @@ var ts; var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 67, 72); + pushKeywordIf(keywords, statement.getFirstToken(), 68, 73); } }); return ts.map(keywords, getHighlightSpanForNode); } - function getBreakOrContinueStatementOccurences(breakOrContinueStatement) { + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 196: case 197: case 198: - case 194: + case 199: case 195: + case 196: return getLoopBreakContinueOccurrences(owner); - case 203: + case 204: return getSwitchCaseDefaultOccurrences(owner); } } @@ -37412,13 +38468,13 @@ var ts; } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 93); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 94); ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 68, 74); + pushKeywordIf(keywords, clause.getFirstToken(), 69, 75); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 67); + pushKeywordIf(keywords, statement.getFirstToken(), 68); } }); }); @@ -37426,13 +38482,13 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 97); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 98); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 69); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 70); } if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 82, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 82); + var finallyKeyword = ts.findChildOfKind(tryStatement, 83, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 83); } return ts.map(keywords, getHighlightSpanForNode); } @@ -37443,50 +38499,50 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 95); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 96); }); if (ts.isFunctionBlock(owner)) { ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 91); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 92); }); } return ts.map(keywords, getHighlightSpanForNode); } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 189))) { + if (!(func && hasKind(func.body, 190))) { return undefined; } var keywords = []; ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 91); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 92); }); ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 95); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 96); }); return ts.map(keywords, getHighlightSpanForNode); } function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 193) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 194) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 85); + pushKeywordIf(keywords, children[0], 86); for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 77)) { + if (pushKeywordIf(keywords, children[i], 78)) { break; } } - if (!hasKind(ifStatement.elseStatement, 193)) { + if (!hasKind(ifStatement.elseStatement, 194)) { break; } ifStatement = ifStatement.elseStatement; } var result = []; for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 77 && i < keywords.length - 1) { + if (keywords[i].kind === 78 && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; var shouldCombindElseAndIf = true; @@ -37564,12 +38620,12 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 66 && + if (node.kind !== 67 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } - ts.Debug.assert(node.kind === 66 || node.kind === 7 || node.kind === 8); + ts.Debug.assert(node.kind === 67 || node.kind === 8 || node.kind === 9); return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); } function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { @@ -37583,10 +38639,10 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 94) { + if (node.kind === 95) { return getReferencesForThisKeyword(node, sourceFiles); } - if (node.kind === 92) { + if (node.kind === 93) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); @@ -37637,7 +38693,7 @@ var ts; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 223 || declaration.kind === 227; + return declaration.kind === 224 || declaration.kind === 228; }); } function getInternedName(symbol, location, declarations) { @@ -37650,13 +38706,13 @@ var ts; } function getSymbolScope(symbol) { var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 170 || valueDeclaration.kind === 183)) { + if (valueDeclaration && (valueDeclaration.kind === 171 || valueDeclaration.kind === 184)) { return valueDeclaration; } if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 211); + return ts.getAncestor(privateDeclaration, 212); } } if (symbol.flags & 8388608) { @@ -37677,7 +38733,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 245 && !ts.isExternalModule(container)) { + if (container.kind === 246 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -37736,15 +38792,15 @@ var ts; function isValidReferencePosition(node, searchSymbolName) { if (node) { switch (node.kind) { - case 66: + case 67: return node.getWidth() === searchSymbolName.length; - case 8: + case 9: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; - case 7: + case 8: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { return node.getWidth() === searchSymbolName.length; } @@ -37763,8 +38819,8 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || - (findInComments && isInComment(position))) { + if ((findInStrings && ts.isInString(sourceFile, position)) || + (findInComments && isInNonReferenceComment(sourceFile, position))) { result.push({ definition: undefined, references: [{ @@ -37809,24 +38865,12 @@ var ts; } return result[index]; } - 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; - } - } - }); + function isInNonReferenceComment(sourceFile, position) { + return ts.isInCommentHelper(sourceFile, position, isNonReferenceComment); + function isNonReferenceComment(c) { + var commentText = sourceFile.text.substring(c.pos, c.end); + return !tripleSlashDirectivePrefixRegex.test(commentText); } - return false; } } function getReferencesForSuperKeyword(superKeyword) { @@ -37836,13 +38880,13 @@ var ts; } var staticFlag = 128; switch (searchSpaceNode.kind) { - case 138: - case 137: - case 140: case 139: + case 138: case 141: + case 140: case 142: case 143: + case 144: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -37855,7 +38899,7 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 92) { + if (!node || node.kind !== 93) { return; } var container = ts.getSuperContainer(node, false); @@ -37870,32 +38914,32 @@ var ts; var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 128; switch (searchSpaceNode.kind) { + case 141: case 140: - case 139: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } + case 139: case 138: - case 137: - case 141: case 142: case 143: + case 144: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 245: + case 246: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 210: - case 170: + case 211: + case 171: break; default: return undefined; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 245) { + if (searchSpaceNode.kind === 246) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -37921,30 +38965,30 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 94) { + if (!node || node.kind !== 95) { return; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 170: - case 210: + case 171: + case 211: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; + case 141: case 140: - case 139: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 211: + case 212: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 245: - if (container.kind === 245 && !ts.isExternalModule(container)) { + case 246: + if (container.kind === 246 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -37979,11 +39023,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 211) { + if (declaration.kind === 212) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 212) { + else if (declaration.kind === 213) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -38081,7 +39125,7 @@ var ts; function getReferenceEntryFromNode(node) { var start = node.getStart(); var end = node.getEnd(); - if (node.kind === 8) { + if (node.kind === 9) { start += 1; end -= 1; } @@ -38092,17 +39136,17 @@ var ts; }; } function isWriteAccess(node) { - if (node.kind === 66 && ts.isDeclarationName(node)) { + if (node.kind === 67 && ts.isDeclarationName(node)) { return true; } var parent = node.parent; if (parent) { - if (parent.kind === 177 || parent.kind === 176) { + if (parent.kind === 178 || parent.kind === 177) { return true; } - else if (parent.kind === 178 && parent.left === node) { + else if (parent.kind === 179 && parent.left === node) { var operator = parent.operatorToken.kind; - return 54 <= operator && operator <= 65; + return 55 <= operator && operator <= 66; } } return false; @@ -38133,34 +39177,34 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 135: - case 208: - case 160: + case 136: + case 209: + case 161: + case 139: case 138: - case 137: - case 242: case 243: case 244: - case 140: - case 139: + case 245: case 141: + case 140: case 142: case 143: - case 210: - case 170: + case 144: + case 211: case 171: - case 241: + case 172: + case 242: return 1; - case 134: - case 212: + case 135: case 213: - case 152: - return 2; - case 211: case 214: - return 1 | 2; + case 153: + return 2; + case 212: case 215: - if (node.name.kind === 8) { + return 1 | 2; + case 216: + if (node.name.kind === 9) { return 4 | 1; } else if (ts.getModuleInstanceState(node) === 1) { @@ -38169,14 +39213,14 @@ var ts; else { return 4; } - case 222: case 223: - case 218: - case 219: case 224: + case 219: + case 220: case 225: + case 226: return 1 | 2 | 4; - case 245: + case 246: return 4 | 1; } return 1 | 2 | 4; @@ -38186,8 +39230,8 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 148 || - (node.parent.kind === 185 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); + return node.parent.kind === 149 || + (node.parent.kind === 186 && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -38195,47 +39239,47 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 163) { - while (root.parent && root.parent.kind === 163) { + if (root.parent.kind === 164) { + while (root.parent && root.parent.kind === 164) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 185 && root.parent.parent.kind === 240) { + if (!isLastClause && root.parent.kind === 186 && root.parent.parent.kind === 241) { var decl = root.parent.parent.parent; - return (decl.kind === 211 && root.parent.parent.token === 103) || - (decl.kind === 212 && root.parent.parent.token === 80); + return (decl.kind === 212 && root.parent.parent.token === 104) || + (decl.kind === 213 && root.parent.parent.token === 81); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 132) { - while (root.parent && root.parent.kind === 132) { + if (root.parent.kind === 133) { + while (root.parent && root.parent.kind === 133) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 148 && !isLastClause; + return root.parent.kind === 149 && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 132) { + while (node.parent.kind === 133) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { - ts.Debug.assert(node.kind === 66); - if (node.parent.kind === 132 && + ts.Debug.assert(node.kind === 67); + if (node.parent.kind === 133 && node.parent.right === node && - node.parent.parent.kind === 218) { + node.parent.parent.kind === 219) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 224) { + if (node.parent.kind === 225) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -38269,15 +39313,15 @@ var ts; return; } switch (node.kind) { - case 163: - case 132: - case 8: - case 81: - case 96: - case 90: - case 92: - case 94: - case 66: + case 164: + case 133: + case 9: + case 82: + case 97: + case 91: + case 93: + case 95: + case 67: break; default: return; @@ -38288,7 +39332,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 215 && + if (nodeForStartPos.parent.parent.kind === 216 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -38315,10 +39359,10 @@ var ts; } function checkForClassificationCancellation(kind) { switch (kind) { - case 215: - case 211: + case 216: case 212: - case 210: + case 213: + case 211: cancellationToken.throwIfCancellationRequested(); } } @@ -38366,7 +39410,7 @@ var ts; return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 215 && + return declaration.kind === 216 && ts.getModuleInstanceState(declaration) === 1; }); } @@ -38375,7 +39419,7 @@ var ts; if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { var kind = node.kind; checkForClassificationCancellation(kind); - if (kind === 66 && !ts.nodeIsMissing(node)) { + if (kind === 67 && !ts.nodeIsMissing(node)) { var identifier = node; if (classifiableNames[identifier.text]) { var symbol = typeChecker.getSymbolAtLocation(node); @@ -38462,7 +39506,7 @@ var ts; triviaScanner.setTextPos(end); continue; } - if (kind === 6) { + if (kind === 7) { var text = sourceFile.text; var ch = text.charCodeAt(start); if (ch === 60 || ch === 62) { @@ -38499,16 +39543,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 264: + case 265: processJSDocParameterTag(tag); break; - case 267: + case 268: processJSDocTemplateTag(tag); break; - case 266: + case 267: processElement(tag.typeExpression); break; - case 265: + case 266: processElement(tag.typeExpression); break; } @@ -38581,70 +39625,70 @@ var ts; if (ts.isKeyword(tokenKind)) { return 3; } - if (tokenKind === 24 || tokenKind === 26) { + if (tokenKind === 25 || tokenKind === 27) { if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { return 10; } } if (ts.isPunctuation(tokenKind)) { if (token) { - if (tokenKind === 54) { - if (token.parent.kind === 208 || - token.parent.kind === 138 || - token.parent.kind === 135) { + if (tokenKind === 55) { + if (token.parent.kind === 209 || + token.parent.kind === 139 || + token.parent.kind === 136) { return 5; } } - if (token.parent.kind === 178 || - token.parent.kind === 176 || + if (token.parent.kind === 179 || token.parent.kind === 177 || - token.parent.kind === 179) { + token.parent.kind === 178 || + token.parent.kind === 180) { return 5; } } return 10; } - else if (tokenKind === 7) { + else if (tokenKind === 8) { return 4; } - else if (tokenKind === 8) { + else if (tokenKind === 9) { return 6; } - else if (tokenKind === 9) { + else if (tokenKind === 10) { return 6; } else if (ts.isTemplateLiteralKind(tokenKind)) { return 6; } - else if (tokenKind === 66) { + else if (tokenKind === 67) { if (token) { switch (token.parent.kind) { - case 211: + case 212: if (token.parent.name === token) { return 11; } return; - case 134: + case 135: if (token.parent.name === token) { return 15; } return; - case 212: + case 213: if (token.parent.name === token) { return 13; } return; - case 214: + case 215: if (token.parent.name === token) { return 12; } return; - case 215: + case 216: if (token.parent.name === token) { return 14; } return; - case 135: + case 136: if (token.parent.name === token) { return 17; } @@ -38705,14 +39749,14 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14: return 15; - case 16: return 17; - case 18: return 19; - case 24: return 26; - case 15: return 14; - case 17: return 16; - case 19: return 18; - case 26: return 24; + case 15: return 16; + case 17: return 18; + case 19: return 20; + case 25: return 27; + case 16: return 15; + case 18: return 17; + case 20: return 19; + case 27: return 25; } return undefined; } @@ -38747,6 +39791,38 @@ var ts; } return []; } + function getDocCommentTemplateAtPosition(fileName, position) { + var start = new Date().getTime(); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { + return undefined; + } + var tokenAtPos = ts.getTokenAtPosition(sourceFile, position); + var tokenStart = tokenAtPos.getStart(); + if (!tokenAtPos || tokenStart < position) { + return undefined; + } + var containingFunction = ts.getAncestor(tokenAtPos, 211); + if (!containingFunction || containingFunction.getStart() < position) { + return undefined; + } + var parameters = containingFunction.parameters; + var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); + var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; + var docParams = parameters.reduce(function (prev, cur, index) { + return prev + + indentationStr + " * @param " + (cur.name.kind === 67 ? cur.name.text : "param" + index) + newLine; + }, ""); + var preamble = "/**" + newLine + + indentationStr + " * "; + var result = preamble + newLine + + docParams + + indentationStr + " */" + + (tokenStart === position ? newLine + indentationStr : ""); + return { newText: result, caretOffset: preamble.length }; + } function getTodoComments(fileName, descriptors) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -38813,7 +39889,7 @@ var ts; var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); var node = ts.getTouchingWord(sourceFile, position); - if (node && node.kind === 66) { + if (node && node.kind === 67) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var declarations = symbol.getDeclarations(); @@ -38891,6 +39967,7 @@ var ts; getFormattingEditsForRange: getFormattingEditsForRange, getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, + getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, getEmitOutput: getEmitOutput, getSourceFile: getSourceFile, getProgram: getProgram @@ -38910,13 +39987,13 @@ var ts; sourceFile.nameTable = nameTable; function walk(node) { switch (node.kind) { - case 66: + case 67: nameTable[node.text] = node.text; break; + case 9: case 8: - case 7: if (ts.isDeclarationName(node) || - node.parent.kind === 229 || + node.parent.kind === 230 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -38929,31 +40006,31 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 164 && + node.parent.kind === 165 && node.parent.argumentExpression === node; } function createClassifier() { var scanner = ts.createScanner(2, false); var noRegexTable = []; - noRegexTable[66] = true; - noRegexTable[8] = true; - noRegexTable[7] = true; + noRegexTable[67] = true; noRegexTable[9] = true; - noRegexTable[94] = true; - noRegexTable[39] = true; + noRegexTable[8] = true; + noRegexTable[10] = true; + noRegexTable[95] = true; noRegexTable[40] = true; - noRegexTable[17] = true; - noRegexTable[19] = true; - noRegexTable[15] = true; - noRegexTable[96] = true; - noRegexTable[81] = true; + noRegexTable[41] = true; + noRegexTable[18] = true; + noRegexTable[20] = true; + noRegexTable[16] = true; + noRegexTable[97] = true; + noRegexTable[82] = true; var templateStack = []; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { - if (keyword2 === 120 || - keyword2 === 126 || - keyword2 === 118 || - keyword2 === 110) { + if (keyword2 === 121 || + keyword2 === 127 || + keyword2 === 119 || + keyword2 === 111) { return true; } return false; @@ -38966,7 +40043,7 @@ var ts; var lastEnd = 0; for (var i = 0, n = dense.length; i < n; i += 3) { var start = dense[i]; - var length_2 = dense[i + 1]; + var length_3 = dense[i + 1]; var type = dense[i + 2]; if (lastEnd >= 0) { var whitespaceLength_1 = start - lastEnd; @@ -38974,8 +40051,8 @@ var ts; entries.push({ length: whitespaceLength_1, classification: TokenClass.Whitespace }); } } - entries.push({ length: length_2, classification: convertClassification(type) }); - lastEnd = start + length_2; + entries.push({ length: length_3, classification: convertClassification(type) }); + lastEnd = start + length_3; } var whitespaceLength = text.length - lastEnd; if (whitespaceLength > 0) { @@ -39036,7 +40113,7 @@ var ts; text = "}\n" + text; offset = 2; case 6: - templateStack.push(11); + templateStack.push(12); break; } scanner.setText(text); @@ -39048,55 +40125,55 @@ var ts; do { token = scanner.scan(); if (!ts.isTrivia(token)) { - if ((token === 37 || token === 58) && !noRegexTable[lastNonTriviaToken]) { - if (scanner.reScanSlashToken() === 9) { - token = 9; + if ((token === 38 || token === 59) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === 10) { + token = 10; } } - else if (lastNonTriviaToken === 20 && isKeyword(token)) { - token = 66; + else if (lastNonTriviaToken === 21 && isKeyword(token)) { + token = 67; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { - token = 66; + token = 67; } - else if (lastNonTriviaToken === 66 && - token === 24) { + else if (lastNonTriviaToken === 67 && + token === 25) { angleBracketStack++; } - else if (token === 26 && angleBracketStack > 0) { + else if (token === 27 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 114 || - token === 127 || - token === 125 || - token === 117 || - token === 128) { + else if (token === 115 || + token === 128 || + token === 126 || + token === 118 || + token === 129) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { - token = 66; + token = 67; } } - else if (token === 11) { + else if (token === 12) { templateStack.push(token); } - else if (token === 14) { + else if (token === 15) { if (templateStack.length > 0) { templateStack.push(token); } } - else if (token === 15) { + else if (token === 16) { if (templateStack.length > 0) { var lastTemplateStackToken = ts.lastOrUndefined(templateStack); - if (lastTemplateStackToken === 11) { + if (lastTemplateStackToken === 12) { token = scanner.reScanTemplateToken(); - if (token === 13) { + if (token === 14) { templateStack.pop(); } else { - ts.Debug.assert(token === 12, "Should have been a template middle. Was " + token); + ts.Debug.assert(token === 13, "Should have been a template middle. Was " + token); } } else { - ts.Debug.assert(lastTemplateStackToken === 14, "Should have been an open brace. Was: " + token); + ts.Debug.assert(lastTemplateStackToken === 15, "Should have been an open brace. Was: " + token); templateStack.pop(); } } @@ -39111,7 +40188,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 8) { + if (token === 9) { var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { var lastCharIndex = tokenText.length - 1; @@ -39134,10 +40211,10 @@ var ts; } else if (ts.isTemplateLiteralKind(token)) { if (scanner.isUnterminated()) { - if (token === 13) { + if (token === 14) { result.endOfLineState = 5; } - else if (token === 10) { + else if (token === 11) { result.endOfLineState = 4; } else { @@ -39145,7 +40222,7 @@ var ts; } } } - else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11) { + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 12) { result.endOfLineState = 6; } } @@ -39169,42 +40246,42 @@ var ts; } function isBinaryExpressionOperatorToken(token) { switch (token) { - case 36: case 37: case 38: - case 34: + case 39: case 35: - case 41: + case 36: case 42: case 43: - case 24: - case 26: + case 44: + case 25: case 27: case 28: - case 88: - case 87: case 29: + case 89: + case 88: case 30: case 31: case 32: - case 44: - case 46: + case 33: case 45: - case 49: + case 47: + case 46: case 50: - case 64: - case 63: + case 51: case 65: - case 60: + case 64: + case 66: case 61: case 62: - case 55: + case 63: case 56: case 57: case 58: case 59: - case 54: - case 23: + case 60: + case 55: + case 24: return true; default: return false; @@ -39212,19 +40289,19 @@ var ts; } function isPrefixUnaryExpressionOperatorToken(token) { switch (token) { - case 34: case 35: + case 36: + case 49: case 48: - case 47: - case 39: case 40: + case 41: return true; default: return false; } } function isKeyword(token) { - return token >= 67 && token <= 131; + return token >= 68 && token <= 132; } function classFromKind(token) { if (isKeyword(token)) { @@ -39233,24 +40310,24 @@ var ts; else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5; } - else if (token >= 14 && token <= 65) { + else if (token >= 15 && token <= 66) { return 10; } switch (token) { - case 7: - return 4; case 8: - return 6; + return 4; case 9: + return 6; + case 10: return 7; - case 6: + case 7: case 3: case 2: return 1; case 5: case 4: return 8; - case 66: + case 67: default: if (ts.isTemplateLiteralKind(token)) { return 6; @@ -39276,7 +40353,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 245 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 246 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = -1; proto.end = -1; @@ -39366,9 +40443,11 @@ var ts; CommandNames.Format = "format"; CommandNames.Formatonkey = "formatonkey"; CommandNames.Geterr = "geterr"; + CommandNames.GeterrForProject = "geterrForProject"; CommandNames.NavBar = "navbar"; CommandNames.Navto = "navto"; CommandNames.Occurrences = "occurrences"; + CommandNames.DocumentHighlights = "documentHighlights"; CommandNames.Open = "open"; CommandNames.Quickinfo = "quickinfo"; CommandNames.References = "references"; @@ -39378,6 +40457,7 @@ var ts; CommandNames.SignatureHelp = "signatureHelp"; CommandNames.TypeDefinition = "typeDefinition"; CommandNames.ProjectInfo = "projectInfo"; + CommandNames.ReloadProjects = "reloadProjects"; CommandNames.Unknown = "unknown"; })(CommandNames = server.CommandNames || (server.CommandNames = {})); var Errors; @@ -39398,57 +40478,61 @@ var ts; this.handlers = (_a = {}, _a[CommandNames.Exit] = function () { _this.exit(); - return {}; + return { responseRequired: false }; }, _a[CommandNames.Definition] = function (request) { var defArgs = request.arguments; - return { response: _this.getDefinition(defArgs.line, defArgs.offset, defArgs.file) }; + return { response: _this.getDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; }, _a[CommandNames.TypeDefinition] = function (request) { var defArgs = request.arguments; - return { response: _this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file) }; + return { response: _this.getTypeDefinition(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; }, _a[CommandNames.References] = function (request) { var defArgs = request.arguments; - return { response: _this.getReferences(defArgs.line, defArgs.offset, defArgs.file) }; + return { response: _this.getReferences(defArgs.line, defArgs.offset, defArgs.file), responseRequired: true }; }, _a[CommandNames.Rename] = function (request) { var renameArgs = request.arguments; - return { response: _this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings) }; + return { response: _this.getRenameLocations(renameArgs.line, renameArgs.offset, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings), responseRequired: true }; }, _a[CommandNames.Open] = function (request) { var openArgs = request.arguments; _this.openClientFile(openArgs.file); - return {}; + return { responseRequired: false }; }, _a[CommandNames.Quickinfo] = function (request) { var quickinfoArgs = request.arguments; - return { response: _this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file) }; + return { response: _this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.offset, quickinfoArgs.file), responseRequired: true }; }, _a[CommandNames.Format] = function (request) { var formatArgs = request.arguments; - return { response: _this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file) }; + return { response: _this.getFormattingEditsForRange(formatArgs.line, formatArgs.offset, formatArgs.endLine, formatArgs.endOffset, formatArgs.file), responseRequired: true }; }, _a[CommandNames.Formatonkey] = function (request) { var formatOnKeyArgs = request.arguments; - return { response: _this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file) }; + return { response: _this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.offset, formatOnKeyArgs.key, formatOnKeyArgs.file), responseRequired: true }; }, _a[CommandNames.Completions] = function (request) { var completionsArgs = request.arguments; - return { response: _this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file) }; + return { response: _this.getCompletions(completionsArgs.line, completionsArgs.offset, completionsArgs.prefix, completionsArgs.file), responseRequired: true }; }, _a[CommandNames.CompletionDetails] = function (request) { var completionDetailsArgs = request.arguments; - return { response: _this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, completionDetailsArgs.entryNames, completionDetailsArgs.file) }; + return { response: _this.getCompletionEntryDetails(completionDetailsArgs.line, completionDetailsArgs.offset, completionDetailsArgs.entryNames, completionDetailsArgs.file), responseRequired: true }; }, _a[CommandNames.SignatureHelp] = function (request) { var signatureHelpArgs = request.arguments; - return { response: _this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file) }; + return { response: _this.getSignatureHelpItems(signatureHelpArgs.line, signatureHelpArgs.offset, signatureHelpArgs.file), responseRequired: true }; }, _a[CommandNames.Geterr] = function (request) { var geterrArgs = request.arguments; return { response: _this.getDiagnostics(geterrArgs.delay, geterrArgs.files), responseRequired: false }; }, + _a[CommandNames.GeterrForProject] = function (request) { + var _a = request.arguments, file = _a.file, delay = _a.delay; + return { response: _this.getDiagnosticsForProject(delay, file), responseRequired: false }; + }, _a[CommandNames.Change] = function (request) { var changeArgs = request.arguments; _this.change(changeArgs.line, changeArgs.offset, changeArgs.endLine, changeArgs.endOffset, changeArgs.insertString, changeArgs.file); @@ -39477,23 +40561,31 @@ var ts; }, _a[CommandNames.Navto] = function (request) { var navtoArgs = request.arguments; - return { response: _this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount) }; + return { response: _this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount), responseRequired: true }; }, _a[CommandNames.Brace] = function (request) { var braceArguments = request.arguments; - return { response: _this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file) }; + return { response: _this.getBraceMatching(braceArguments.line, braceArguments.offset, braceArguments.file), responseRequired: true }; }, _a[CommandNames.NavBar] = function (request) { var navBarArgs = request.arguments; - return { response: _this.getNavigationBarItems(navBarArgs.file) }; + return { response: _this.getNavigationBarItems(navBarArgs.file), responseRequired: true }; }, _a[CommandNames.Occurrences] = function (request) { var _a = request.arguments, line = _a.line, offset = _a.offset, fileName = _a.file; - return { response: _this.getOccurrences(line, offset, fileName) }; + return { response: _this.getOccurrences(line, offset, fileName), responseRequired: true }; + }, + _a[CommandNames.DocumentHighlights] = function (request) { + var _a = request.arguments, line = _a.line, offset = _a.offset, fileName = _a.file, filesToSearch = _a.filesToSearch; + return { response: _this.getDocumentHighlights(line, offset, fileName, filesToSearch), responseRequired: true }; }, _a[CommandNames.ProjectInfo] = function (request) { var _a = request.arguments, file = _a.file, needFileNameList = _a.needFileNameList; - return { response: _this.getProjectInfo(file, needFileNameList) }; + return { response: _this.getProjectInfo(file, needFileNameList), responseRequired: true }; + }, + _a[CommandNames.ReloadProjects] = function (request) { + _this.reloadProjects(); + return { responseRequired: false }; }, _a ); @@ -39590,6 +40682,9 @@ var ts; this.syntacticCheck(file, project); this.semanticCheck(file, project); }; + Session.prototype.reloadProjects = function () { + this.projectService.reloadProjects(); + }; Session.prototype.updateProjectStructure = function (seq, matchSeq, ms) { var _this = this; if (ms === void 0) { ms = 1500; } @@ -39599,10 +40694,11 @@ var ts; } }, ms); }; - Session.prototype.updateErrorCheck = function (checkList, seq, matchSeq, ms, followMs) { + Session.prototype.updateErrorCheck = function (checkList, seq, matchSeq, ms, followMs, requireOpen) { var _this = this; if (ms === void 0) { ms = 1500; } if (followMs === void 0) { followMs = 200; } + if (requireOpen === void 0) { requireOpen = true; } if (followMs > ms) { followMs = ms; } @@ -39617,7 +40713,7 @@ var ts; var checkOne = function () { if (matchSeq(seq)) { var checkSpec = checkList[index++]; - if (checkSpec.project.getSourceFileFromName(checkSpec.fileName, true)) { + if (checkSpec.project.getSourceFileFromName(checkSpec.fileName, requireOpen)) { _this.syntacticCheck(checkSpec.fileName, checkSpec.project); _this.immediateId = setImmediate(function () { _this.semanticCheck(checkSpec.fileName, checkSpec.project); @@ -39696,6 +40792,33 @@ var ts; }; }); }; + Session.prototype.getDocumentHighlights = function (line, offset, fileName, filesToSearch) { + fileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(fileName); + if (!project) { + throw Errors.NoProject; + } + var compilerService = project.compilerService; + var position = compilerService.host.lineOffsetToPosition(fileName, line, offset); + var documentHighlights = compilerService.languageService.getDocumentHighlights(fileName, position, filesToSearch); + if (!documentHighlights) { + return undefined; + } + return documentHighlights.map(convertToDocumentHighlightsItem); + function convertToDocumentHighlightsItem(documentHighlights) { + var fileName = documentHighlights.fileName, highlightSpans = documentHighlights.highlightSpans; + return { + file: fileName, + highlightSpans: highlightSpans.map(convertHighlightSpan) + }; + function convertHighlightSpan(highlightSpan) { + var textSpan = highlightSpan.textSpan, kind = highlightSpan.kind; + var start = compilerService.host.positionToLineOffset(fileName, textSpan.start); + var end = compilerService.host.positionToLineOffset(fileName, ts.textSpanEnd(textSpan)); + return { start: start, end: end, kind: kind }; + } + } + }; Session.prototype.getProjectInfo = function (fileName, needFileNameList) { fileName = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(fileName); @@ -39703,7 +40826,7 @@ var ts; configFileName: project.projectFilename }; if (needFileNameList) { - projectInfo.fileNameList = project.getFileNameList(); + projectInfo.fileNames = project.getFileNames(); } return projectInfo; }; @@ -40116,6 +41239,45 @@ var ts; end: compilerService.host.positionToLineOffset(file, span.start + span.length) }); }); }; + Session.prototype.getDiagnosticsForProject = function (delay, fileName) { + var _this = this; + var _a = this.getProjectInfo(fileName, true), configFileName = _a.configFileName, fileNamesInProject = _a.fileNames; + fileNamesInProject = fileNamesInProject.filter(function (value, index, array) { return value.indexOf("lib.d.ts") < 0; }); + var highPriorityFiles = []; + var mediumPriorityFiles = []; + var lowPriorityFiles = []; + var veryLowPriorityFiles = []; + var normalizedFileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(normalizedFileName); + for (var _i = 0; _i < fileNamesInProject.length; _i++) { + var fileNameInProject = fileNamesInProject[_i]; + if (this.getCanonicalFileName(fileNameInProject) == this.getCanonicalFileName(fileName)) + highPriorityFiles.push(fileNameInProject); + else { + var info = this.projectService.getScriptInfo(fileNameInProject); + if (!info.isOpen) { + if (fileNameInProject.indexOf(".d.ts") > 0) + veryLowPriorityFiles.push(fileNameInProject); + else + lowPriorityFiles.push(fileNameInProject); + } + else + mediumPriorityFiles.push(fileNameInProject); + } + } + fileNamesInProject = highPriorityFiles.concat(mediumPriorityFiles).concat(lowPriorityFiles).concat(veryLowPriorityFiles); + if (fileNamesInProject.length > 0) { + var checkList = fileNamesInProject.map(function (fileName) { + var normalizedFileName = ts.normalizePath(fileName); + return { fileName: normalizedFileName, project: project }; + }); + this.updateErrorCheck(checkList, this.changeSeq, function (n) { return n == _this.changeSeq; }, delay, 200, false); + } + }; + Session.prototype.getCanonicalFileName = function (fileName) { + var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + return ts.normalizePath(name); + }; Session.prototype.exit = function () { }; Session.prototype.addProtocolHandler = function (command, handler) { @@ -40238,12 +41400,52 @@ var ts; server.ScriptInfo = ScriptInfo; var LSHost = (function () { function LSHost(host, project) { + var _this = this; this.host = host; this.project = project; this.ls = null; this.filenameToScript = {}; this.roots = []; + this.resolvedModuleNames = ts.createFileMap(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)); + this.moduleResolutionHost = { + fileExists: function (fileName) { return _this.fileExists(fileName); }, + readFile: function (fileName) { return _this.host.readFile(fileName); } + }; } + LSHost.prototype.resolveModuleNames = function (moduleNames, containingFile) { + var currentResolutionsInFile = this.resolvedModuleNames.get(containingFile); + var newResolutions = {}; + var resolvedFileNames = []; + var compilerOptions = this.getCompilationSettings(); + for (var _i = 0; _i < moduleNames.length; _i++) { + var moduleName = moduleNames[_i]; + var resolution = ts.lookUp(newResolutions, moduleName); + if (!resolution) { + var existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName); + if (moduleResolutionIsValid(existingResolution)) { + resolution = existingResolution; + } + else { + resolution = ts.resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost); + resolution.lastCheckTime = Date.now(); + newResolutions[moduleName] = resolution; + } + } + ts.Debug.assert(resolution !== undefined); + resolvedFileNames.push(resolution.resolvedFileName); + } + this.resolvedModuleNames.set(containingFile, newResolutions); + return resolvedFileNames; + function moduleResolutionIsValid(resolution) { + if (!resolution) { + return false; + } + if (resolution.resolvedFileName) { + return true; + } + return resolution.failedLookupLocations.length === 0; + } + }; LSHost.prototype.getDefaultLibFileName = function () { var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); @@ -40256,6 +41458,7 @@ var ts; }; LSHost.prototype.setCompilationSettings = function (opt) { this.compilationSettings = opt; + this.resolvedModuleNames.clear(); }; LSHost.prototype.lineAffectsRefs = function (filename, line) { var info = this.getScriptInfo(filename); @@ -40283,6 +41486,7 @@ var ts; LSHost.prototype.removeReferencedFile = function (info) { if (!info.isOpen) { this.filenameToScript[info.fileName] = undefined; + this.resolvedModuleNames.remove(info.fileName); } }; LSHost.prototype.getScriptInfo = function (filename) { @@ -40304,6 +41508,13 @@ var ts; this.roots.push(info); } }; + LSHost.prototype.removeRoot = function (info) { + var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); + if (scriptInfo) { + this.filenameToScript[info.fileName] = undefined; + this.roots = copyListRemovingItem(info, this.roots); + } + }; LSHost.prototype.saveTo = function (filename, tmpfilename) { var script = this.getScriptInfo(filename); if (script) { @@ -40410,7 +41621,7 @@ var ts; Project.prototype.openReferencedFile = function (filename) { return this.projectService.openFile(filename, false); }; - Project.prototype.getFileNameList = function () { + Project.prototype.getFileNames = function () { var sourceFiles = this.program.getSourceFiles(); return sourceFiles.map(function (sourceFile) { return sourceFile.fileName; }); }; @@ -40455,6 +41666,10 @@ var ts; info.defaultProject = this; this.compilerService.host.addRoot(info); }; + Project.prototype.removeRoot = function (info) { + info.defaultProject = undefined; + this.compilerService.host.removeRoot(info); + }; Project.prototype.filesToString = function () { var strBuilder = ""; ts.forEachValue(this.filenameToSourceFile, function (sourceFile) { strBuilder += sourceFile.fileName + "\n"; }); @@ -40520,6 +41735,11 @@ var ts; } } }; + ProjectService.prototype.watchedProjectConfigFileChanged = function (project) { + this.log("Config File Changed: " + project.projectFilename); + this.updateConfiguredProject(project); + this.updateProjectStructure(); + }; ProjectService.prototype.log = function (msg, type) { if (type === void 0) { type = "Err"; } this.psLogger.msg(msg, type); @@ -40589,6 +41809,18 @@ var ts; } this.configuredProjects = configuredProjects; }; + ProjectService.prototype.removeConfiguredProject = function (project) { + project.projectFileWatcher.close(); + this.configuredProjects = copyListRemovingItem(project, this.configuredProjects); + var fileNames = project.getFileNames(); + for (var _i = 0; _i < fileNames.length; _i++) { + var fileName = fileNames[_i]; + var info = this.getScriptInfo(fileName); + if (info.defaultProject == project) { + info.defaultProject = undefined; + } + } + }; ProjectService.prototype.setConfiguredProjectRoot = function (info) { for (var i = 0, len = this.configuredProjects.length; i < len; i++) { var configuredProject = this.configuredProjects[i]; @@ -40707,11 +41939,31 @@ var ts; } return referencingProjects; }; + ProjectService.prototype.reloadProjects = function () { + for (var _i = 0, _a = this.openFileRoots; _i < _a.length; _i++) { + var info = _a[_i]; + this.openOrUpdateConfiguredProjectForFile(info.fileName); + } + this.updateProjectStructure(); + }; ProjectService.prototype.updateProjectStructure = function () { this.log("updating project structure from ...", "Info"); this.printProjects(); - var openFilesReferenced = []; var unattachedOpenFiles = []; + var openFileRootsConfigured = []; + for (var _i = 0, _a = this.openFileRootsConfigured; _i < _a.length; _i++) { + var info = _a[_i]; + var project = info.defaultProject; + if (!project || !(project.getSourceFile(info))) { + info.defaultProject = undefined; + unattachedOpenFiles.push(info); + } + else { + openFileRootsConfigured.push(info); + } + } + this.openFileRootsConfigured = openFileRootsConfigured; + var openFilesReferenced = []; for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { var referencedFile = this.openFilesReferenced[i]; referencedFile.defaultProject.updateGraph(); @@ -40794,32 +42046,36 @@ var ts; return undefined; }; ProjectService.prototype.openClientFile = function (fileName) { + this.openOrUpdateConfiguredProjectForFile(fileName); + var info = this.openFile(fileName, true); + this.addOpenFile(info); + this.printProjects(); + return info; + }; + ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName) { var searchPath = ts.normalizePath(ts.getDirectoryPath(fileName)); this.log("Search path: " + searchPath, "Info"); var configFileName = this.findConfigFile(searchPath); if (configFileName) { this.log("Config file name: " + configFileName, "Info"); - } - else { - this.log("no config file"); - } - if (configFileName) { - configFileName = getAbsolutePath(configFileName, searchPath); - } - if (configFileName && (!this.configProjectIsActive(configFileName))) { - var configResult = this.openConfigFile(configFileName, fileName); - if (!configResult.success) { - this.log("Error opening config file " + configFileName + " " + configResult.errorMsg); + var project = this.findConfiguredProjectByConfigFile(configFileName); + if (!project) { + var configResult = this.openConfigFile(configFileName, fileName); + if (!configResult.success) { + this.log("Error opening config file " + configFileName + " " + configResult.errorMsg); + } + else { + this.log("Opened configuration file " + configFileName, "Info"); + this.configuredProjects.push(configResult.project); + } } else { - this.log("Opened configuration file " + configFileName, "Info"); - this.configuredProjects.push(configResult.project); + this.updateConfiguredProject(project); } } - var info = this.openFile(fileName, true); - this.addOpenFile(info); - this.printProjects(); - return info; + else { + this.log("No config files found."); + } }; ProjectService.prototype.closeClientFile = function (filename) { var info = ts.lookUp(this.filenameToScriptInfo, filename); @@ -40888,46 +42144,103 @@ var ts; this.psLogger.endGroup(); }; ProjectService.prototype.configProjectIsActive = function (fileName) { + return this.findConfiguredProjectByConfigFile(fileName) === undefined; + }; + ProjectService.prototype.findConfiguredProjectByConfigFile = function (configFileName) { for (var i = 0, len = this.configuredProjects.length; i < len; i++) { - if (this.configuredProjects[i].projectFilename == fileName) { - return true; + if (this.configuredProjects[i].projectFilename == configFileName) { + return this.configuredProjects[i]; } } - return false; + return undefined; }; - ProjectService.prototype.openConfigFile = function (configFilename, clientFileName) { + ProjectService.prototype.configFileToProjectOptions = function (configFilename) { configFilename = ts.normalizePath(configFilename); var dirPath = ts.getDirectoryPath(configFilename); - var rawConfig = ts.readConfigFile(configFilename); + var contents = this.host.readFile(configFilename); + var rawConfig = ts.parseConfigFileText(configFilename, contents); if (rawConfig.error) { - return rawConfig.error; + return { succeeded: false, error: rawConfig.error }; } else { var parsedCommandLine = ts.parseConfigFile(rawConfig.config, this.host, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { - return { errorMsg: "tsconfig option errors" }; + return { succeeded: false, error: { errorMsg: "tsconfig option errors" } }; + } + else if (parsedCommandLine.fileNames == null) { + return { succeeded: false, error: { errorMsg: "no files found" } }; } - else if (parsedCommandLine.fileNames) { + else { var projectOptions = { files: parsedCommandLine.fileNames, compilerOptions: parsedCommandLine.options }; - var proj = this.createProject(configFilename, projectOptions); - for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) { - var rootFilename = parsedCommandLine.fileNames[i]; - if (this.host.fileExists(rootFilename)) { - var info = this.openFile(rootFilename, clientFileName == rootFilename); - proj.addRoot(info); + return { succeeded: true, projectOptions: projectOptions }; + } + } + }; + ProjectService.prototype.openConfigFile = function (configFilename, clientFileName) { + var _this = this; + var _a = this.configFileToProjectOptions(configFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; + if (!succeeded) { + return error; + } + else { + var proj = this.createProject(configFilename, projectOptions); + for (var i = 0, len = projectOptions.files.length; i < len; i++) { + var rootFilename = projectOptions.files[i]; + if (this.host.fileExists(rootFilename)) { + var info = this.openFile(rootFilename, clientFileName == rootFilename); + proj.addRoot(info); + } + else { + return { errorMsg: "specified file " + rootFilename + " not found" }; + } + } + proj.finishGraph(); + proj.projectFileWatcher = this.host.watchFile(configFilename, function (_) { return _this.watchedProjectConfigFileChanged(proj); }); + return { success: true, project: proj }; + } + }; + ProjectService.prototype.updateConfiguredProject = function (project) { + if (!this.host.fileExists(project.projectFilename)) { + this.log("Config file deleted"); + this.removeConfiguredProject(project); + } + else { + var _a = this.configFileToProjectOptions(project.projectFilename), succeeded = _a.succeeded, projectOptions = _a.projectOptions, error = _a.error; + if (!succeeded) { + return error; + } + else { + var oldFileNames = project.compilerService.host.roots.map(function (info) { return info.fileName; }); + var newFileNames = projectOptions.files; + var fileNamesToRemove = oldFileNames.filter(function (f) { return newFileNames.indexOf(f) < 0; }); + var fileNamesToAdd = newFileNames.filter(function (f) { return oldFileNames.indexOf(f) < 0; }); + for (var _i = 0; _i < fileNamesToRemove.length; _i++) { + var fileName = fileNamesToRemove[_i]; + var info = this.getScriptInfo(fileName); + project.removeRoot(info); + } + for (var _b = 0; _b < fileNamesToAdd.length; _b++) { + var fileName = fileNamesToAdd[_b]; + var info = this.getScriptInfo(fileName); + if (!info) { + info = this.openFile(fileName, false); } else { - return { errorMsg: "specified file " + rootFilename + " not found" }; + if (this.openFileRoots.indexOf(info) >= 0) { + this.openFileRoots = copyListRemovingItem(info, this.openFileRoots); + } + if (this.openFilesReferenced.indexOf(info) >= 0) { + this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); + } + this.openFileRootsConfigured.push(info); } + project.addRoot(info); } - proj.finishGraph(); - return { success: true, project: proj }; - } - else { - return { errorMsg: "no files found" }; + project.setProjectOptions(projectOptions); + project.finishGraph(); } } }; @@ -40972,6 +42285,7 @@ var ts; InsertSpaceAfterKeywordsInControlFlowStatements: true, InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, PlaceOpenBraceOnNewLineForFunctions: false, PlaceOpenBraceOnNewLineForControlBlocks: false }; @@ -42081,9 +43395,16 @@ var ts; })(); var LanguageServiceShimHostAdapter = (function () { function LanguageServiceShimHostAdapter(shimHost) { + var _this = this; this.shimHost = shimHost; this.loggingEnabled = false; this.tracingEnabled = false; + if ("getModuleResolutionsForFile" in this.shimHost) { + this.resolveModuleNames = function (moduleNames, containingFile) { + var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); + return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -42180,10 +43501,22 @@ var ts; function CoreServicesShimHostAdapter(shimHost) { this.shimHost = shimHost; } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension) { - var encoded = this.shimHost.readDirectory(rootDir, extension); + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { + var encoded; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension); + } return JSON.parse(encoded); }; + CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { + return this.shimHost.fileExists(fileName); + }; + CoreServicesShimHostAdapter.prototype.readFile = function (fileName) { + return this.shimHost.readFile(fileName); + }; return CoreServicesShimHostAdapter; })(); ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; @@ -42279,7 +43612,7 @@ var ts; }); }; LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { - var newLine = this.getNewLine(); + var newLine = ts.getNewLineOrDefaultFromHost(this.host); return ts.realizeDiagnostics(diagnostics, newLine); }; LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { @@ -42308,9 +43641,6 @@ var ts; return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); }; - 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 () { @@ -42419,7 +43749,9 @@ var ts; LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { var _this = this; return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { - return _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); + return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); }); }; LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { @@ -42460,6 +43792,10 @@ var ts; return edits; }); }; + LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); }); + }; LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { var _this = this; return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { @@ -42537,12 +43873,20 @@ var ts; CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); }; + CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + }); + }; 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: [], + ambientExternalModules: result.ambientExternalModules, isLibFile: result.isLibFile }; ts.forEach(result.referencedFiles, function (refFile) { @@ -42659,4 +44003,4 @@ var TypeScript; Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); -var toolsVersion = "1.5"; +var toolsVersion = "1.6"; diff --git a/lib/typescript.d.ts b/lib/typescript.d.ts index ee69b9ca909ff..edeb166cf88f1 100644 --- a/lib/typescript.d.ts +++ b/lib/typescript.d.ts @@ -23,6 +23,7 @@ declare module "typescript" { contains(fileName: string): boolean; remove(fileName: string): void; forEachValue(f: (v: T) => void): void; + clear(): void; } interface TextRange { pos: number; @@ -35,293 +36,294 @@ declare module "typescript" { MultiLineCommentTrivia = 3, NewLineTrivia = 4, WhitespaceTrivia = 5, - ConflictMarkerTrivia = 6, - NumericLiteral = 7, - StringLiteral = 8, - RegularExpressionLiteral = 9, - NoSubstitutionTemplateLiteral = 10, - TemplateHead = 11, - TemplateMiddle = 12, - TemplateTail = 13, - OpenBraceToken = 14, - CloseBraceToken = 15, - OpenParenToken = 16, - CloseParenToken = 17, - OpenBracketToken = 18, - CloseBracketToken = 19, - DotToken = 20, - DotDotDotToken = 21, - SemicolonToken = 22, - CommaToken = 23, - LessThanToken = 24, - LessThanSlashToken = 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, - AtToken = 53, - EqualsToken = 54, - PlusEqualsToken = 55, - MinusEqualsToken = 56, - AsteriskEqualsToken = 57, - SlashEqualsToken = 58, - PercentEqualsToken = 59, - LessThanLessThanEqualsToken = 60, - GreaterThanGreaterThanEqualsToken = 61, - GreaterThanGreaterThanGreaterThanEqualsToken = 62, - AmpersandEqualsToken = 63, - BarEqualsToken = 64, - CaretEqualsToken = 65, - Identifier = 66, - BreakKeyword = 67, - CaseKeyword = 68, - CatchKeyword = 69, - ClassKeyword = 70, - ConstKeyword = 71, - ContinueKeyword = 72, - DebuggerKeyword = 73, - DefaultKeyword = 74, - DeleteKeyword = 75, - DoKeyword = 76, - ElseKeyword = 77, - EnumKeyword = 78, - ExportKeyword = 79, - ExtendsKeyword = 80, - FalseKeyword = 81, - FinallyKeyword = 82, - ForKeyword = 83, - FunctionKeyword = 84, - IfKeyword = 85, - ImportKeyword = 86, - InKeyword = 87, - InstanceOfKeyword = 88, - NewKeyword = 89, - NullKeyword = 90, - ReturnKeyword = 91, - SuperKeyword = 92, - SwitchKeyword = 93, - ThisKeyword = 94, - ThrowKeyword = 95, - TrueKeyword = 96, - TryKeyword = 97, - TypeOfKeyword = 98, - VarKeyword = 99, - VoidKeyword = 100, - WhileKeyword = 101, - WithKeyword = 102, - ImplementsKeyword = 103, - InterfaceKeyword = 104, - LetKeyword = 105, - PackageKeyword = 106, - PrivateKeyword = 107, - ProtectedKeyword = 108, - PublicKeyword = 109, - StaticKeyword = 110, - YieldKeyword = 111, - AbstractKeyword = 112, - AsKeyword = 113, - AnyKeyword = 114, - AsyncKeyword = 115, - AwaitKeyword = 116, - BooleanKeyword = 117, - ConstructorKeyword = 118, - DeclareKeyword = 119, - GetKeyword = 120, - IsKeyword = 121, - ModuleKeyword = 122, - NamespaceKeyword = 123, - RequireKeyword = 124, - NumberKeyword = 125, - SetKeyword = 126, - StringKeyword = 127, - SymbolKeyword = 128, - TypeKeyword = 129, - FromKeyword = 130, - OfKeyword = 131, - QualifiedName = 132, - ComputedPropertyName = 133, - TypeParameter = 134, - Parameter = 135, - Decorator = 136, - PropertySignature = 137, - PropertyDeclaration = 138, - MethodSignature = 139, - MethodDeclaration = 140, - Constructor = 141, - GetAccessor = 142, - SetAccessor = 143, - CallSignature = 144, - ConstructSignature = 145, - IndexSignature = 146, - TypePredicate = 147, - TypeReference = 148, - FunctionType = 149, - ConstructorType = 150, - TypeQuery = 151, - TypeLiteral = 152, - ArrayType = 153, - TupleType = 154, - UnionType = 155, - IntersectionType = 156, - ParenthesizedType = 157, - ObjectBindingPattern = 158, - ArrayBindingPattern = 159, - BindingElement = 160, - ArrayLiteralExpression = 161, - ObjectLiteralExpression = 162, - PropertyAccessExpression = 163, - ElementAccessExpression = 164, - CallExpression = 165, - NewExpression = 166, - TaggedTemplateExpression = 167, - TypeAssertionExpression = 168, - ParenthesizedExpression = 169, - FunctionExpression = 170, - ArrowFunction = 171, - DeleteExpression = 172, - TypeOfExpression = 173, - VoidExpression = 174, - AwaitExpression = 175, - PrefixUnaryExpression = 176, - PostfixUnaryExpression = 177, - BinaryExpression = 178, - ConditionalExpression = 179, - TemplateExpression = 180, - YieldExpression = 181, - SpreadElementExpression = 182, - ClassExpression = 183, - OmittedExpression = 184, - ExpressionWithTypeArguments = 185, - AsExpression = 186, - TemplateSpan = 187, - SemicolonClassElement = 188, - Block = 189, - VariableStatement = 190, - EmptyStatement = 191, - ExpressionStatement = 192, - IfStatement = 193, - DoStatement = 194, - WhileStatement = 195, - ForStatement = 196, - ForInStatement = 197, - ForOfStatement = 198, - ContinueStatement = 199, - BreakStatement = 200, - ReturnStatement = 201, - WithStatement = 202, - SwitchStatement = 203, - LabeledStatement = 204, - ThrowStatement = 205, - TryStatement = 206, - DebuggerStatement = 207, - VariableDeclaration = 208, - VariableDeclarationList = 209, - FunctionDeclaration = 210, - ClassDeclaration = 211, - InterfaceDeclaration = 212, - TypeAliasDeclaration = 213, - EnumDeclaration = 214, - ModuleDeclaration = 215, - ModuleBlock = 216, - CaseBlock = 217, - ImportEqualsDeclaration = 218, - ImportDeclaration = 219, - ImportClause = 220, - NamespaceImport = 221, - NamedImports = 222, - ImportSpecifier = 223, - ExportAssignment = 224, - ExportDeclaration = 225, - NamedExports = 226, - ExportSpecifier = 227, - MissingDeclaration = 228, - ExternalModuleReference = 229, - JsxElement = 230, - JsxSelfClosingElement = 231, - JsxOpeningElement = 232, - JsxText = 233, - JsxClosingElement = 234, - JsxAttribute = 235, - JsxSpreadAttribute = 236, - JsxExpression = 237, - CaseClause = 238, - DefaultClause = 239, - HeritageClause = 240, - CatchClause = 241, - PropertyAssignment = 242, - ShorthandPropertyAssignment = 243, - EnumMember = 244, - SourceFile = 245, - JSDocTypeExpression = 246, - JSDocAllType = 247, - JSDocUnknownType = 248, - JSDocArrayType = 249, - JSDocUnionType = 250, - JSDocTupleType = 251, - JSDocNullableType = 252, - JSDocNonNullableType = 253, - JSDocRecordType = 254, - JSDocRecordMember = 255, - JSDocTypeReference = 256, - JSDocOptionalType = 257, - JSDocFunctionType = 258, - JSDocVariadicType = 259, - JSDocConstructorType = 260, - JSDocThisType = 261, - JSDocComment = 262, - JSDocTag = 263, - JSDocParameterTag = 264, - JSDocReturnTag = 265, - JSDocTypeTag = 266, - JSDocTemplateTag = 267, - SyntaxList = 268, - Count = 269, - FirstAssignment = 54, - LastAssignment = 65, - FirstReservedWord = 67, - LastReservedWord = 102, - FirstKeyword = 67, - LastKeyword = 131, - FirstFutureReservedWord = 103, - LastFutureReservedWord = 111, - FirstTypeNode = 148, - LastTypeNode = 157, - FirstPunctuation = 14, - LastPunctuation = 65, + ShebangTrivia = 6, + ConflictMarkerTrivia = 7, + NumericLiteral = 8, + StringLiteral = 9, + RegularExpressionLiteral = 10, + NoSubstitutionTemplateLiteral = 11, + TemplateHead = 12, + TemplateMiddle = 13, + TemplateTail = 14, + OpenBraceToken = 15, + CloseBraceToken = 16, + OpenParenToken = 17, + CloseParenToken = 18, + OpenBracketToken = 19, + CloseBracketToken = 20, + DotToken = 21, + DotDotDotToken = 22, + SemicolonToken = 23, + CommaToken = 24, + LessThanToken = 25, + LessThanSlashToken = 26, + GreaterThanToken = 27, + LessThanEqualsToken = 28, + GreaterThanEqualsToken = 29, + EqualsEqualsToken = 30, + ExclamationEqualsToken = 31, + EqualsEqualsEqualsToken = 32, + ExclamationEqualsEqualsToken = 33, + EqualsGreaterThanToken = 34, + PlusToken = 35, + MinusToken = 36, + AsteriskToken = 37, + SlashToken = 38, + PercentToken = 39, + PlusPlusToken = 40, + MinusMinusToken = 41, + LessThanLessThanToken = 42, + GreaterThanGreaterThanToken = 43, + GreaterThanGreaterThanGreaterThanToken = 44, + AmpersandToken = 45, + BarToken = 46, + CaretToken = 47, + ExclamationToken = 48, + TildeToken = 49, + AmpersandAmpersandToken = 50, + BarBarToken = 51, + QuestionToken = 52, + ColonToken = 53, + AtToken = 54, + EqualsToken = 55, + PlusEqualsToken = 56, + MinusEqualsToken = 57, + AsteriskEqualsToken = 58, + SlashEqualsToken = 59, + PercentEqualsToken = 60, + LessThanLessThanEqualsToken = 61, + GreaterThanGreaterThanEqualsToken = 62, + GreaterThanGreaterThanGreaterThanEqualsToken = 63, + AmpersandEqualsToken = 64, + BarEqualsToken = 65, + CaretEqualsToken = 66, + Identifier = 67, + BreakKeyword = 68, + CaseKeyword = 69, + CatchKeyword = 70, + ClassKeyword = 71, + ConstKeyword = 72, + ContinueKeyword = 73, + DebuggerKeyword = 74, + DefaultKeyword = 75, + DeleteKeyword = 76, + DoKeyword = 77, + ElseKeyword = 78, + EnumKeyword = 79, + ExportKeyword = 80, + ExtendsKeyword = 81, + FalseKeyword = 82, + FinallyKeyword = 83, + ForKeyword = 84, + FunctionKeyword = 85, + IfKeyword = 86, + ImportKeyword = 87, + InKeyword = 88, + InstanceOfKeyword = 89, + NewKeyword = 90, + NullKeyword = 91, + ReturnKeyword = 92, + SuperKeyword = 93, + SwitchKeyword = 94, + ThisKeyword = 95, + ThrowKeyword = 96, + TrueKeyword = 97, + TryKeyword = 98, + TypeOfKeyword = 99, + VarKeyword = 100, + VoidKeyword = 101, + WhileKeyword = 102, + WithKeyword = 103, + ImplementsKeyword = 104, + InterfaceKeyword = 105, + LetKeyword = 106, + PackageKeyword = 107, + PrivateKeyword = 108, + ProtectedKeyword = 109, + PublicKeyword = 110, + StaticKeyword = 111, + YieldKeyword = 112, + AbstractKeyword = 113, + AsKeyword = 114, + AnyKeyword = 115, + AsyncKeyword = 116, + AwaitKeyword = 117, + BooleanKeyword = 118, + ConstructorKeyword = 119, + DeclareKeyword = 120, + GetKeyword = 121, + IsKeyword = 122, + ModuleKeyword = 123, + NamespaceKeyword = 124, + RequireKeyword = 125, + NumberKeyword = 126, + SetKeyword = 127, + StringKeyword = 128, + SymbolKeyword = 129, + TypeKeyword = 130, + FromKeyword = 131, + OfKeyword = 132, + QualifiedName = 133, + ComputedPropertyName = 134, + TypeParameter = 135, + Parameter = 136, + Decorator = 137, + PropertySignature = 138, + PropertyDeclaration = 139, + MethodSignature = 140, + MethodDeclaration = 141, + Constructor = 142, + GetAccessor = 143, + SetAccessor = 144, + CallSignature = 145, + ConstructSignature = 146, + IndexSignature = 147, + TypePredicate = 148, + TypeReference = 149, + FunctionType = 150, + ConstructorType = 151, + TypeQuery = 152, + TypeLiteral = 153, + ArrayType = 154, + TupleType = 155, + UnionType = 156, + IntersectionType = 157, + ParenthesizedType = 158, + ObjectBindingPattern = 159, + ArrayBindingPattern = 160, + BindingElement = 161, + ArrayLiteralExpression = 162, + ObjectLiteralExpression = 163, + PropertyAccessExpression = 164, + ElementAccessExpression = 165, + CallExpression = 166, + NewExpression = 167, + TaggedTemplateExpression = 168, + TypeAssertionExpression = 169, + ParenthesizedExpression = 170, + FunctionExpression = 171, + ArrowFunction = 172, + DeleteExpression = 173, + TypeOfExpression = 174, + VoidExpression = 175, + AwaitExpression = 176, + PrefixUnaryExpression = 177, + PostfixUnaryExpression = 178, + BinaryExpression = 179, + ConditionalExpression = 180, + TemplateExpression = 181, + YieldExpression = 182, + SpreadElementExpression = 183, + ClassExpression = 184, + OmittedExpression = 185, + ExpressionWithTypeArguments = 186, + AsExpression = 187, + TemplateSpan = 188, + SemicolonClassElement = 189, + Block = 190, + VariableStatement = 191, + EmptyStatement = 192, + ExpressionStatement = 193, + IfStatement = 194, + DoStatement = 195, + WhileStatement = 196, + ForStatement = 197, + ForInStatement = 198, + ForOfStatement = 199, + ContinueStatement = 200, + BreakStatement = 201, + ReturnStatement = 202, + WithStatement = 203, + SwitchStatement = 204, + LabeledStatement = 205, + ThrowStatement = 206, + TryStatement = 207, + DebuggerStatement = 208, + VariableDeclaration = 209, + VariableDeclarationList = 210, + FunctionDeclaration = 211, + ClassDeclaration = 212, + InterfaceDeclaration = 213, + TypeAliasDeclaration = 214, + EnumDeclaration = 215, + ModuleDeclaration = 216, + ModuleBlock = 217, + CaseBlock = 218, + ImportEqualsDeclaration = 219, + ImportDeclaration = 220, + ImportClause = 221, + NamespaceImport = 222, + NamedImports = 223, + ImportSpecifier = 224, + ExportAssignment = 225, + ExportDeclaration = 226, + NamedExports = 227, + ExportSpecifier = 228, + MissingDeclaration = 229, + ExternalModuleReference = 230, + JsxElement = 231, + JsxSelfClosingElement = 232, + JsxOpeningElement = 233, + JsxText = 234, + JsxClosingElement = 235, + JsxAttribute = 236, + JsxSpreadAttribute = 237, + JsxExpression = 238, + CaseClause = 239, + DefaultClause = 240, + HeritageClause = 241, + CatchClause = 242, + PropertyAssignment = 243, + ShorthandPropertyAssignment = 244, + EnumMember = 245, + SourceFile = 246, + JSDocTypeExpression = 247, + JSDocAllType = 248, + JSDocUnknownType = 249, + JSDocArrayType = 250, + JSDocUnionType = 251, + JSDocTupleType = 252, + JSDocNullableType = 253, + JSDocNonNullableType = 254, + JSDocRecordType = 255, + JSDocRecordMember = 256, + JSDocTypeReference = 257, + JSDocOptionalType = 258, + JSDocFunctionType = 259, + JSDocVariadicType = 260, + JSDocConstructorType = 261, + JSDocThisType = 262, + JSDocComment = 263, + JSDocTag = 264, + JSDocParameterTag = 265, + JSDocReturnTag = 266, + JSDocTypeTag = 267, + JSDocTemplateTag = 268, + SyntaxList = 269, + Count = 270, + FirstAssignment = 55, + LastAssignment = 66, + FirstReservedWord = 68, + LastReservedWord = 103, + FirstKeyword = 68, + LastKeyword = 132, + FirstFutureReservedWord = 104, + LastFutureReservedWord = 112, + FirstTypeNode = 149, + LastTypeNode = 158, + FirstPunctuation = 15, + LastPunctuation = 66, FirstToken = 0, - LastToken = 131, + LastToken = 132, FirstTriviaToken = 2, - LastTriviaToken = 6, - FirstLiteralToken = 7, - LastLiteralToken = 10, - FirstTemplateToken = 10, - LastTemplateToken = 13, - FirstBinaryOperator = 24, - LastBinaryOperator = 65, - FirstNode = 132, + LastTriviaToken = 7, + FirstLiteralToken = 8, + LastLiteralToken = 11, + FirstTemplateToken = 11, + LastTemplateToken = 14, + FirstBinaryOperator = 25, + LastBinaryOperator = 66, + FirstNode = 133, } const enum NodeFlags { Export = 1, @@ -452,9 +454,9 @@ declare module "typescript" { * Several node kinds share function-like features such as a signature, * a name, and a body. These nodes should extend FunctionLikeDeclaration. * Examples: - * FunctionDeclaration - * MethodDeclaration - * AccessorDeclaration + * - FunctionDeclaration + * - MethodDeclaration + * - AccessorDeclaration */ interface FunctionLikeDeclaration extends SignatureDeclaration { _functionLikeDeclarationBrand: any; @@ -944,7 +946,7 @@ declare module "typescript" { getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } - interface ParseConfigHost { + interface ParseConfigHost extends ModuleResolutionHost { readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; } interface WriteFileCallback { @@ -958,6 +960,10 @@ declare module "typescript" { throwIfCancellationRequested(): void; } interface Program extends ScriptReferenceHost { + /** + * Get a list of root file names that were passed to a 'createProgram' + */ + getRootFileNames(): string[]; /** * Get a list of files in the program */ @@ -1019,11 +1025,6 @@ declare module "typescript" { emitSkipped: boolean; diagnostics: Diagnostic[]; } - interface TypeCheckerHost { - getCompilerOptions(): CompilerOptions; - getSourceFiles(): SourceFile[]; - getSourceFile(fileName: string): SourceFile; - } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; @@ -1031,6 +1032,7 @@ declare module "typescript" { getPropertyOfType(type: Type, propertyName: string): Symbol; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; + getBaseTypes(type: InterfaceType): ObjectType[]; getReturnTypeOfSignature(signature: Signature): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; @@ -1054,6 +1056,7 @@ declare module "typescript" { getExportsOfModule(moduleSymbol: Symbol): Symbol[]; getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; getJsxIntrinsicTagNames(): Symbol[]; + isOptionalParameter(node: ParameterDeclaration): boolean; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -1198,7 +1201,7 @@ declare module "typescript" { Anonymous = 65536, Instantiated = 131072, ObjectLiteral = 524288, - ESSymbol = 4194304, + ESSymbol = 16777216, StringLike = 258, NumberLike = 132, ObjectType = 80896, @@ -1218,8 +1221,6 @@ declare module "typescript" { typeParameters: TypeParameter[]; outerTypeParameters: TypeParameter[]; localTypeParameters: TypeParameter[]; - resolvedBaseConstructorType?: Type; - resolvedBaseTypes: ObjectType[]; } interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; @@ -1315,6 +1316,7 @@ declare module "typescript" { noLib?: boolean; noResolve?: boolean; out?: string; + outFile?: string; outDir?: string; preserveConstEnums?: boolean; project?: string; @@ -1367,14 +1369,25 @@ declare module "typescript" { fileNames: string[]; errors: Diagnostic[]; } - interface CompilerHost { + interface ModuleResolutionHost { + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + } + interface ResolvedModule { + resolvedFileName: string; + failedLookupLocations: string[]; + } + type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule; + interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; writeFile: WriteFileCallback; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; + resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; } interface TextSpan { start: number; @@ -1448,8 +1461,11 @@ declare module "typescript" { function couldStartTrivia(text: string, pos: number): boolean; function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + /** Optionally, get the shebang */ + function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; } declare module "typescript" { function getDefaultLibFileName(options: CompilerOptions): string; @@ -1489,13 +1505,14 @@ declare module "typescript" { function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare module "typescript" { - /** The version of the TypeScript compiler release */ const version: string; function findConfigFile(searchPath: string): string; + function resolveTripleslashReference(moduleName: string, containingFile: string): string; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; - function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare module "typescript" { function parseCommandLine(commandLine: string[]): ParsedCommandLine; @@ -1559,6 +1576,7 @@ declare module "typescript" { getConstructSignatures(): Signature[]; getStringIndexType(): Type; getNumberIndexType(): Type; + getBaseTypes(): ObjectType[]; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -1600,6 +1618,7 @@ declare module "typescript" { interface PreProcessedFileInfo { referencedFiles: FileReference[]; importedFiles: FileReference[]; + ambientExternalModules: string[]; isLibFile: boolean; } interface HostCancellationToken { @@ -1620,6 +1639,7 @@ declare module "typescript" { trace?(s: string): void; error?(s: string): void; useCaseSensitiveFileNames?(): boolean; + resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; } interface LanguageService { cleanupSemanticCache(): void; @@ -1660,6 +1680,7 @@ declare module "typescript" { getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; + getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; getSourceFile(fileName: string): SourceFile; @@ -1696,6 +1717,11 @@ declare module "typescript" { span: TextSpan; newText: string; } + interface TextInsertion { + newText: string; + /** The position in newText the caret should point to after the insertion. */ + caretOffset: number; + } interface RenameLocation { textSpan: TextSpan; fileName: string; @@ -1716,6 +1742,7 @@ declare module "typescript" { const writtenReference: string; } interface HighlightSpan { + fileName?: string; textSpan: TextSpan; kind: string; } @@ -1743,6 +1770,7 @@ declare module "typescript" { InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; [s: string]: boolean | number | string; @@ -1985,6 +2013,7 @@ declare module "typescript" { * @param compilationSettings The compilation settings used to acquire the file */ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + reportStats(): string; } module ScriptElementKind { const unknown: string; @@ -2071,10 +2100,24 @@ declare module "typescript" { } function displayPartsToString(displayParts: SymbolDisplayPart[]): string; function getDefaultCompilerOptions(): CompilerOptions; + interface TranspileOptions { + compilerOptions?: CompilerOptions; + fileName?: string; + reportDiagnostics?: boolean; + moduleName?: string; + renamedDependencies?: Map; + } + interface TranspileOutput { + outputText: string; + diagnostics?: Diagnostic[]; + sourceMapText?: string; + } + function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; + function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; diff --git a/lib/typescript.js b/lib/typescript.js index 6035d71fa2b64..9507f25db63c8 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -16,6 +16,7 @@ and limitations under the License. var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword + // Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync (function (SyntaxKind) { SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; @@ -23,324 +24,326 @@ var ts; SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + // We detect and preserve #! on the first line + SyntaxKind[SyntaxKind["ShebangTrivia"] = 6] = "ShebangTrivia"; // We detect and provide better error recovery when we encounter a git merge marker. This // allows us to edit files with git-conflict markers in them in a much more pleasant manner. - SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 6] = "ConflictMarkerTrivia"; + SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia"; // Literals - SyntaxKind[SyntaxKind["NumericLiteral"] = 7] = "NumericLiteral"; - SyntaxKind[SyntaxKind["StringLiteral"] = 8] = "StringLiteral"; - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 9] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 10] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 8] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 9] = "StringLiteral"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 10] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 11] = "NoSubstitutionTemplateLiteral"; // Pseudo-literals - SyntaxKind[SyntaxKind["TemplateHead"] = 11] = "TemplateHead"; - SyntaxKind[SyntaxKind["TemplateMiddle"] = 12] = "TemplateMiddle"; - SyntaxKind[SyntaxKind["TemplateTail"] = 13] = "TemplateTail"; + SyntaxKind[SyntaxKind["TemplateHead"] = 12] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 13] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 14] = "TemplateTail"; // Punctuation - 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["LessThanSlashToken"] = 25] = "LessThanSlashToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 26] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 27] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 28] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 29] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 30] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 31] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 32] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 33] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 34] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 35] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 36] = "AsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 37] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 38] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 39] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 40] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 41] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 42] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 43] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 44] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 45] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 46] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 47] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 48] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 49] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 50] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 51] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 52] = "ColonToken"; - SyntaxKind[SyntaxKind["AtToken"] = 53] = "AtToken"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 15] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 16] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 17] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 18] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 19] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 20] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 21] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 22] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 23] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 24] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 25] = "LessThanToken"; + SyntaxKind[SyntaxKind["LessThanSlashToken"] = 26] = "LessThanSlashToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 27] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 28] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 29] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 30] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 31] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 32] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 33] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 34] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 35] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 36] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 37] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 38] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 39] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 40] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 41] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 42] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 43] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 44] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 45] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 46] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 47] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 48] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 49] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 50] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 51] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 52] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 53] = "ColonToken"; + SyntaxKind[SyntaxKind["AtToken"] = 54] = "AtToken"; // Assignments - SyntaxKind[SyntaxKind["EqualsToken"] = 54] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 55] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 56] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 57] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 58] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 59] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 60] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 61] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 62] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 63] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 64] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 65] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 55] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 56] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 57] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 58] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 59] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 60] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 61] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 62] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 63] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 64] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 65] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 66] = "CaretEqualsToken"; // Identifiers - SyntaxKind[SyntaxKind["Identifier"] = 66] = "Identifier"; + SyntaxKind[SyntaxKind["Identifier"] = 67] = "Identifier"; // Reserved words - SyntaxKind[SyntaxKind["BreakKeyword"] = 67] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 68] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 69] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 70] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 71] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 72] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 73] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 74] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 75] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 76] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 77] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 78] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 79] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 80] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 81] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 82] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 83] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 84] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 85] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 86] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 87] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 88] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 89] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 90] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 91] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 92] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 93] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 94] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 95] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 96] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 97] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 98] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 99] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 100] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 101] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 102] = "WithKeyword"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 68] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 69] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 70] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 71] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 72] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 73] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 74] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 75] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 76] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 77] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 78] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 79] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 80] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 81] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 82] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 83] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 84] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 85] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 86] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 87] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 88] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 89] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 90] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 91] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 92] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 93] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 94] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 95] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 96] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 97] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 98] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 99] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 100] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 101] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 102] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 103] = "WithKeyword"; // Strict mode reserved words - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 103] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 104] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 105] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 106] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 107] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 108] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 109] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 110] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 111] = "YieldKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 104] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 105] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 106] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 107] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 108] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 109] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 110] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 111] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 112] = "YieldKeyword"; // Contextual keywords - SyntaxKind[SyntaxKind["AbstractKeyword"] = 112] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 113] = "AsKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 114] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 115] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 116] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 117] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 118] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 119] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 120] = "GetKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 121] = "IsKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 122] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 123] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 124] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 125] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 126] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 127] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 128] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 129] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 130] = "FromKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 131] = "OfKeyword"; + SyntaxKind[SyntaxKind["AbstractKeyword"] = 113] = "AbstractKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 114] = "AsKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 115] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 116] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 117] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 118] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 119] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 120] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 121] = "GetKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 122] = "IsKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 123] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 124] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 125] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 126] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 127] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 128] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 129] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 130] = "TypeKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 131] = "FromKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 132] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 132] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 133] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 133] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 134] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 134] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 135] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 136] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 135] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 136] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 137] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 137] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 138] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 139] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 140] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 141] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 142] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 143] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 144] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 145] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 146] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 138] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 139] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 140] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 141] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 142] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 143] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 144] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 145] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 146] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 147] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 147] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 148] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 149] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 150] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 151] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 152] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 153] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 154] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 155] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 156] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 157] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 148] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 149] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 150] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 151] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 152] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 153] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 154] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 155] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 156] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 157] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 158] = "ParenthesizedType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 158] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 159] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 160] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 159] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 160] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 161] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 161] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 162] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 163] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 164] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 165] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 166] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 167] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 168] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 169] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 170] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 171] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 172] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 173] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 174] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 175] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 176] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 177] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 178] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 179] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 180] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 181] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 182] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 183] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 184] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 185] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 186] = "AsExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 162] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 163] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 164] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 165] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 166] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 167] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 168] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 169] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 170] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 171] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 172] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 173] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 174] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 175] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 176] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 177] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 178] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 179] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 180] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 181] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 182] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 183] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 184] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 185] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 186] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 187] = "AsExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 187] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 188] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 188] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 189] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 189] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 190] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 191] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 192] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 193] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 194] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 195] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 196] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 197] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 198] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 199] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 200] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 201] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 202] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 203] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 204] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 205] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 206] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 207] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 208] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 209] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 210] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 211] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 212] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 213] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 214] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 215] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 216] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 217] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 218] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 219] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 220] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 221] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 222] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 223] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 224] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 225] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 226] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 227] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 228] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 190] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 191] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 192] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 193] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 194] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 195] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 196] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 197] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 198] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 199] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 200] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 201] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 202] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 203] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 204] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 205] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 206] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 207] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 208] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 209] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 210] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 211] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 212] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 213] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 214] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 215] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 216] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 217] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 218] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 219] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 220] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 221] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 222] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 223] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 224] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 225] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 226] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 227] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 228] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 229] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 229] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 230] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 230] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 231] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 232] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 233] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 234] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 235] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 236] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 237] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 231] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 232] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 233] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxText"] = 234] = "JsxText"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 235] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 236] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 237] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 238] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 238] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 239] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 240] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 241] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 239] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 240] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 241] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 242] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 242] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 243] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 243] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 244] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 244] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 245] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 245] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 246] = "SourceFile"; // JSDoc nodes. - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 246] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 247] = "JSDocTypeExpression"; // The * type. - SyntaxKind[SyntaxKind["JSDocAllType"] = 247] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 248] = "JSDocAllType"; // The ? type. - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 248] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 249] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 250] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 251] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 252] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 253] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 254] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 255] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 256] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 257] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 258] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 259] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 260] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 261] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 262] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 263] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 264] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 265] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 266] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 267] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 249] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 250] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 251] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 252] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 253] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 254] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 255] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 256] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 257] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 258] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 259] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 260] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 261] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 262] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 263] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 264] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 265] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 266] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 267] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 268] = "JSDocTemplateTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 268] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 269] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 269] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 270] = "Count"; // Markers - SyntaxKind[SyntaxKind["FirstAssignment"] = 54] = "FirstAssignment"; - SyntaxKind[SyntaxKind["LastAssignment"] = 65] = "LastAssignment"; - SyntaxKind[SyntaxKind["FirstReservedWord"] = 67] = "FirstReservedWord"; - SyntaxKind[SyntaxKind["LastReservedWord"] = 102] = "LastReservedWord"; - SyntaxKind[SyntaxKind["FirstKeyword"] = 67] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 131] = "LastKeyword"; - SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 103] = "FirstFutureReservedWord"; - SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 111] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 148] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 157] = "LastTypeNode"; - SyntaxKind[SyntaxKind["FirstPunctuation"] = 14] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = 65] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 55] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 66] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 68] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 103] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 68] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 132] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 104] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 112] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 149] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 158] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 66] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 131] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 132] = "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"] = 65] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 132] = "FirstNode"; + SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = 11] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = 11] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; + SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 66] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 133] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -602,21 +605,27 @@ var ts; TypeFlags[TypeFlags["FromSignature"] = 262144] = "FromSignature"; TypeFlags[TypeFlags["ObjectLiteral"] = 524288] = "ObjectLiteral"; /* @internal */ - TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 1048576] = "ContainsUndefinedOrNull"; + TypeFlags[TypeFlags["FreshObjectLiteral"] = 1048576] = "FreshObjectLiteral"; /* @internal */ - TypeFlags[TypeFlags["ContainsObjectLiteral"] = 2097152] = "ContainsObjectLiteral"; - TypeFlags[TypeFlags["ESSymbol"] = 4194304] = "ESSymbol"; + TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 2097152] = "ContainsUndefinedOrNull"; /* @internal */ - TypeFlags[TypeFlags["Intrinsic"] = 4194431] = "Intrinsic"; + TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; /* @internal */ - TypeFlags[TypeFlags["Primitive"] = 4194814] = "Primitive"; + TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; + TypeFlags[TypeFlags["ESSymbol"] = 16777216] = "ESSymbol"; + /* @internal */ + TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; + /* @internal */ + TypeFlags[TypeFlags["Primitive"] = 16777726] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = 132] = "NumberLike"; TypeFlags[TypeFlags["ObjectType"] = 80896] = "ObjectType"; TypeFlags[TypeFlags["UnionOrIntersection"] = 49152] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 130048] = "StructuredType"; /* @internal */ - TypeFlags[TypeFlags["RequiresWidening"] = 3145728] = "RequiresWidening"; + TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; + /* @internal */ + TypeFlags[TypeFlags["PropagatingFlags"] = 14680064] = "PropagatingFlags"; })(ts.TypeFlags || (ts.TypeFlags = {})); var TypeFlags = ts.TypeFlags; (function (SignatureKind) { @@ -822,6 +831,7 @@ var ts; set: set, contains: contains, remove: remove, + clear: clear, forEachValue: forEachValueInMap }; function set(fileName, value) { @@ -843,6 +853,9 @@ var ts; function normalizeKey(key) { return getCanonicalFileName(normalizeSlashes(key)); } + function clear() { + files = {}; + } } ts.createFileMap = createFileMap; (function (Comparison) { @@ -990,6 +1003,13 @@ var ts; return array[array.length - 1]; } ts.lastOrUndefined = lastOrUndefined; + /** + * Performs a binary search, finding the index at which 'value' occurs in 'array'. + * If no such index is found, returns the 2's-complement of first index at which + * number[index] exceeds number. + * @param array A sorted array whose first element must be no larger than number + * @param number The value to be searched for in the array. + */ function binarySearch(array, value) { var low = 0; var high = array.length - 1; @@ -1293,7 +1313,7 @@ var ts; if (path.lastIndexOf("file:///", 0) === 0) { return "file:///".length; } - var idx = path.indexOf('://'); + var idx = path.indexOf("://"); if (idx !== -1) { return idx + "://".length; } @@ -1470,7 +1490,7 @@ var ts; /** * List of supported extensions in order of file resolution precedence. */ - ts.supportedExtensions = [".tsx", ".ts", ".d.ts"]; + ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { @@ -1699,7 +1719,7 @@ var ts; function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); - var _os = require('os'); + var _os = require("os"); var platform = _os.platform(); // win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; @@ -1734,7 +1754,7 @@ var ts; function writeFile(fileName, data, writeByteOrderMark) { // If a BOM is required, emit one if (writeByteOrderMark) { - data = '\uFEFF' + data; + data = "\uFEFF" + data; } _fs.writeFileSync(fileName, data, "utf8"); } @@ -1775,7 +1795,7 @@ var ts; newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { - var buffer = new Buffer(s, 'utf8'); + var buffer = new Buffer(s, "utf8"); var offset = 0; var toWrite = buffer.length; var written = 0; @@ -1799,7 +1819,6 @@ var ts; } callback(fileName); } - ; }, resolvePath: function (path) { return _path.resolve(path); @@ -1836,7 +1855,9 @@ var ts; if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } - else if (typeof module !== "undefined" && module.exports) { + else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { + // process and process.nextTick checks if current environment is node-like + // process.browser check excludes webpack and browserify return getNodeSystem(); } else { @@ -2101,6 +2122,7 @@ var ts; Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, @@ -2140,7 +2162,7 @@ var ts; Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." }, Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: "Duplicate function implementation." }, Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, @@ -2271,6 +2293,8 @@ var ts; JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The global type 'JSX.{0}' may not have more than one property" }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, + A_member_initializer_in_a_const_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_const_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a 'const' enum declaration cannot reference members declared after it, including members defined in other 'const' enums." }, + Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2350,20 +2374,11 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, - Option_sourceMap_cannot_be_specified_with_option_isolatedModules: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'isolatedModules'." }, - Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." }, - Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." }, - Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, - Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, - Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, - Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, + Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, + Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -2414,7 +2429,6 @@ var ts; Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, - Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, @@ -2459,7 +2473,8 @@ var ts; JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, - Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." } + Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } }; })(ts || (ts = {})); /// @@ -2467,123 +2482,123 @@ var ts; var ts; (function (ts) { var textToToken = { - "abstract": 112 /* AbstractKeyword */, - "any": 114 /* AnyKeyword */, - "as": 113 /* AsKeyword */, - "boolean": 117 /* BooleanKeyword */, - "break": 67 /* BreakKeyword */, - "case": 68 /* CaseKeyword */, - "catch": 69 /* CatchKeyword */, - "class": 70 /* ClassKeyword */, - "continue": 72 /* ContinueKeyword */, - "const": 71 /* ConstKeyword */, - "constructor": 118 /* ConstructorKeyword */, - "debugger": 73 /* DebuggerKeyword */, - "declare": 119 /* DeclareKeyword */, - "default": 74 /* DefaultKeyword */, - "delete": 75 /* DeleteKeyword */, - "do": 76 /* DoKeyword */, - "else": 77 /* ElseKeyword */, - "enum": 78 /* EnumKeyword */, - "export": 79 /* ExportKeyword */, - "extends": 80 /* ExtendsKeyword */, - "false": 81 /* FalseKeyword */, - "finally": 82 /* FinallyKeyword */, - "for": 83 /* ForKeyword */, - "from": 130 /* FromKeyword */, - "function": 84 /* FunctionKeyword */, - "get": 120 /* GetKeyword */, - "if": 85 /* IfKeyword */, - "implements": 103 /* ImplementsKeyword */, - "import": 86 /* ImportKeyword */, - "in": 87 /* InKeyword */, - "instanceof": 88 /* InstanceOfKeyword */, - "interface": 104 /* InterfaceKeyword */, - "is": 121 /* IsKeyword */, - "let": 105 /* LetKeyword */, - "module": 122 /* ModuleKeyword */, - "namespace": 123 /* NamespaceKeyword */, - "new": 89 /* NewKeyword */, - "null": 90 /* NullKeyword */, - "number": 125 /* NumberKeyword */, - "package": 106 /* PackageKeyword */, - "private": 107 /* PrivateKeyword */, - "protected": 108 /* ProtectedKeyword */, - "public": 109 /* PublicKeyword */, - "require": 124 /* RequireKeyword */, - "return": 91 /* ReturnKeyword */, - "set": 126 /* SetKeyword */, - "static": 110 /* StaticKeyword */, - "string": 127 /* StringKeyword */, - "super": 92 /* SuperKeyword */, - "switch": 93 /* SwitchKeyword */, - "symbol": 128 /* SymbolKeyword */, - "this": 94 /* ThisKeyword */, - "throw": 95 /* ThrowKeyword */, - "true": 96 /* TrueKeyword */, - "try": 97 /* TryKeyword */, - "type": 129 /* TypeKeyword */, - "typeof": 98 /* TypeOfKeyword */, - "var": 99 /* VarKeyword */, - "void": 100 /* VoidKeyword */, - "while": 101 /* WhileKeyword */, - "with": 102 /* WithKeyword */, - "yield": 111 /* YieldKeyword */, - "async": 115 /* AsyncKeyword */, - "await": 116 /* AwaitKeyword */, - "of": 131 /* OfKeyword */, - "{": 14 /* OpenBraceToken */, - "}": 15 /* CloseBraceToken */, - "(": 16 /* OpenParenToken */, - ")": 17 /* CloseParenToken */, - "[": 18 /* OpenBracketToken */, - "]": 19 /* CloseBracketToken */, - ".": 20 /* DotToken */, - "...": 21 /* DotDotDotToken */, - ";": 22 /* SemicolonToken */, - ",": 23 /* CommaToken */, - "<": 24 /* LessThanToken */, - ">": 26 /* GreaterThanToken */, - "<=": 27 /* LessThanEqualsToken */, - ">=": 28 /* GreaterThanEqualsToken */, - "==": 29 /* EqualsEqualsToken */, - "!=": 30 /* ExclamationEqualsToken */, - "===": 31 /* EqualsEqualsEqualsToken */, - "!==": 32 /* ExclamationEqualsEqualsToken */, - "=>": 33 /* EqualsGreaterThanToken */, - "+": 34 /* PlusToken */, - "-": 35 /* MinusToken */, - "*": 36 /* AsteriskToken */, - "/": 37 /* SlashToken */, - "%": 38 /* PercentToken */, - "++": 39 /* PlusPlusToken */, - "--": 40 /* MinusMinusToken */, - "<<": 41 /* LessThanLessThanToken */, - ">": 42 /* GreaterThanGreaterThanToken */, - ">>>": 43 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 44 /* AmpersandToken */, - "|": 45 /* BarToken */, - "^": 46 /* CaretToken */, - "!": 47 /* ExclamationToken */, - "~": 48 /* TildeToken */, - "&&": 49 /* AmpersandAmpersandToken */, - "||": 50 /* BarBarToken */, - "?": 51 /* QuestionToken */, - ":": 52 /* ColonToken */, - "=": 54 /* EqualsToken */, - "+=": 55 /* PlusEqualsToken */, - "-=": 56 /* MinusEqualsToken */, - "*=": 57 /* AsteriskEqualsToken */, - "/=": 58 /* SlashEqualsToken */, - "%=": 59 /* PercentEqualsToken */, - "<<=": 60 /* LessThanLessThanEqualsToken */, - ">>=": 61 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 63 /* AmpersandEqualsToken */, - "|=": 64 /* BarEqualsToken */, - "^=": 65 /* CaretEqualsToken */, - "@": 53 /* AtToken */ + "abstract": 113 /* AbstractKeyword */, + "any": 115 /* AnyKeyword */, + "as": 114 /* AsKeyword */, + "boolean": 118 /* BooleanKeyword */, + "break": 68 /* BreakKeyword */, + "case": 69 /* CaseKeyword */, + "catch": 70 /* CatchKeyword */, + "class": 71 /* ClassKeyword */, + "continue": 73 /* ContinueKeyword */, + "const": 72 /* ConstKeyword */, + "constructor": 119 /* ConstructorKeyword */, + "debugger": 74 /* DebuggerKeyword */, + "declare": 120 /* DeclareKeyword */, + "default": 75 /* DefaultKeyword */, + "delete": 76 /* DeleteKeyword */, + "do": 77 /* DoKeyword */, + "else": 78 /* ElseKeyword */, + "enum": 79 /* EnumKeyword */, + "export": 80 /* ExportKeyword */, + "extends": 81 /* ExtendsKeyword */, + "false": 82 /* FalseKeyword */, + "finally": 83 /* FinallyKeyword */, + "for": 84 /* ForKeyword */, + "from": 131 /* FromKeyword */, + "function": 85 /* FunctionKeyword */, + "get": 121 /* GetKeyword */, + "if": 86 /* IfKeyword */, + "implements": 104 /* ImplementsKeyword */, + "import": 87 /* ImportKeyword */, + "in": 88 /* InKeyword */, + "instanceof": 89 /* InstanceOfKeyword */, + "interface": 105 /* InterfaceKeyword */, + "is": 122 /* IsKeyword */, + "let": 106 /* LetKeyword */, + "module": 123 /* ModuleKeyword */, + "namespace": 124 /* NamespaceKeyword */, + "new": 90 /* NewKeyword */, + "null": 91 /* NullKeyword */, + "number": 126 /* NumberKeyword */, + "package": 107 /* PackageKeyword */, + "private": 108 /* PrivateKeyword */, + "protected": 109 /* ProtectedKeyword */, + "public": 110 /* PublicKeyword */, + "require": 125 /* RequireKeyword */, + "return": 92 /* ReturnKeyword */, + "set": 127 /* SetKeyword */, + "static": 111 /* StaticKeyword */, + "string": 128 /* StringKeyword */, + "super": 93 /* SuperKeyword */, + "switch": 94 /* SwitchKeyword */, + "symbol": 129 /* SymbolKeyword */, + "this": 95 /* ThisKeyword */, + "throw": 96 /* ThrowKeyword */, + "true": 97 /* TrueKeyword */, + "try": 98 /* TryKeyword */, + "type": 130 /* TypeKeyword */, + "typeof": 99 /* TypeOfKeyword */, + "var": 100 /* VarKeyword */, + "void": 101 /* VoidKeyword */, + "while": 102 /* WhileKeyword */, + "with": 103 /* WithKeyword */, + "yield": 112 /* YieldKeyword */, + "async": 116 /* AsyncKeyword */, + "await": 117 /* AwaitKeyword */, + "of": 132 /* OfKeyword */, + "{": 15 /* OpenBraceToken */, + "}": 16 /* CloseBraceToken */, + "(": 17 /* OpenParenToken */, + ")": 18 /* CloseParenToken */, + "[": 19 /* OpenBracketToken */, + "]": 20 /* CloseBracketToken */, + ".": 21 /* DotToken */, + "...": 22 /* DotDotDotToken */, + ";": 23 /* SemicolonToken */, + ",": 24 /* CommaToken */, + "<": 25 /* LessThanToken */, + ">": 27 /* GreaterThanToken */, + "<=": 28 /* LessThanEqualsToken */, + ">=": 29 /* GreaterThanEqualsToken */, + "==": 30 /* EqualsEqualsToken */, + "!=": 31 /* ExclamationEqualsToken */, + "===": 32 /* EqualsEqualsEqualsToken */, + "!==": 33 /* ExclamationEqualsEqualsToken */, + "=>": 34 /* EqualsGreaterThanToken */, + "+": 35 /* PlusToken */, + "-": 36 /* MinusToken */, + "*": 37 /* AsteriskToken */, + "/": 38 /* SlashToken */, + "%": 39 /* PercentToken */, + "++": 40 /* PlusPlusToken */, + "--": 41 /* MinusMinusToken */, + "<<": 42 /* LessThanLessThanToken */, + ">": 43 /* GreaterThanGreaterThanToken */, + ">>>": 44 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 45 /* AmpersandToken */, + "|": 46 /* BarToken */, + "^": 47 /* CaretToken */, + "!": 48 /* ExclamationToken */, + "~": 49 /* TildeToken */, + "&&": 50 /* AmpersandAmpersandToken */, + "||": 51 /* BarBarToken */, + "?": 52 /* QuestionToken */, + ":": 53 /* ColonToken */, + "=": 55 /* EqualsToken */, + "+=": 56 /* PlusEqualsToken */, + "-=": 57 /* MinusEqualsToken */, + "*=": 58 /* AsteriskEqualsToken */, + "/=": 59 /* SlashEqualsToken */, + "%=": 60 /* PercentEqualsToken */, + "<<=": 61 /* LessThanLessThanEqualsToken */, + ">>=": 62 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 64 /* AmpersandEqualsToken */, + "|=": 65 /* BarEqualsToken */, + "^=": 66 /* CaretEqualsToken */, + "@": 54 /* AtToken */ }; /* As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers @@ -2730,14 +2745,21 @@ var ts; } ts.getLineStarts = getLineStarts; /* @internal */ + /** + * We assume the first line starts at position 0 and 'position' is non-negative. + */ function computeLineAndCharacterOfPosition(lineStarts, position) { var lineNumber = ts.binarySearch(lineStarts, position); if (lineNumber < 0) { // If the actual position was not found, - // the binary search returns the negative value of the next line start + // the binary search returns the 2's-complement 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 + // then the search will return -2. + // + // We want the index of the previous line start, so we subtract 1. + // Review 2's-complement if this is confusing. lineNumber = ~lineNumber - 1; + ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); } return { line: lineNumber, @@ -2809,6 +2831,9 @@ var ts; case 62 /* greaterThan */: // Starts of conflict marker trivia return true; + case 35 /* hash */: + // Only if its the beginning can we have #! trivia + return pos === 0; default: return ch > 127 /* maxAsciiCharacter */; } @@ -2867,6 +2892,12 @@ var ts; continue; } break; + case 35 /* hash */: + if (pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + continue; + } + break; default: if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { pos++; @@ -2923,13 +2954,28 @@ var ts; } return pos; } - // Extract comments from the given source text starting at the given position. If trailing is - // false, whitespace is skipped until the first line break and comments between that location - // and the next token are returned.If trailing is true, comments occurring between the given - // position and the next line break are returned.The return value is an array containing a - // TextRange for each comment. Single-line comment ranges include the beginning '//' characters - // but not the ending line break. Multi - line comment ranges include the beginning '/* and - // ending '*/' characters.The return value is undefined if no comments were found. + var shebangTriviaRegex = /^#!.*/; + function isShebangTrivia(text, pos) { + // Shebangs check must only be done at the start of the file + ts.Debug.assert(pos === 0); + return shebangTriviaRegex.test(text); + } + function scanShebangTrivia(text, pos) { + var shebang = shebangTriviaRegex.exec(text)[0]; + pos = pos + shebang.length; + return pos; + } + /** + * Extract comments from text prefixing the token closest following `pos`. + * The return value is an array containing a TextRange for each comment. + * Single-line comment ranges include the beginning '//' characters but not the ending line break. + * Multi - line comment ranges include the beginning '/* and ending '/' characters. + * The return value is undefined if no comments were found. + * @param trailing + * If false, whitespace is skipped until the first line break and comments between that location + * and the next token are returned. + * If true, comments occurring between the given position and the next line break are returned. + */ function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; @@ -3004,13 +3050,20 @@ var ts; } } function getLeadingCommentRanges(text, pos) { - return getCommentRanges(text, pos, false); + return getCommentRanges(text, pos, /*trailing*/ false); } ts.getLeadingCommentRanges = getLeadingCommentRanges; function getTrailingCommentRanges(text, pos) { - return getCommentRanges(text, pos, true); + return getCommentRanges(text, pos, /*trailing*/ true); } ts.getTrailingCommentRanges = getTrailingCommentRanges; + /** Optionally, get the shebang */ + function getShebang(text) { + return shebangTriviaRegex.test(text) + ? shebangTriviaRegex.exec(text)[0] + : undefined; + } + ts.getShebang = getShebang; function isIdentifierStart(ch, languageVersion) { return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || @@ -3023,7 +3076,6 @@ var ts; ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; - /* @internal */ // Creates a scanner over a (possibly unspecified) range of a piece of text. function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { if (languageVariant === void 0) { languageVariant = 0 /* Standard */; } @@ -3050,8 +3102,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 66 /* Identifier */ || token > 102 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 67 /* FirstReservedWord */ && token <= 102 /* LastReservedWord */; }, + isIdentifier: function () { return token === 67 /* Identifier */ || token > 103 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 68 /* FirstReservedWord */ && token <= 103 /* LastReservedWord */; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -3121,14 +3173,14 @@ var ts; * returning -1 if the given number is unavailable. */ function scanExactNumberOfHexDigits(count) { - return scanHexDigits(count, false); + return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false); } /** * Scans as many hexadecimal digits as are available in the text, * returning -1 if the given number of digits was unavailable. */ function scanMinimumNumberOfHexDigits(count) { - return scanHexDigits(count, true); + return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true); } function scanHexDigits(minCount, scanAsManyAsPossible) { var digits = 0; @@ -3203,7 +3255,7 @@ var ts; contents += text.substring(start, pos); tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 10 /* NoSubstitutionTemplateLiteral */ : 13 /* TemplateTail */; + resultingToken = startedWithBacktick ? 11 /* NoSubstitutionTemplateLiteral */ : 14 /* TemplateTail */; break; } var currChar = text.charCodeAt(pos); @@ -3211,14 +3263,14 @@ var ts; if (currChar === 96 /* backtick */) { contents += text.substring(start, pos); pos++; - resultingToken = startedWithBacktick ? 10 /* NoSubstitutionTemplateLiteral */ : 13 /* TemplateTail */; + resultingToken = startedWithBacktick ? 11 /* NoSubstitutionTemplateLiteral */ : 14 /* TemplateTail */; break; } // '${' if (currChar === 36 /* $ */ && pos + 1 < end && text.charCodeAt(pos + 1) === 123 /* openBrace */) { contents += text.substring(start, pos); pos += 2; - resultingToken = startedWithBacktick ? 11 /* TemplateHead */ : 12 /* TemplateMiddle */; + resultingToken = startedWithBacktick ? 12 /* TemplateHead */ : 13 /* TemplateMiddle */; break; } // Escape character @@ -3280,10 +3332,10 @@ var ts; return scanExtendedUnicodeEscape(); } // '\uDDDD' - return scanHexadecimalEscape(4); + return scanHexadecimalEscape(/*numDigits*/ 4); case 120 /* x */: // '\xDD' - return scanHexadecimalEscape(2); + return scanHexadecimalEscape(/*numDigits*/ 2); // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence), // the line terminator is interpreted to be "the empty code unit sequence". case 13 /* carriageReturn */: @@ -3395,7 +3447,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 66 /* Identifier */; + return token = 67 /* Identifier */; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -3430,6 +3482,16 @@ var ts; return token = 1 /* EndOfFileToken */; } var ch = text.charCodeAt(pos); + // Special handling for shebang + if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia) { + continue; + } + else { + return token = 6 /* ShebangTrivia */; + } + } switch (ch) { case 10 /* lineFeed */: case 13 /* carriageReturn */: @@ -3465,66 +3527,66 @@ var ts; case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 32 /* ExclamationEqualsEqualsToken */; + return pos += 3, token = 33 /* ExclamationEqualsEqualsToken */; } - return pos += 2, token = 30 /* ExclamationEqualsToken */; + return pos += 2, token = 31 /* ExclamationEqualsToken */; } - return pos++, token = 47 /* ExclamationToken */; + return pos++, token = 48 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); - return token = 8 /* StringLiteral */; + return token = 9 /* StringLiteral */; case 96 /* backtick */: return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 59 /* PercentEqualsToken */; + return pos += 2, token = 60 /* PercentEqualsToken */; } - return pos++, token = 38 /* PercentToken */; + return pos++, token = 39 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 49 /* AmpersandAmpersandToken */; + return pos += 2, token = 50 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 63 /* AmpersandEqualsToken */; + return pos += 2, token = 64 /* AmpersandEqualsToken */; } - return pos++, token = 44 /* AmpersandToken */; + return pos++, token = 45 /* AmpersandToken */; case 40 /* openParen */: - return pos++, token = 16 /* OpenParenToken */; + return pos++, token = 17 /* OpenParenToken */; case 41 /* closeParen */: - return pos++, token = 17 /* CloseParenToken */; + return pos++, token = 18 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 57 /* AsteriskEqualsToken */; + return pos += 2, token = 58 /* AsteriskEqualsToken */; } - return pos++, token = 36 /* AsteriskToken */; + return pos++, token = 37 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 39 /* PlusPlusToken */; + return pos += 2, token = 40 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 55 /* PlusEqualsToken */; + return pos += 2, token = 56 /* PlusEqualsToken */; } - return pos++, token = 34 /* PlusToken */; + return pos++, token = 35 /* PlusToken */; case 44 /* comma */: - return pos++, token = 23 /* CommaToken */; + return pos++, token = 24 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 40 /* MinusMinusToken */; + return pos += 2, token = 41 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* MinusEqualsToken */; + return pos += 2, token = 57 /* MinusEqualsToken */; } - return pos++, token = 35 /* MinusToken */; + return pos++, token = 36 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 21 /* DotDotDotToken */; + return pos += 3, token = 22 /* DotDotDotToken */; } - return pos++, token = 20 /* DotToken */; + return pos++, token = 21 /* DotToken */; case 47 /* slash */: // Single-line comment if (text.charCodeAt(pos + 1) === 47 /* slash */) { @@ -3570,9 +3632,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* SlashEqualsToken */; + return pos += 2, token = 59 /* SlashEqualsToken */; } - return pos++, token = 37 /* SlashToken */; + return pos++, token = 38 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -3582,32 +3644,32 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) { pos += 2; - var value = scanBinaryOrOctalDigits(2); + var value = scanBinaryOrOctalDigits(/* base */ 2); if (value < 0) { error(ts.Diagnostics.Binary_digit_expected); value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { pos += 2; - var value = scanBinaryOrOctalDigits(8); + var value = scanBinaryOrOctalDigits(/* base */ 8); if (value < 0) { error(ts.Diagnostics.Octal_digit_expected); value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } // Try to parse as an octal if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } // This fall-through is a deviation from the EcmaScript grammar. The grammar says that a leading zero // can only be followed by an octal digit, a dot, or the end of the number literal. However, we are being @@ -3622,11 +3684,11 @@ var ts; case 56 /* _8 */: case 57 /* _9 */: tokenValue = "" + scanNumber(); - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 52 /* ColonToken */; + return pos++, token = 53 /* ColonToken */; case 59 /* semicolon */: - return pos++, token = 22 /* SemicolonToken */; + return pos++, token = 23 /* SemicolonToken */; case 60 /* lessThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3634,22 +3696,22 @@ var ts; continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 7 /* ConflictMarkerTrivia */; } } if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 60 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 61 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 41 /* LessThanLessThanToken */; + return pos += 2, token = 42 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 27 /* LessThanEqualsToken */; + return pos += 2, token = 28 /* LessThanEqualsToken */; } if (text.charCodeAt(pos + 1) === 47 /* slash */ && languageVariant === 1 /* JSX */) { - return pos += 2, token = 25 /* LessThanSlashToken */; + return pos += 2, token = 26 /* LessThanSlashToken */; } - return pos++, token = 24 /* LessThanToken */; + return pos++, token = 25 /* LessThanToken */; case 61 /* equals */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3657,19 +3719,19 @@ var ts; continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 7 /* ConflictMarkerTrivia */; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 31 /* EqualsEqualsEqualsToken */; + return pos += 3, token = 32 /* EqualsEqualsEqualsToken */; } - return pos += 2, token = 29 /* EqualsEqualsToken */; + return pos += 2, token = 30 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 33 /* EqualsGreaterThanToken */; + return pos += 2, token = 34 /* EqualsGreaterThanToken */; } - return pos++, token = 54 /* EqualsToken */; + return pos++, token = 55 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3677,37 +3739,37 @@ var ts; continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 7 /* ConflictMarkerTrivia */; } } - return pos++, token = 26 /* GreaterThanToken */; + return pos++, token = 27 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 51 /* QuestionToken */; + return pos++, token = 52 /* QuestionToken */; case 91 /* openBracket */: - return pos++, token = 18 /* OpenBracketToken */; + return pos++, token = 19 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos++, token = 19 /* CloseBracketToken */; + return pos++, token = 20 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 65 /* CaretEqualsToken */; + return pos += 2, token = 66 /* CaretEqualsToken */; } - return pos++, token = 46 /* CaretToken */; + return pos++, token = 47 /* CaretToken */; case 123 /* openBrace */: - return pos++, token = 14 /* OpenBraceToken */; + return pos++, token = 15 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 50 /* BarBarToken */; + return pos += 2, token = 51 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 64 /* BarEqualsToken */; + return pos += 2, token = 65 /* BarEqualsToken */; } - return pos++, token = 45 /* BarToken */; + return pos++, token = 46 /* BarToken */; case 125 /* closeBrace */: - return pos++, token = 15 /* CloseBraceToken */; + return pos++, token = 16 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 48 /* TildeToken */; + return pos++, token = 49 /* TildeToken */; case 64 /* at */: - return pos++, token = 53 /* AtToken */; + return pos++, token = 54 /* AtToken */; case 92 /* backslash */: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { @@ -3743,27 +3805,27 @@ var ts; } } function reScanGreaterToken() { - if (token === 26 /* GreaterThanToken */) { + if (token === 27 /* 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 = 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 43 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 44 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 61 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 62 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 42 /* GreaterThanGreaterThanToken */; + return pos++, token = 43 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 28 /* GreaterThanEqualsToken */; + return pos++, token = 29 /* GreaterThanEqualsToken */; } } return token; } function reScanSlashToken() { - if (token === 37 /* SlashToken */ || token === 58 /* SlashEqualsToken */) { + if (token === 38 /* SlashToken */ || token === 59 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -3808,7 +3870,7 @@ var ts; } pos = p; tokenValue = text.substring(tokenPos, pos); - token = 9 /* RegularExpressionLiteral */; + token = 10 /* RegularExpressionLiteral */; } return token; } @@ -3816,7 +3878,7 @@ var ts; * Unconditionally back up and scan a template expression portion. */ function reScanTemplateToken() { - ts.Debug.assert(token === 15 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + ts.Debug.assert(token === 16 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); pos = tokenPos; return token = scanTemplateAndSetTokenValue(); } @@ -3833,14 +3895,14 @@ var ts; if (char === 60 /* lessThan */) { if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; - return token = 25 /* LessThanSlashToken */; + return token = 26 /* LessThanSlashToken */; } pos++; - return token = 24 /* LessThanToken */; + return token = 25 /* LessThanToken */; } if (char === 123 /* openBrace */) { pos++; - return token = 14 /* OpenBraceToken */; + return token = 15 /* OpenBraceToken */; } while (pos < end) { pos++; @@ -3849,12 +3911,12 @@ var ts; break; } } - return token = 233 /* JsxText */; + return token = 234 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes function scanJsxIdentifier() { - if (token === 66 /* Identifier */) { + if (token === 67 /* Identifier */) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); @@ -3890,10 +3952,10 @@ var ts; return result; } function lookAhead(callback) { - return speculationHelper(callback, true); + return speculationHelper(callback, /*isLookahead:*/ true); } function tryScan(callback) { - return speculationHelper(callback, false); + return speculationHelper(callback, /*isLookahead:*/ false); } function setText(newText, start, length) { text = newText || ""; @@ -3937,16 +3999,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 212 /* InterfaceDeclaration */ || node.kind === 213 /* TypeAliasDeclaration */) { + if (node.kind === 213 /* InterfaceDeclaration */ || node.kind === 214 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 219 /* ImportDeclaration */ || node.kind === 218 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 220 /* ImportDeclaration */ || node.kind === 219 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 216 /* ModuleBlock */) { + else if (node.kind === 217 /* ModuleBlock */) { var state = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3965,7 +4027,7 @@ var ts; }); return state; } - else if (node.kind === 215 /* ModuleDeclaration */) { + else if (node.kind === 216 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -4043,10 +4105,10 @@ var ts; // unless it is a well known Symbol. function getDeclarationName(node) { if (node.name) { - if (node.kind === 215 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { - return '"' + node.name.text + '"'; + if (node.kind === 216 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + return "\"" + node.name.text + "\""; } - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -4054,22 +4116,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 141 /* Constructor */: + case 142 /* Constructor */: return "__constructor"; - case 149 /* FunctionType */: - case 144 /* CallSignature */: + case 150 /* FunctionType */: + case 145 /* CallSignature */: return "__call"; - case 150 /* ConstructorType */: - case 145 /* ConstructSignature */: + case 151 /* ConstructorType */: + case 146 /* ConstructSignature */: return "__new"; - case 146 /* IndexSignature */: + case 147 /* IndexSignature */: return "__index"; - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return "__export"; - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 210 /* FunctionDeclaration */: - case 211 /* ClassDeclaration */: + case 211 /* FunctionDeclaration */: + case 212 /* ClassDeclaration */: return node.flags & 1024 /* Default */ ? "default" : undefined; } } @@ -4140,7 +4202,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 227 /* ExportSpecifier */ || (node.kind === 218 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 228 /* ExportSpecifier */ || (node.kind === 219 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -4221,37 +4283,37 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 183 /* ClassExpression */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 152 /* TypeLiteral */: - case 162 /* ObjectLiteralExpression */: + case 184 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 153 /* TypeLiteral */: + case 163 /* ObjectLiteralExpression */: return 1 /* IsContainer */; - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 210 /* FunctionDeclaration */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 215 /* ModuleDeclaration */: - case 245 /* SourceFile */: - case 213 /* TypeAliasDeclaration */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 211 /* FunctionDeclaration */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 216 /* ModuleDeclaration */: + case 246 /* SourceFile */: + case 214 /* TypeAliasDeclaration */: return 5 /* IsContainerWithLocals */; - case 241 /* CatchClause */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 217 /* CaseBlock */: + case 242 /* CatchClause */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 218 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 189 /* Block */: + case 190 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Othewise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -4288,38 +4350,38 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 183 /* ClassExpression */: - case 211 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 212 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 152 /* TypeLiteral */: - case 162 /* ObjectLiteralExpression */: - case 212 /* InterfaceDeclaration */: + case 153 /* TypeLiteral */: + case 163 /* ObjectLiteralExpression */: + case 213 /* InterfaceDeclaration */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 213 /* TypeAliasDeclaration */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 214 /* TypeAliasDeclaration */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -4349,11 +4411,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 245 /* SourceFile */ ? node : node.body; - if (body.kind === 245 /* SourceFile */ || body.kind === 216 /* ModuleBlock */) { + var body = node.kind === 246 /* SourceFile */ ? node : node.body; + if (body.kind === 246 /* SourceFile */ || body.kind === 217 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 225 /* ExportDeclaration */ || stat.kind === 224 /* ExportAssignment */) { + if (stat.kind === 226 /* ExportDeclaration */ || stat.kind === 225 /* ExportAssignment */) { return true; } } @@ -4372,7 +4434,7 @@ var ts; } function bindModuleDeclaration(node) { setExportContextFlag(node); - if (node.name.kind === 8 /* StringLiteral */) { + if (node.name.kind === 9 /* StringLiteral */) { declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); } else { @@ -4382,14 +4444,21 @@ var ts; } else { declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); - var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */; - if (node.symbol.constEnumOnlyModule === undefined) { - // non-merged case - use the current state - node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) { + // if module was already merged with some function, class or non-const enum + // treat is a non-const-enum-only + node.symbol.constEnumOnlyModule = false; } else { - // merged case: module is const enum only if all its pieces are non-instantiated or const enum - node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */; + if (node.symbol.constEnumOnlyModule === undefined) { + // non-merged case - use the current state + node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + } + else { + // merged case: module is const enum only if all its pieces are non-instantiated or const enum + node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + } } } } @@ -4418,7 +4487,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 66 /* Identifier */) { + if (prop.name.kind !== 67 /* Identifier */) { continue; } var identifier = prop.name; @@ -4430,7 +4499,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 242 /* PropertyAssignment */ || prop.kind === 243 /* ShorthandPropertyAssignment */ || prop.kind === 140 /* MethodDeclaration */ + var currentKind = prop.kind === 243 /* PropertyAssignment */ || prop.kind === 244 /* ShorthandPropertyAssignment */ || prop.kind === 141 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -4452,10 +4521,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -4476,8 +4545,8 @@ var ts; // check for reserved words used as identifiers in strict mode code. function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 103 /* FirstFutureReservedWord */ && - node.originalKeywordKind <= 111 /* LastFutureReservedWord */ && + node.originalKeywordKind >= 104 /* FirstFutureReservedWord */ && + node.originalKeywordKind <= 112 /* LastFutureReservedWord */ && !ts.isIdentifierName(node)) { // Report error only if there are no parse errors in file if (!file.parseDiagnostics.length) { @@ -4512,7 +4581,7 @@ var ts; } function checkStrictModeDeleteExpression(node) { // Grammar checking - if (inStrictMode && node.expression.kind === 66 /* Identifier */) { + if (inStrictMode && node.expression.kind === 67 /* Identifier */) { // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its // UnaryExpression is a direct reference to a variable, function argument, or function name var span = ts.getErrorSpanForNode(file, node.expression); @@ -4520,11 +4589,11 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 66 /* Identifier */ && + return node.kind === 67 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 66 /* Identifier */) { + if (name && name.kind === 67 /* Identifier */) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { // We check first if the name is inside class declaration or class expression; if so give explicit message @@ -4568,7 +4637,7 @@ var ts; function checkStrictModePrefixUnaryExpression(node) { // Grammar checking if (inStrictMode) { - if (node.operator === 39 /* PlusPlusToken */ || node.operator === 40 /* MinusMinusToken */) { + if (node.operator === 40 /* PlusPlusToken */ || node.operator === 41 /* MinusMinusToken */) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -4612,17 +4681,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 245 /* SourceFile */: - case 216 /* ModuleBlock */: + case 246 /* SourceFile */: + case 217 /* ModuleBlock */: updateStrictModeStatementList(node.statements); return; - case 189 /* Block */: + case 190 /* Block */: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return; @@ -4645,103 +4714,103 @@ var ts; var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the // string to contain unicode escapes (as per ES5). - return nodeText === '"use strict"' || nodeText === "'use strict'"; + return nodeText === "\"use strict\"" || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return checkStrictModeIdentifier(node); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return checkStrictModeBinaryExpression(node); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return checkStrictModeCatchClause(node); - case 172 /* DeleteExpression */: + case 173 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 177 /* PostfixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 202 /* WithStatement */: + case 203 /* WithStatement */: return checkStrictModeWithStatement(node); - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 135 /* Parameter */: + case 136 /* Parameter */: return bindParameter(node); - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 242 /* PropertyAssignment */: - case 243 /* ShorthandPropertyAssignment */: + case 243 /* PropertyAssignment */: + case 244 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); - case 141 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, 0 /* None */); - case 142 /* GetAccessor */: + case 142 /* Constructor */: + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); + case 143 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 143 /* SetAccessor */: + case 144 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: return bindFunctionOrConstructorType(node); - case 152 /* TypeLiteral */: + case 153 /* TypeLiteral */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); - case 183 /* ClassExpression */: - case 211 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 212 /* ClassDeclaration */: return bindClassLikeDeclaration(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return bindModuleDeclaration(node); - case 218 /* ImportEqualsDeclaration */: - case 221 /* NamespaceImport */: - case 223 /* ImportSpecifier */: - case 227 /* ExportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 222 /* NamespaceImport */: + case 224 /* ImportSpecifier */: + case 228 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 220 /* ImportClause */: + case 221 /* ImportClause */: return bindImportClause(node); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return bindExportDeclaration(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return bindExportAssignment(node); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return bindSourceFileIfExternalModule(); } } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512 /* ValueModule */, '"' + ts.removeFileExtension(file.fileName) + '"'); + bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); } } function bindExportAssignment(node) { @@ -4749,7 +4818,7 @@ var ts; // Export assignment in some sort of block construct bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } - else if (node.expression.kind === 66 /* Identifier */) { + else if (node.expression.kind === 67 /* Identifier */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } @@ -4774,7 +4843,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -4846,7 +4915,7 @@ var ts; // If this is a property-parameter, then also declare the property symbol into the // containing class. if (node.flags & 112 /* AccessibilityModifier */ && - node.parent.kind === 141 /* Constructor */ && + node.parent.kind === 142 /* Constructor */ && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); @@ -4912,6 +4981,37 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; + function arrayIsEqualTo(arr1, arr2, comparer) { + if (!arr1 || !arr2) { + return arr1 === arr2; + } + if (arr1.length !== arr2.length) { + return false; + } + for (var i = 0; i < arr1.length; ++i) { + var equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i]; + if (!equals) { + return false; + } + } + return true; + } + ts.arrayIsEqualTo = arrayIsEqualTo; + function hasResolvedModuleName(sourceFile, moduleNameText) { + return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); + } + ts.hasResolvedModuleName = hasResolvedModuleName; + function getResolvedModuleFileName(sourceFile, moduleNameText) { + return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + } + ts.getResolvedModuleFileName = getResolvedModuleFileName; + function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) { + if (!sourceFile.resolvedModules) { + sourceFile.resolvedModules = {}; + } + sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + } + ts.setResolvedModuleName = setResolvedModuleName; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); @@ -4936,7 +5036,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 245 /* SourceFile */) { + while (node && node.kind !== 246 /* SourceFile */) { node = node.parent; } return node; @@ -5031,7 +5131,7 @@ var ts; // Make an identifier from an external module name by extracting the string after the last "/" and replacing // all non-alphanumeric characters with underscores function makeIdentifierFromModuleName(moduleName) { - return ts.getBaseFileName(moduleName).replace(/\W/g, "_"); + return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { @@ -5048,15 +5148,15 @@ var ts; return current; } switch (current.kind) { - case 245 /* SourceFile */: - case 217 /* CaseBlock */: - case 241 /* CatchClause */: - case 215 /* ModuleDeclaration */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 246 /* SourceFile */: + case 218 /* CaseBlock */: + case 242 /* CatchClause */: + case 216 /* ModuleDeclaration */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: return current; - case 189 /* Block */: + case 190 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -5069,9 +5169,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 208 /* VariableDeclaration */ && + declaration.kind === 209 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 241 /* CatchClause */; + declaration.parent.kind === 242 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -5101,7 +5201,7 @@ var ts; } ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; function getSpanOfTokenAtPosition(sourceFile, pos) { - var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos); + var scanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.languageVariant, sourceFile.text, /*onError:*/ undefined, pos); scanner.scan(); var start = scanner.getTokenPos(); return ts.createTextSpanFromBounds(start, scanner.getTextPos()); @@ -5110,8 +5210,8 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 245 /* SourceFile */: - var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + case 246 /* SourceFile */: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file return ts.createTextSpan(0, 0); @@ -5119,16 +5219,16 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: - case 212 /* InterfaceDeclaration */: - case 215 /* ModuleDeclaration */: - case 214 /* EnumDeclaration */: - case 244 /* EnumMember */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 213 /* InterfaceDeclaration */: + case 216 /* ModuleDeclaration */: + case 215 /* EnumDeclaration */: + case 245 /* EnumMember */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: errorNode = node.name; break; } @@ -5152,11 +5252,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 214 /* EnumDeclaration */ && isConst(node); + return node.kind === 215 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 160 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 161 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -5171,14 +5271,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 208 /* VariableDeclaration */) { + if (node.kind === 209 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 209 /* VariableDeclarationList */) { + if (node && node.kind === 210 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 190 /* VariableStatement */) { + if (node && node.kind === 191 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -5193,25 +5293,18 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 192 /* ExpressionStatement */ && node.expression.kind === 8 /* StringLiteral */; + return node.kind === 193 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { - // If parameter/type parameter, the prev token trailing comments are part of this node too - if (node.kind === 135 /* Parameter */ || node.kind === 134 /* TypeParameter */) { - // e.g. (/** blah */ a, /** blah */ b); - // e.g.: ( - // /** blah */ a, - // /** blah */ b); - return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); - } - else { - return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); - } + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); + var commentRanges = (node.kind === 136 /* Parameter */ || node.kind === 135 /* TypeParameter */) ? + ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : + getLeadingCommentRangesOfNode(node, sourceFileOfNode); + return ts.filter(commentRanges, isJsDocComment); function isJsDocComment(comment) { // True if the comment starts with '/**' but not if it is '/**/' return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && @@ -5222,40 +5315,40 @@ var ts; ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (148 /* FirstTypeNode */ <= node.kind && node.kind <= 157 /* LastTypeNode */) { + if (149 /* FirstTypeNode */ <= node.kind && node.kind <= 158 /* LastTypeNode */) { return true; } switch (node.kind) { - case 114 /* AnyKeyword */: - case 125 /* NumberKeyword */: - case 127 /* StringKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: + case 115 /* AnyKeyword */: + case 126 /* NumberKeyword */: + case 128 /* StringKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: return true; - case 100 /* VoidKeyword */: - return node.parent.kind !== 174 /* VoidExpression */; - case 8 /* StringLiteral */: + case 101 /* VoidKeyword */: + return node.parent.kind !== 175 /* VoidExpression */; + case 9 /* StringLiteral */: // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === 135 /* Parameter */; - case 185 /* ExpressionWithTypeArguments */: + return node.parent.kind === 136 /* Parameter */; + case 186 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container - case 66 /* Identifier */: + case 67 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 132 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 163 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // fall through - case 132 /* QualifiedName */: - case 163 /* PropertyAccessExpression */: + case 133 /* QualifiedName */: + case 164 /* PropertyAccessExpression */: // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 66 /* Identifier */ || node.kind === 132 /* QualifiedName */ || node.kind === 163 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */ || node.kind === 164 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_1 = node.parent; - if (parent_1.kind === 151 /* TypeQuery */) { + if (parent_1.kind === 152 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -5264,38 +5357,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (148 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 157 /* LastTypeNode */) { + if (149 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 158 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: return node === parent_1.constraint; - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 135 /* Parameter */: - case 208 /* VariableDeclaration */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 136 /* Parameter */: + case 209 /* VariableDeclaration */: return node === parent_1.type; - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 141 /* Constructor */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 142 /* Constructor */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return node === parent_1.type; - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: return node === parent_1.type; - case 168 /* TypeAssertionExpression */: + case 169 /* TypeAssertionExpression */: return node === parent_1.type; - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -5309,23 +5402,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: return visitor(node); - case 217 /* CaseBlock */: - case 189 /* Block */: - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 202 /* WithStatement */: - case 203 /* SwitchStatement */: - case 238 /* CaseClause */: - case 239 /* DefaultClause */: - case 204 /* LabeledStatement */: - case 206 /* TryStatement */: - case 241 /* CatchClause */: + case 218 /* CaseBlock */: + case 190 /* Block */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 203 /* WithStatement */: + case 204 /* SwitchStatement */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: + case 205 /* LabeledStatement */: + case 207 /* TryStatement */: + case 242 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -5335,18 +5428,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 214 /* EnumDeclaration */: - case 212 /* InterfaceDeclaration */: - case 215 /* ModuleDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 215 /* EnumDeclaration */: + case 213 /* InterfaceDeclaration */: + case 216 /* ModuleDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. @@ -5354,7 +5447,7 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 133 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 134 /* ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(name_5.expression); @@ -5373,14 +5466,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 160 /* BindingElement */: - case 244 /* EnumMember */: - case 135 /* Parameter */: - case 242 /* PropertyAssignment */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 243 /* ShorthandPropertyAssignment */: - case 208 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 245 /* EnumMember */: + case 136 /* Parameter */: + case 243 /* PropertyAssignment */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 244 /* ShorthandPropertyAssignment */: + case 209 /* VariableDeclaration */: return true; } } @@ -5388,41 +5481,55 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 142 /* GetAccessor */ || node.kind === 143 /* SetAccessor */); + return node && (node.kind === 143 /* GetAccessor */ || node.kind === 144 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 211 /* ClassDeclaration */ || node.kind === 183 /* ClassExpression */); + return node && (node.kind === 212 /* ClassDeclaration */ || node.kind === 184 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 141 /* Constructor */: - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 142 /* Constructor */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: return true; } } return false; } ts.isFunctionLike = isFunctionLike; + function introducesArgumentsExoticObject(node) { + switch (node.kind) { + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + return true; + } + return false; + } + ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 189 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 190 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 140 /* MethodDeclaration */ && node.parent.kind === 162 /* ObjectLiteralExpression */; + return node && node.kind === 141 /* MethodDeclaration */ && node.parent.kind === 163 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -5450,7 +5557,7 @@ var ts; return undefined; } switch (node.kind) { - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -5465,9 +5572,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 136 /* Decorator */: + case 137 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 135 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 136 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -5478,23 +5585,23 @@ var ts; node = node.parent; } break; - case 171 /* ArrowFunction */: + case 172 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 215 /* ModuleDeclaration */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 214 /* EnumDeclaration */: - case 245 /* SourceFile */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 216 /* ModuleDeclaration */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 215 /* EnumDeclaration */: + case 246 /* SourceFile */: return node; } } @@ -5506,7 +5613,7 @@ var ts; if (!node) return node; switch (node.kind) { - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'super' container. // A computed property name in a class needs to be a super container @@ -5521,9 +5628,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 136 /* Decorator */: + case 137 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 135 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 136 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -5534,19 +5641,19 @@ var ts; node = node.parent; } break; - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: if (!includeFunctions) { continue; } - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return node; } } @@ -5555,12 +5662,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 148 /* TypeReference */: + case 149 /* TypeReference */: return node.typeName; - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return node.expression; - case 66 /* Identifier */: - case 132 /* QualifiedName */: + case 67 /* Identifier */: + case 133 /* QualifiedName */: return node; } } @@ -5568,7 +5675,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 167 /* TaggedTemplateExpression */) { + if (node.kind === 168 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -5577,44 +5684,44 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: // classes are valid targets return true; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 211 /* ClassDeclaration */; - case 135 /* Parameter */: + return node.parent.kind === 212 /* ClassDeclaration */; + case 136 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; - return node.parent.body && node.parent.parent.kind === 211 /* ClassDeclaration */; - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 140 /* MethodDeclaration */: + return node.parent.body && node.parent.parent.kind === 212 /* ClassDeclaration */; + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 141 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. - return node.body && node.parent.kind === 211 /* ClassDeclaration */; + return node.body && node.parent.kind === 212 /* ClassDeclaration */; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: if (node.decorators) { return true; } return false; - case 138 /* PropertyDeclaration */: - case 135 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 136 /* Parameter */: if (node.decorators) { return true; } return false; - case 142 /* GetAccessor */: + case 143 /* GetAccessor */: if (node.body && node.decorators) { return true; } return false; - case 140 /* MethodDeclaration */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 144 /* SetAccessor */: if (node.body && node.decorators) { return true; } @@ -5625,10 +5732,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 140 /* MethodDeclaration */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 144 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -5640,93 +5747,93 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function isExpression(node) { switch (node.kind) { - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: - case 90 /* NullKeyword */: - case 96 /* TrueKeyword */: - case 81 /* FalseKeyword */: - case 9 /* RegularExpressionLiteral */: - case 161 /* ArrayLiteralExpression */: - case 162 /* ObjectLiteralExpression */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 167 /* TaggedTemplateExpression */: - case 186 /* AsExpression */: - case 168 /* TypeAssertionExpression */: - case 169 /* ParenthesizedExpression */: - case 170 /* FunctionExpression */: - case 183 /* ClassExpression */: - case 171 /* ArrowFunction */: - case 174 /* VoidExpression */: - case 172 /* DeleteExpression */: - case 173 /* TypeOfExpression */: - case 176 /* PrefixUnaryExpression */: - case 177 /* PostfixUnaryExpression */: - case 178 /* BinaryExpression */: - case 179 /* ConditionalExpression */: - case 182 /* SpreadElementExpression */: - case 180 /* TemplateExpression */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 184 /* OmittedExpression */: - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: - case 181 /* YieldExpression */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: + case 91 /* NullKeyword */: + case 97 /* TrueKeyword */: + case 82 /* FalseKeyword */: + case 10 /* RegularExpressionLiteral */: + case 162 /* ArrayLiteralExpression */: + case 163 /* ObjectLiteralExpression */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 168 /* TaggedTemplateExpression */: + case 187 /* AsExpression */: + case 169 /* TypeAssertionExpression */: + case 170 /* ParenthesizedExpression */: + case 171 /* FunctionExpression */: + case 184 /* ClassExpression */: + case 172 /* ArrowFunction */: + case 175 /* VoidExpression */: + case 173 /* DeleteExpression */: + case 174 /* TypeOfExpression */: + case 177 /* PrefixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: + case 179 /* BinaryExpression */: + case 180 /* ConditionalExpression */: + case 183 /* SpreadElementExpression */: + case 181 /* TemplateExpression */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 185 /* OmittedExpression */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: + case 182 /* YieldExpression */: return true; - case 132 /* QualifiedName */: - while (node.parent.kind === 132 /* QualifiedName */) { + case 133 /* QualifiedName */: + while (node.parent.kind === 133 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 151 /* TypeQuery */; - case 66 /* Identifier */: - if (node.parent.kind === 151 /* TypeQuery */) { + return node.parent.kind === 152 /* TypeQuery */; + case 67 /* Identifier */: + if (node.parent.kind === 152 /* TypeQuery */) { return true; } // fall through - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: var parent_2 = node.parent; switch (parent_2.kind) { - case 208 /* VariableDeclaration */: - case 135 /* Parameter */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 244 /* EnumMember */: - case 242 /* PropertyAssignment */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 136 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 245 /* EnumMember */: + case 243 /* PropertyAssignment */: + case 161 /* BindingElement */: return parent_2.initializer === node; - case 192 /* ExpressionStatement */: - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 201 /* ReturnStatement */: - case 202 /* WithStatement */: - case 203 /* SwitchStatement */: - case 238 /* CaseClause */: - case 205 /* ThrowStatement */: - case 203 /* SwitchStatement */: + case 193 /* ExpressionStatement */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 202 /* ReturnStatement */: + case 203 /* WithStatement */: + case 204 /* SwitchStatement */: + case 239 /* CaseClause */: + case 206 /* ThrowStatement */: + case 204 /* SwitchStatement */: return parent_2.expression === node; - case 196 /* ForStatement */: + case 197 /* ForStatement */: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 209 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 210 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 209 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210 /* VariableDeclarationList */) || forInStatement.expression === node; - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: return node === parent_2.expression; - case 187 /* TemplateSpan */: + case 188 /* TemplateSpan */: return node === parent_2.expression; - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: return node === parent_2.expression; - case 136 /* Decorator */: + case 137 /* Decorator */: return true; - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -5744,7 +5851,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 218 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 229 /* ExternalModuleReference */; + return node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 230 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5753,20 +5860,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 218 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 229 /* ExternalModuleReference */; + return node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 230 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 219 /* ImportDeclaration */) { + if (node.kind === 220 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 218 /* ImportEqualsDeclaration */) { + if (node.kind === 219 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 229 /* ExternalModuleReference */) { + if (reference.kind === 230 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 225 /* ExportDeclaration */) { + if (node.kind === 226 /* ExportDeclaration */) { return node.moduleSpecifier; } } @@ -5774,15 +5881,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 135 /* Parameter */: - return node.questionToken !== undefined; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - return node.questionToken !== undefined; - case 243 /* ShorthandPropertyAssignment */: - case 242 /* PropertyAssignment */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 136 /* Parameter */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 244 /* ShorthandPropertyAssignment */: + case 243 /* PropertyAssignment */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -5790,9 +5895,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 258 /* JSDocFunctionType */ && + return node.kind === 259 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 260 /* JSDocConstructorType */; + node.parameters[0].type.kind === 261 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -5806,26 +5911,26 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 266 /* JSDocTypeTag */); + return getJSDocTag(node, 267 /* JSDocTypeTag */); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 265 /* JSDocReturnTag */); + return getJSDocTag(node, 266 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 267 /* JSDocTemplateTag */); + return getJSDocTag(node, 268 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 66 /* Identifier */) { + if (parameter.name && parameter.name.kind === 67 /* Identifier */) { // If it's a parameter, see if the parent has a jsdoc comment with an @param // annotation. var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 264 /* JSDocParameterTag */) { + if (t.kind === 265 /* JSDocParameterTag */) { var parameterTag = t; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -5844,12 +5949,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32 /* JavaScriptFile */) { - if (node.type && node.type.kind === 259 /* JSDocVariadicType */) { + if (node.type && node.type.kind === 260 /* JSDocVariadicType */) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 259 /* JSDocVariadicType */; + return paramTag.typeExpression.type.kind === 260 /* JSDocVariadicType */; } } return node.dotDotDotToken !== undefined; @@ -5858,19 +5963,19 @@ var ts; } ts.isRestParameter = isRestParameter; function isLiteralKind(kind) { - return 7 /* FirstLiteralToken */ <= kind && kind <= 10 /* LastLiteralToken */; + return 8 /* FirstLiteralToken */ <= kind && kind <= 11 /* LastLiteralToken */; } ts.isLiteralKind = isLiteralKind; function isTextualLiteralKind(kind) { - return kind === 8 /* StringLiteral */ || kind === 10 /* NoSubstitutionTemplateLiteral */; + return kind === 9 /* StringLiteral */ || kind === 11 /* NoSubstitutionTemplateLiteral */; } ts.isTextualLiteralKind = isTextualLiteralKind; function isTemplateLiteralKind(kind) { - return 10 /* FirstTemplateToken */ <= kind && kind <= 13 /* LastTemplateToken */; + return 11 /* FirstTemplateToken */ <= kind && kind <= 14 /* LastTemplateToken */; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 159 /* ArrayBindingPattern */ || node.kind === 158 /* ObjectBindingPattern */); + return !!node && (node.kind === 160 /* ArrayBindingPattern */ || node.kind === 159 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -5885,34 +5990,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 171 /* ArrowFunction */: - case 160 /* BindingElement */: - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: - case 141 /* Constructor */: - case 214 /* EnumDeclaration */: - case 244 /* EnumMember */: - case 227 /* ExportSpecifier */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 142 /* GetAccessor */: - case 220 /* ImportClause */: - case 218 /* ImportEqualsDeclaration */: - case 223 /* ImportSpecifier */: - case 212 /* InterfaceDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 215 /* ModuleDeclaration */: - case 221 /* NamespaceImport */: - case 135 /* Parameter */: - case 242 /* PropertyAssignment */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 143 /* SetAccessor */: - case 243 /* ShorthandPropertyAssignment */: - case 213 /* TypeAliasDeclaration */: - case 134 /* TypeParameter */: - case 208 /* VariableDeclaration */: + case 172 /* ArrowFunction */: + case 161 /* BindingElement */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 142 /* Constructor */: + case 215 /* EnumDeclaration */: + case 245 /* EnumMember */: + case 228 /* ExportSpecifier */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 143 /* GetAccessor */: + case 221 /* ImportClause */: + case 219 /* ImportEqualsDeclaration */: + case 224 /* ImportSpecifier */: + case 213 /* InterfaceDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 216 /* ModuleDeclaration */: + case 222 /* NamespaceImport */: + case 136 /* Parameter */: + case 243 /* PropertyAssignment */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 144 /* SetAccessor */: + case 244 /* ShorthandPropertyAssignment */: + case 214 /* TypeAliasDeclaration */: + case 135 /* TypeParameter */: + case 209 /* VariableDeclaration */: return true; } return false; @@ -5920,25 +6025,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 200 /* BreakStatement */: - case 199 /* ContinueStatement */: - case 207 /* DebuggerStatement */: - case 194 /* DoStatement */: - case 192 /* ExpressionStatement */: - case 191 /* EmptyStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 196 /* ForStatement */: - case 193 /* IfStatement */: - case 204 /* LabeledStatement */: - case 201 /* ReturnStatement */: - case 203 /* SwitchStatement */: - case 95 /* ThrowKeyword */: - case 206 /* TryStatement */: - case 190 /* VariableStatement */: - case 195 /* WhileStatement */: - case 202 /* WithStatement */: - case 224 /* ExportAssignment */: + case 201 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 208 /* DebuggerStatement */: + case 195 /* DoStatement */: + case 193 /* ExpressionStatement */: + case 192 /* EmptyStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 197 /* ForStatement */: + case 194 /* IfStatement */: + case 205 /* LabeledStatement */: + case 202 /* ReturnStatement */: + case 204 /* SwitchStatement */: + case 96 /* ThrowKeyword */: + case 207 /* TryStatement */: + case 191 /* VariableStatement */: + case 196 /* WhileStatement */: + case 203 /* WithStatement */: + case 225 /* ExportAssignment */: return true; default: return false; @@ -5947,13 +6052,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 141 /* Constructor */: - case 138 /* PropertyDeclaration */: - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 139 /* MethodSignature */: - case 146 /* IndexSignature */: + case 142 /* Constructor */: + case 139 /* PropertyDeclaration */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 140 /* MethodSignature */: + case 147 /* IndexSignature */: return true; default: return false; @@ -5962,11 +6067,11 @@ var ts; ts.isClassElement = isClassElement; // True if the given identifier, string literal, or number literal is the name of a declaration node function isDeclarationName(name) { - if (name.kind !== 66 /* Identifier */ && name.kind !== 8 /* StringLiteral */ && name.kind !== 7 /* NumericLiteral */) { + if (name.kind !== 67 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) { return false; } var parent = name.parent; - if (parent.kind === 223 /* ImportSpecifier */ || parent.kind === 227 /* ExportSpecifier */) { + if (parent.kind === 224 /* ImportSpecifier */ || parent.kind === 228 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -5981,31 +6086,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 244 /* EnumMember */: - case 242 /* PropertyAssignment */: - case 163 /* PropertyAccessExpression */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 245 /* EnumMember */: + case 243 /* PropertyAssignment */: + case 164 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 132 /* QualifiedName */) { + while (parent.kind === 133 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 151 /* TypeQuery */; + return parent.kind === 152 /* TypeQuery */; } return false; - case 160 /* BindingElement */: - case 223 /* ImportSpecifier */: + case 161 /* BindingElement */: + case 224 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 227 /* ExportSpecifier */: + case 228 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -6021,26 +6126,26 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 218 /* ImportEqualsDeclaration */ || - node.kind === 220 /* ImportClause */ && !!node.name || - node.kind === 221 /* NamespaceImport */ || - node.kind === 223 /* ImportSpecifier */ || - node.kind === 227 /* ExportSpecifier */ || - node.kind === 224 /* ExportAssignment */ && node.expression.kind === 66 /* Identifier */; + return node.kind === 219 /* ImportEqualsDeclaration */ || + node.kind === 221 /* ImportClause */ && !!node.name || + node.kind === 222 /* NamespaceImport */ || + node.kind === 224 /* ImportSpecifier */ || + node.kind === 228 /* ExportSpecifier */ || + node.kind === 225 /* ExportAssignment */ && node.expression.kind === 67 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 80 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 81 /* ExtendsKeyword */); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 103 /* ImplementsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 104 /* ImplementsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 80 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 81 /* ExtendsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -6109,11 +6214,11 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 67 /* FirstKeyword */ <= token && token <= 131 /* LastKeyword */; + return 68 /* FirstKeyword */ <= token && token <= 132 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { - return 2 /* FirstTriviaToken */ <= token && token <= 6 /* LastTriviaToken */; + return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { @@ -6129,7 +6234,7 @@ var ts; */ function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 133 /* ComputedPropertyName */ && + declaration.name.kind === 134 /* ComputedPropertyName */ && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; @@ -6139,14 +6244,14 @@ var ts; * where Symbol is literally the word "Symbol", and name is any identifierName */ function isWellKnownSymbolSyntactically(node) { - return node.kind === 163 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); + return node.kind === 164 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 66 /* Identifier */ || name.kind === 8 /* StringLiteral */ || name.kind === 7 /* NumericLiteral */) { + if (name.kind === 67 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { return name.text; } - if (name.kind === 133 /* ComputedPropertyName */) { + if (name.kind === 134 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -6164,21 +6269,21 @@ var ts; * Includes the word "Symbol" with unicode escapes */ function isESSymbolIdentifier(node) { - return node.kind === 66 /* Identifier */ && node.text === "Symbol"; + return node.kind === 67 /* Identifier */ && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 112 /* AbstractKeyword */: - case 115 /* AsyncKeyword */: - case 71 /* ConstKeyword */: - case 119 /* DeclareKeyword */: - case 74 /* DefaultKeyword */: - case 79 /* ExportKeyword */: - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 110 /* StaticKeyword */: + case 113 /* AbstractKeyword */: + case 116 /* AsyncKeyword */: + case 72 /* ConstKeyword */: + case 120 /* DeclareKeyword */: + case 75 /* DefaultKeyword */: + case 80 /* ExportKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 111 /* StaticKeyword */: return true; } return false; @@ -6186,20 +6291,36 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 135 /* Parameter */; + return root.kind === 136 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 160 /* BindingElement */) { + while (node.kind === 161 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 215 /* ModuleDeclaration */ || n.kind === 245 /* SourceFile */; + return isFunctionLike(n) || n.kind === 216 /* ModuleDeclaration */ || n.kind === 246 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; + function cloneEntityName(node) { + if (node.kind === 67 /* Identifier */) { + var clone_1 = createSynthesizedNode(67 /* Identifier */); + clone_1.text = node.text; + return clone_1; + } + else { + var clone_2 = createSynthesizedNode(133 /* QualifiedName */); + clone_2.left = cloneEntityName(node.left); + clone_2.left.parent = clone_2; + clone_2.right = cloneEntityName(node.right); + clone_2.right.parent = clone_2; + return clone_2; + } + } + ts.cloneEntityName = cloneEntityName; function nodeIsSynthesized(node) { return node.pos === -1; } @@ -6436,7 +6557,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 141 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 142 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -6448,7 +6569,7 @@ var ts; ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; function shouldEmitToOwnFile(sourceFile, compilerOptions) { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out)) { + if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { // 1. in-browser single file compilation scenario // 2. non .js file return compilerOptions.isolatedModules || !ts.fileExtensionIs(sourceFile.fileName, ".js"); @@ -6465,10 +6586,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 142 /* GetAccessor */) { + if (accessor.kind === 143 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 143 /* SetAccessor */) { + else if (accessor.kind === 144 /* SetAccessor */) { setAccessor = accessor; } else { @@ -6477,7 +6598,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 142 /* GetAccessor */ || member.kind === 143 /* SetAccessor */) + if ((member.kind === 143 /* GetAccessor */ || member.kind === 144 /* SetAccessor */) && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -6488,10 +6609,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 142 /* GetAccessor */ && !getAccessor) { + if (member.kind === 143 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 143 /* SetAccessor */ && !setAccessor) { + if (member.kind === 144 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6593,7 +6714,7 @@ var ts; } function writeTrimmedCurrentLine(pos, nextLineStart) { var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); + var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); if (currentLineText) { // trimmed forward and ending spaces text writer.write(currentLineText); @@ -6624,16 +6745,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 110 /* StaticKeyword */: return 128 /* Static */; - case 109 /* PublicKeyword */: return 16 /* Public */; - case 108 /* ProtectedKeyword */: return 64 /* Protected */; - case 107 /* PrivateKeyword */: return 32 /* Private */; - case 112 /* AbstractKeyword */: return 256 /* Abstract */; - case 79 /* ExportKeyword */: return 1 /* Export */; - case 119 /* DeclareKeyword */: return 2 /* Ambient */; - case 71 /* ConstKeyword */: return 32768 /* Const */; - case 74 /* DefaultKeyword */: return 1024 /* Default */; - case 115 /* AsyncKeyword */: return 512 /* Async */; + case 111 /* StaticKeyword */: return 128 /* Static */; + case 110 /* PublicKeyword */: return 16 /* Public */; + case 109 /* ProtectedKeyword */: return 64 /* Protected */; + case 108 /* PrivateKeyword */: return 32 /* Private */; + case 113 /* AbstractKeyword */: return 256 /* Abstract */; + case 80 /* ExportKeyword */: return 1 /* Export */; + case 120 /* DeclareKeyword */: return 2 /* Ambient */; + case 72 /* ConstKeyword */: return 32768 /* Const */; + case 75 /* DefaultKeyword */: return 1024 /* Default */; + case 116 /* AsyncKeyword */: return 512 /* Async */; } return 0; } @@ -6641,29 +6762,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 166 /* NewExpression */: - case 165 /* CallExpression */: - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: - case 167 /* TaggedTemplateExpression */: - case 161 /* ArrayLiteralExpression */: - case 169 /* ParenthesizedExpression */: - case 162 /* ObjectLiteralExpression */: - case 183 /* ClassExpression */: - case 170 /* FunctionExpression */: - case 66 /* Identifier */: - case 9 /* RegularExpressionLiteral */: - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 180 /* TemplateExpression */: - case 81 /* FalseKeyword */: - case 90 /* NullKeyword */: - case 94 /* ThisKeyword */: - case 96 /* TrueKeyword */: - case 92 /* SuperKeyword */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 167 /* NewExpression */: + case 166 /* CallExpression */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: + case 168 /* TaggedTemplateExpression */: + case 162 /* ArrayLiteralExpression */: + case 170 /* ParenthesizedExpression */: + case 163 /* ObjectLiteralExpression */: + case 184 /* ClassExpression */: + case 171 /* FunctionExpression */: + case 67 /* Identifier */: + case 10 /* RegularExpressionLiteral */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 181 /* TemplateExpression */: + case 82 /* FalseKeyword */: + case 91 /* NullKeyword */: + case 95 /* ThisKeyword */: + case 97 /* TrueKeyword */: + case 93 /* SuperKeyword */: return true; } } @@ -6671,12 +6792,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 54 /* FirstAssignment */ && token <= 65 /* LastAssignment */; + return token >= 55 /* FirstAssignment */ && token <= 66 /* LastAssignment */; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 185 /* ExpressionWithTypeArguments */ && - node.parent.token === 80 /* ExtendsKeyword */ && + return node.kind === 186 /* ExpressionWithTypeArguments */ && + node.parent.token === 81 /* ExtendsKeyword */ && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -6687,10 +6808,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 66 /* Identifier */) { + if (node.kind === 67 /* Identifier */) { return true; } - else if (node.kind === 163 /* PropertyAccessExpression */) { + else if (node.kind === 164 /* PropertyAccessExpression */) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -6698,10 +6819,21 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 132 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 163 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function isEmptyObjectLiteralOrArrayLiteral(expression) { + var kind = expression.kind; + if (kind === 163 /* ObjectLiteralExpression */) { + return expression.properties.length === 0; + } + if (kind === 162 /* ArrayLiteralExpression */) { + return expression.elements.length === 0; + } + return false; + } + ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } @@ -7004,13 +7136,13 @@ var ts; oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); } - return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN); + return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN); } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 134 /* TypeParameter */) { + if (d && d.kind === 135 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 212 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213 /* InterfaceDeclaration */) { return current; } } @@ -7022,7 +7154,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(269 /* Count */); + var nodeConstructors = new Array(270 /* Count */); /* @internal */ ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -7067,20 +7199,20 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 135 /* Parameter */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 242 /* PropertyAssignment */: - case 243 /* ShorthandPropertyAssignment */: - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 136 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 243 /* PropertyAssignment */: + case 244 /* ShorthandPropertyAssignment */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -7089,24 +7221,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -7117,290 +7249,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 148 /* TypeReference */: + case 149 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 147 /* TypePredicate */: + case 148 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 152 /* TypeLiteral */: + case 153 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 153 /* ArrayType */: + case 154 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 154 /* TupleType */: + case 155 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 155 /* UnionType */: - case 156 /* IntersectionType */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 163 /* PropertyAccessExpression */: + case 164 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 168 /* TypeAssertionExpression */: + case 169 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 172 /* DeleteExpression */: + case 173 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 173 /* TypeOfExpression */: + case 174 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 174 /* VoidExpression */: + case 175 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 175 /* AwaitExpression */: + case 176 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 177 /* PostfixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 186 /* AsExpression */: + case 187 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 182 /* SpreadElementExpression */: + case 183 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 189 /* Block */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 209 /* VariableDeclarationList */: + case 210 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 193 /* IfStatement */: + case 194 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 194 /* DoStatement */: + case 195 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 195 /* WhileStatement */: + case 196 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 196 /* ForStatement */: + case 197 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 197 /* ForInStatement */: + case 198 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 198 /* ForOfStatement */: + case 199 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 199 /* ContinueStatement */: - case 200 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 201 /* BreakStatement */: return visitNode(cbNode, node.label); - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 202 /* WithStatement */: + case 203 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 217 /* CaseBlock */: + case 218 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 238 /* CaseClause */: + case 239 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 239 /* DefaultClause */: + case 240 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 205 /* ThrowStatement */: + case 206 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 206 /* TryStatement */: + case 207 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 136 /* Decorator */: + case 137 /* Decorator */: return visitNode(cbNode, node.expression); - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 220 /* ImportClause */: + case 221 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 221 /* NamespaceImport */: + case 222 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 222 /* NamedImports */: - case 226 /* NamedExports */: + case 223 /* NamedImports */: + case 227 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 223 /* ImportSpecifier */: - case 227 /* ExportSpecifier */: + case 224 /* ImportSpecifier */: + case 228 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 180 /* TemplateExpression */: + case 181 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 187 /* TemplateSpan */: + case 188 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 240 /* HeritageClause */: + case 241 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 229 /* ExternalModuleReference */: + case 230 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 228 /* MissingDeclaration */: + case 229 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 230 /* JsxElement */: + case 231 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 231 /* JsxSelfClosingElement */: - case 232 /* JsxOpeningElement */: + case 232 /* JsxSelfClosingElement */: + case 233 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 235 /* JsxAttribute */: + case 236 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 236 /* JsxSpreadAttribute */: + case 237 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 237 /* JsxExpression */: + case 238 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 234 /* JsxClosingElement */: + case 235 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 246 /* JSDocTypeExpression */: + case 247 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 250 /* JSDocUnionType */: + case 251 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 251 /* JSDocTupleType */: + case 252 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 249 /* JSDocArrayType */: + case 250 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 253 /* JSDocNonNullableType */: + case 254 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 252 /* JSDocNullableType */: + case 253 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 254 /* JSDocRecordType */: + case 255 /* JSDocRecordType */: return visitNodes(cbNodes, node.members); - case 256 /* JSDocTypeReference */: + case 257 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 257 /* JSDocOptionalType */: + case 258 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 258 /* JSDocFunctionType */: + case 259 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 259 /* JSDocVariadicType */: + case 260 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 260 /* JSDocConstructorType */: + case 261 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 261 /* JSDocThisType */: + case 262 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 255 /* JSDocRecordMember */: + case 256 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 262 /* JSDocComment */: + case 263 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 264 /* JSDocParameterTag */: + case 265 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 265 /* JSDocReturnTag */: + case 266 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 266 /* JSDocTypeTag */: + case 267 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 267 /* JSDocTemplateTag */: + case 268 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); } } @@ -7408,7 +7540,7 @@ var ts; function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { if (setParentNodes === void 0) { setParentNodes = false; } var start = new Date().getTime(); - var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes); + var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); ts.parseTime += new Date().getTime() - start; return result; } @@ -7444,7 +7576,7 @@ var ts; (function (Parser) { // Share a single scanner across all calls to parse a source file. This helps speed things // up by avoiding the cost of creating/compiling scanners over and over again. - var scanner = ts.createScanner(2 /* Latest */, true); + var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 1 /* DisallowIn */ | 4 /* Decorator */; var sourceFile; var parseDiagnostics; @@ -7595,9 +7727,9 @@ var ts; // Add additional cases as necessary depending on how we see JSDoc comments used // in the wild. switch (node.kind) { - case 190 /* VariableStatement */: - case 210 /* FunctionDeclaration */: - case 135 /* Parameter */: + case 191 /* VariableStatement */: + case 211 /* FunctionDeclaration */: + case 136 /* Parameter */: addJSDocComment(node); } forEachChild(node, visit); @@ -7638,7 +7770,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(245 /* SourceFile */, 0); + var sourceFile = createNode(246 /* SourceFile */, /*pos*/ 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -7792,6 +7924,9 @@ var ts; function scanJsxIdentifier() { return token = scanner.scanJsxIdentifier(); } + function scanJsxText() { + return token = scanner.scanJsxToken(); + } function speculationHelper(callback, isLookAhead) { // Keep track of the state we'll need to rollback to if lookahead fails (or if the // caller asked us to always reset our state). @@ -7823,35 +7958,38 @@ var ts; // was in immediately prior to invoking the callback. The result of invoking the callback // is returned from this function. function lookAhead(callback) { - return speculationHelper(callback, true); + return speculationHelper(callback, /*isLookAhead*/ true); } // Invokes the provided callback. If the callback returns something falsy, then it restores // the parser to the state it was in immediately prior to invoking the callback. If the // callback returns something truthy, then the parser state is not rolled back. The result // of invoking the callback is returned from this function. function tryParse(callback) { - return speculationHelper(callback, false); + return speculationHelper(callback, /*isLookAhead*/ false); } // Ignore strict mode flag because we will report an error in type checker instead. function isIdentifier() { - if (token === 66 /* Identifier */) { + if (token === 67 /* Identifier */) { return true; } // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. - if (token === 111 /* YieldKeyword */ && inYieldContext()) { + if (token === 112 /* YieldKeyword */ && inYieldContext()) { return false; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token === 116 /* AwaitKeyword */ && inAwaitContext()) { + if (token === 117 /* AwaitKeyword */ && inAwaitContext()) { return false; } - return token > 102 /* LastReservedWord */; + return token > 103 /* LastReservedWord */; } - function parseExpected(kind, diagnosticMessage) { + function parseExpected(kind, diagnosticMessage, shouldAdvance) { + if (shouldAdvance === void 0) { shouldAdvance = true; } if (token === kind) { - nextToken(); + if (shouldAdvance) { + nextToken(); + } return true; } // Report specific message if provided with one. Otherwise, report generic fallback message. @@ -7887,22 +8025,22 @@ var ts; } function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. - if (token === 22 /* SemicolonToken */) { + if (token === 23 /* SemicolonToken */) { return true; } // We can parse out an optional semicolon in ASI cases in the following cases. - return token === 15 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + return token === 16 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 22 /* SemicolonToken */) { + if (token === 23 /* SemicolonToken */) { // consume the semicolon if it was explicitly provided. nextToken(); } return true; } else { - return parseExpected(22 /* SemicolonToken */); + return parseExpected(23 /* SemicolonToken */); } } function createNode(kind, pos) { @@ -7950,16 +8088,16 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(66 /* Identifier */); + var node = createNode(67 /* Identifier */); // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker - if (token !== 66 /* Identifier */) { + if (token !== 67 /* Identifier */) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(66 /* Identifier */, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(67 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -7969,56 +8107,56 @@ var ts; } function isLiteralPropertyName() { return isIdentifierOrKeyword() || - token === 8 /* StringLiteral */ || - token === 7 /* NumericLiteral */; + token === 9 /* StringLiteral */ || + token === 8 /* NumericLiteral */; } function parsePropertyNameWorker(allowComputedPropertyNames) { - if (token === 8 /* StringLiteral */ || token === 7 /* NumericLiteral */) { - return parseLiteralNode(true); + if (token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */) { + return parseLiteralNode(/*internName*/ true); } - if (allowComputedPropertyNames && token === 18 /* OpenBracketToken */) { + if (allowComputedPropertyNames && token === 19 /* OpenBracketToken */) { return parseComputedPropertyName(); } return parseIdentifierName(); } function parsePropertyName() { - return parsePropertyNameWorker(true); + return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ true); } function parseSimplePropertyName() { - return parsePropertyNameWorker(false); + return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ false); } function isSimplePropertyName() { - return token === 8 /* StringLiteral */ || token === 7 /* NumericLiteral */ || isIdentifierOrKeyword(); + return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || isIdentifierOrKeyword(); } function parseComputedPropertyName() { // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(133 /* ComputedPropertyName */); - parseExpected(18 /* OpenBracketToken */); + var node = createNode(134 /* ComputedPropertyName */); + parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker // will error if it sees a comma expression. node.expression = allowInAnd(parseExpression); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); return finishNode(node); } function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 71 /* ConstKeyword */) { + if (token === 72 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. - return nextToken() === 78 /* EnumKeyword */; + return nextToken() === 79 /* EnumKeyword */; } - if (token === 79 /* ExportKeyword */) { + if (token === 80 /* ExportKeyword */) { nextToken(); - if (token === 74 /* DefaultKeyword */) { + if (token === 75 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 36 /* AsteriskToken */ && token !== 14 /* OpenBraceToken */ && canFollowModifier(); + return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } - if (token === 74 /* DefaultKeyword */) { + if (token === 75 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); } nextToken(); @@ -8028,14 +8166,14 @@ var ts; return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { - return token === 18 /* OpenBracketToken */ - || token === 14 /* OpenBraceToken */ - || token === 36 /* AsteriskToken */ + return token === 19 /* OpenBracketToken */ + || token === 15 /* OpenBraceToken */ + || token === 37 /* AsteriskToken */ || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); - return token === 70 /* ClassKeyword */ || token === 84 /* FunctionKeyword */; + return token === 71 /* ClassKeyword */ || token === 85 /* FunctionKeyword */; } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -8053,9 +8191,9 @@ var ts; // we're parsing. For example, if we have a semicolon in the middle of a class, then // we really don't want to assume the class is over and we're on a statement in the // outer module. We just want to consume and move on. - return !(token === 22 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); + return !(token === 23 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); case 2 /* SwitchClauses */: - return token === 68 /* CaseKeyword */ || token === 74 /* DefaultKeyword */; + return token === 69 /* CaseKeyword */ || token === 75 /* DefaultKeyword */; case 4 /* TypeMembers */: return isStartOfTypeMember(); case 5 /* ClassMembers */: @@ -8063,19 +8201,19 @@ var ts; // not in error recovery. If we're in error recovery, we don't want an errant // semicolon to be treated as a class member (since they're almost always used // for statements. - return lookAhead(isClassMemberStart) || (token === 22 /* SemicolonToken */ && !inErrorRecovery); + return lookAhead(isClassMemberStart) || (token === 23 /* SemicolonToken */ && !inErrorRecovery); case 6 /* EnumMembers */: // Include open bracket computed properties. This technically also lets in indexers, // which would be a candidate for improved error reporting. - return token === 18 /* OpenBracketToken */ || isLiteralPropertyName(); + return token === 19 /* OpenBracketToken */ || isLiteralPropertyName(); case 12 /* ObjectLiteralMembers */: - return token === 18 /* OpenBracketToken */ || token === 36 /* AsteriskToken */ || isLiteralPropertyName(); + return token === 19 /* OpenBracketToken */ || token === 37 /* AsteriskToken */ || isLiteralPropertyName(); case 9 /* ObjectBindingElements */: return isLiteralPropertyName(); case 7 /* HeritageClauseElement */: // If we see { } then only consume it as an expression if it is followed by , or { // That way we won't consume the body of a class in its heritage clause. - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { return lookAhead(isValidHeritageClauseObjectLiteral); } if (!inErrorRecovery) { @@ -8090,23 +8228,23 @@ var ts; case 8 /* VariableDeclarations */: return isIdentifierOrPattern(); case 10 /* ArrayBindingElements */: - return token === 23 /* CommaToken */ || token === 21 /* DotDotDotToken */ || isIdentifierOrPattern(); + return token === 24 /* CommaToken */ || token === 22 /* DotDotDotToken */ || isIdentifierOrPattern(); case 17 /* TypeParameters */: return isIdentifier(); case 11 /* ArgumentExpressions */: case 15 /* ArrayLiteralMembers */: - return token === 23 /* CommaToken */ || token === 21 /* DotDotDotToken */ || isStartOfExpression(); + return token === 24 /* CommaToken */ || token === 22 /* DotDotDotToken */ || isStartOfExpression(); case 16 /* Parameters */: return isStartOfParameter(); case 18 /* TypeArguments */: case 19 /* TupleElementTypes */: - return token === 23 /* CommaToken */ || isStartOfType(); + return token === 24 /* CommaToken */ || isStartOfType(); case 20 /* HeritageClauses */: return isHeritageClause(); case 21 /* ImportOrExportSpecifiers */: return isIdentifierOrKeyword(); case 13 /* JsxAttributes */: - return isIdentifierOrKeyword() || token === 14 /* OpenBraceToken */; + return isIdentifierOrKeyword() || token === 15 /* OpenBraceToken */; case 14 /* JsxChildren */: return true; case 22 /* JSDocFunctionParameters */: @@ -8119,8 +8257,8 @@ var ts; ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } function isValidHeritageClauseObjectLiteral() { - ts.Debug.assert(token === 14 /* OpenBraceToken */); - if (nextToken() === 15 /* CloseBraceToken */) { + ts.Debug.assert(token === 15 /* OpenBraceToken */); + if (nextToken() === 16 /* CloseBraceToken */) { // if we see "extends {}" then only treat the {} as what we're extending (and not // the class body) if we have: // @@ -8129,7 +8267,7 @@ var ts; // extends {} extends // extends {} implements var next = nextToken(); - return next === 23 /* CommaToken */ || next === 14 /* OpenBraceToken */ || next === 80 /* ExtendsKeyword */ || next === 103 /* ImplementsKeyword */; + return next === 24 /* CommaToken */ || next === 15 /* OpenBraceToken */ || next === 81 /* ExtendsKeyword */ || next === 104 /* ImplementsKeyword */; } return true; } @@ -8142,8 +8280,8 @@ var ts; return isIdentifierOrKeyword(); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 103 /* ImplementsKeyword */ || - token === 80 /* ExtendsKeyword */) { + if (token === 104 /* ImplementsKeyword */ || + token === 81 /* ExtendsKeyword */) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -8167,43 +8305,43 @@ var ts; case 12 /* ObjectLiteralMembers */: case 9 /* ObjectBindingElements */: case 21 /* ImportOrExportSpecifiers */: - return token === 15 /* CloseBraceToken */; + return token === 16 /* CloseBraceToken */; case 3 /* SwitchClauseStatements */: - return token === 15 /* CloseBraceToken */ || token === 68 /* CaseKeyword */ || token === 74 /* DefaultKeyword */; + return token === 16 /* CloseBraceToken */ || token === 69 /* CaseKeyword */ || token === 75 /* DefaultKeyword */; case 7 /* HeritageClauseElement */: - return token === 14 /* OpenBraceToken */ || token === 80 /* ExtendsKeyword */ || token === 103 /* ImplementsKeyword */; + return token === 15 /* OpenBraceToken */ || token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; case 8 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 17 /* TypeParameters */: // Tokens other than '>' are here for better error recovery - return token === 26 /* GreaterThanToken */ || token === 16 /* OpenParenToken */ || token === 14 /* OpenBraceToken */ || token === 80 /* ExtendsKeyword */ || token === 103 /* ImplementsKeyword */; + return token === 27 /* GreaterThanToken */ || token === 17 /* OpenParenToken */ || token === 15 /* OpenBraceToken */ || token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; case 11 /* ArgumentExpressions */: // Tokens other than ')' are here for better error recovery - return token === 17 /* CloseParenToken */ || token === 22 /* SemicolonToken */; + return token === 18 /* CloseParenToken */ || token === 23 /* SemicolonToken */; case 15 /* ArrayLiteralMembers */: case 19 /* TupleElementTypes */: case 10 /* ArrayBindingElements */: - return token === 19 /* CloseBracketToken */; + return token === 20 /* CloseBracketToken */; case 16 /* Parameters */: // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery - return token === 17 /* CloseParenToken */ || token === 19 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/; + return token === 18 /* CloseParenToken */ || token === 20 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/; case 18 /* TypeArguments */: // Tokens other than '>' are here for better error recovery - return token === 26 /* GreaterThanToken */ || token === 16 /* OpenParenToken */; + return token === 27 /* GreaterThanToken */ || token === 17 /* OpenParenToken */; case 20 /* HeritageClauses */: - return token === 14 /* OpenBraceToken */ || token === 15 /* CloseBraceToken */; + return token === 15 /* OpenBraceToken */ || token === 16 /* CloseBraceToken */; case 13 /* JsxAttributes */: - return token === 26 /* GreaterThanToken */ || token === 37 /* SlashToken */; + return token === 27 /* GreaterThanToken */ || token === 38 /* SlashToken */; case 14 /* JsxChildren */: - return token === 24 /* LessThanToken */ && lookAhead(nextTokenIsSlash); + return token === 25 /* LessThanToken */ && lookAhead(nextTokenIsSlash); case 22 /* JSDocFunctionParameters */: - return token === 17 /* CloseParenToken */ || token === 52 /* ColonToken */ || token === 15 /* CloseBraceToken */; + return token === 18 /* CloseParenToken */ || token === 53 /* ColonToken */ || token === 16 /* CloseBraceToken */; case 23 /* JSDocTypeArguments */: - return token === 26 /* GreaterThanToken */ || token === 15 /* CloseBraceToken */; + return token === 27 /* GreaterThanToken */ || token === 16 /* CloseBraceToken */; case 25 /* JSDocTupleTypes */: - return token === 19 /* CloseBracketToken */ || token === 15 /* CloseBraceToken */; + return token === 20 /* CloseBracketToken */ || token === 16 /* CloseBraceToken */; case 24 /* JSDocRecordMembers */: - return token === 15 /* CloseBraceToken */; + return token === 16 /* CloseBraceToken */; } } function isVariableDeclaratorListTerminator() { @@ -8221,7 +8359,7 @@ var ts; // For better error recovery, if we see an '=>' then we just stop immediately. We've got an // arrow function here and it's going to be very unlikely that we'll resynchronize and get // another variable declaration. - if (token === 33 /* EqualsGreaterThanToken */) { + if (token === 34 /* EqualsGreaterThanToken */) { return true; } // Keep trying to parse out variable declarators. @@ -8231,7 +8369,7 @@ var ts; function isInSomeParsingContext() { for (var kind = 0; kind < 26 /* Count */; kind++) { if (parsingContext & (1 << kind)) { - if (isListElement(kind, true) || isListTerminator(kind)) { + if (isListElement(kind, /* inErrorRecovery */ true) || isListTerminator(kind)) { return true; } } @@ -8245,7 +8383,7 @@ var ts; var result = []; result.pos = getNodePos(); while (!isListTerminator(kind)) { - if (isListElement(kind, false)) { + if (isListElement(kind, /* inErrorRecovery */ false)) { var element = parseListElement(kind, parseElement); result.push(element); continue; @@ -8385,20 +8523,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 141 /* Constructor */: - case 146 /* IndexSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 138 /* PropertyDeclaration */: - case 188 /* SemicolonClassElement */: + case 142 /* Constructor */: + case 147 /* IndexSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 189 /* SemicolonClassElement */: return true; - case 140 /* MethodDeclaration */: + case 141 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 66 /* Identifier */ && - methodDeclaration.name.originalKeywordKind === 118 /* ConstructorKeyword */; + var nameIsConstructor = methodDeclaration.name.kind === 67 /* Identifier */ && + methodDeclaration.name.originalKeywordKind === 119 /* ConstructorKeyword */; return !nameIsConstructor; } } @@ -8407,8 +8545,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 238 /* CaseClause */: - case 239 /* DefaultClause */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: return true; } } @@ -8417,58 +8555,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 210 /* FunctionDeclaration */: - case 190 /* VariableStatement */: - case 189 /* Block */: - case 193 /* IfStatement */: - case 192 /* ExpressionStatement */: - case 205 /* ThrowStatement */: - case 201 /* ReturnStatement */: - case 203 /* SwitchStatement */: - case 200 /* BreakStatement */: - case 199 /* ContinueStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 196 /* ForStatement */: - case 195 /* WhileStatement */: - case 202 /* WithStatement */: - case 191 /* EmptyStatement */: - case 206 /* TryStatement */: - case 204 /* LabeledStatement */: - case 194 /* DoStatement */: - case 207 /* DebuggerStatement */: - case 219 /* ImportDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 225 /* ExportDeclaration */: - case 224 /* ExportAssignment */: - case 215 /* ModuleDeclaration */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 213 /* TypeAliasDeclaration */: + case 211 /* FunctionDeclaration */: + case 191 /* VariableStatement */: + case 190 /* Block */: + case 194 /* IfStatement */: + case 193 /* ExpressionStatement */: + case 206 /* ThrowStatement */: + case 202 /* ReturnStatement */: + case 204 /* SwitchStatement */: + case 201 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 197 /* ForStatement */: + case 196 /* WhileStatement */: + case 203 /* WithStatement */: + case 192 /* EmptyStatement */: + case 207 /* TryStatement */: + case 205 /* LabeledStatement */: + case 195 /* DoStatement */: + case 208 /* DebuggerStatement */: + case 220 /* ImportDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 226 /* ExportDeclaration */: + case 225 /* ExportAssignment */: + case 216 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 214 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 244 /* EnumMember */; + return node.kind === 245 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 145 /* ConstructSignature */: - case 139 /* MethodSignature */: - case 146 /* IndexSignature */: - case 137 /* PropertySignature */: - case 144 /* CallSignature */: + case 146 /* ConstructSignature */: + case 140 /* MethodSignature */: + case 147 /* IndexSignature */: + case 138 /* PropertySignature */: + case 145 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 208 /* VariableDeclaration */) { + if (node.kind !== 209 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -8489,7 +8627,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 135 /* Parameter */) { + if (node.kind !== 136 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -8544,10 +8682,10 @@ var ts; result.pos = getNodePos(); var commaStart = -1; // Meaning the previous token was not a comma while (true) { - if (isListElement(kind, false)) { + if (isListElement(kind, /* inErrorRecovery */ false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); - if (parseOptional(23 /* CommaToken */)) { + if (parseOptional(24 /* CommaToken */)) { continue; } commaStart = -1; // Back to the state where the last token was not a comma @@ -8556,13 +8694,13 @@ var ts; } // We didn't get a comma, and the list wasn't terminated, explicitly parse // out a comma so we give a good error message. - parseExpected(23 /* CommaToken */); + parseExpected(24 /* CommaToken */); // If the token was a semicolon, and the caller allows that, then skip it and // continue. This ensures we get back on track and don't result in tons of // parse errors. For example, this can happen when people do things like use // a semicolon to delimit object literal members. Note: we'll have already // reported an error when we called parseExpected above. - if (considerSemicolonAsDelimeter && token === 22 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { + if (considerSemicolonAsDelimeter && token === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -8605,8 +8743,8 @@ var ts; // The allowReservedWords parameter controls whether reserved words are permitted after the first dot function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); - while (parseOptional(20 /* DotToken */)) { - var node = createNode(132 /* QualifiedName */, entity.pos); + while (parseOptional(21 /* DotToken */)) { + var node = createNode(133 /* QualifiedName */, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -8639,34 +8777,34 @@ var ts; // Report that we need an identifier. However, report it right after the dot, // and not on the next token. This is because the next token might actually // be an identifier and the error would be quite confusing. - return createMissingNode(66 /* Identifier */, true, ts.Diagnostics.Identifier_expected); + return createMissingNode(67 /* Identifier */, /*reportAtCurrentToken*/ true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(180 /* TemplateExpression */); + var template = createNode(181 /* TemplateExpression */); template.head = parseLiteralNode(); - ts.Debug.assert(template.head.kind === 11 /* TemplateHead */, "Template head has wrong token kind"); + ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); do { templateSpans.push(parseTemplateSpan()); - } while (ts.lastOrUndefined(templateSpans).literal.kind === 12 /* TemplateMiddle */); + } while (ts.lastOrUndefined(templateSpans).literal.kind === 13 /* TemplateMiddle */); templateSpans.end = getNodeEnd(); template.templateSpans = templateSpans; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(187 /* TemplateSpan */); + var span = createNode(188 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; - if (token === 15 /* CloseBraceToken */) { + if (token === 16 /* CloseBraceToken */) { reScanTemplateToken(); literal = parseLiteralNode(); } else { - literal = parseExpectedToken(13 /* TemplateTail */, false, ts.Diagnostics._0_expected, ts.tokenToString(15 /* CloseBraceToken */)); + literal = parseExpectedToken(14 /* TemplateTail */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(16 /* CloseBraceToken */)); } span.literal = literal; return finishNode(span); @@ -8690,7 +8828,7 @@ var ts; // never get a token like this. Instead, we would get 00 and 9 as two separate tokens. // We also do not need to check for negatives because any prefix operator would be part of a // parent unary expression. - if (node.kind === 7 /* NumericLiteral */ + if (node.kind === 8 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 65536 /* OctalLiteral */; @@ -8699,31 +8837,31 @@ var ts; } // TYPES function parseTypeReferenceOrTypePredicate() { - var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 66 /* Identifier */ && token === 121 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); + if (typeName.kind === 67 /* Identifier */ && token === 122 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(147 /* TypePredicate */, typeName.pos); + var node_1 = createNode(148 /* TypePredicate */, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(148 /* TypeReference */, typeName.pos); + var node = createNode(149 /* TypeReference */, typeName.pos); node.typeName = typeName; - if (!scanner.hasPrecedingLineBreak() && token === 24 /* LessThanToken */) { - node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 24 /* LessThanToken */, 26 /* GreaterThanToken */); + if (!scanner.hasPrecedingLineBreak() && token === 25 /* LessThanToken */) { + node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(151 /* TypeQuery */); - parseExpected(98 /* TypeOfKeyword */); - node.exprName = parseEntityName(true); + var node = createNode(152 /* TypeQuery */); + parseExpected(99 /* TypeOfKeyword */); + node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(134 /* TypeParameter */); + var node = createNode(135 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(80 /* ExtendsKeyword */)) { + if (parseOptional(81 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the // user writes a constraint that is an expression and not an actual type, then parse // it out as an expression (so we can recover well), but report that a type is needed @@ -8745,20 +8883,20 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 24 /* LessThanToken */) { - return parseBracketedList(17 /* TypeParameters */, parseTypeParameter, 24 /* LessThanToken */, 26 /* GreaterThanToken */); + if (token === 25 /* LessThanToken */) { + return parseBracketedList(17 /* TypeParameters */, parseTypeParameter, 25 /* LessThanToken */, 27 /* GreaterThanToken */); } } function parseParameterType() { - if (parseOptional(52 /* ColonToken */)) { - return token === 8 /* StringLiteral */ - ? parseLiteralNode(true) + if (parseOptional(53 /* ColonToken */)) { + return token === 9 /* StringLiteral */ + ? parseLiteralNode(/*internName*/ true) : parseType(); } return undefined; } function isStartOfParameter() { - return token === 21 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 53 /* AtToken */; + return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 54 /* AtToken */; } function setModifiers(node, modifiers) { if (modifiers) { @@ -8767,10 +8905,10 @@ var ts; } } function parseParameter() { - var node = createNode(135 /* Parameter */); + var node = createNode(136 /* Parameter */); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); - node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); + node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); // FormalParameter [Yield,Await]: // BindingElement[?Yield,?Await] node.name = parseIdentifierOrPattern(); @@ -8785,9 +8923,9 @@ var ts; // to avoid this we'll advance cursor to the next token. nextToken(); } - node.questionToken = parseOptionalToken(51 /* QuestionToken */); + node.questionToken = parseOptionalToken(52 /* QuestionToken */); node.type = parseParameterType(); - node.initializer = parseBindingElementInitializer(true); + node.initializer = parseBindingElementInitializer(/*inParameter*/ true); // Do not check for initializers in an ambient context for parameters. This is not // a grammar error because the grammar allows arbitrary call signatures in // an ambient context. @@ -8802,10 +8940,10 @@ var ts; return inParameter ? parseParameterInitializer() : parseNonParameterInitializer(); } function parseParameterInitializer() { - return parseInitializer(true); + return parseInitializer(/*inParameter*/ true); } function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) { - var returnTokenRequired = returnToken === 33 /* EqualsGreaterThanToken */; + var returnTokenRequired = returnToken === 34 /* EqualsGreaterThanToken */; signature.typeParameters = parseTypeParameters(); signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { @@ -8830,7 +8968,7 @@ var ts; // // SingleNameBinding [Yield,Await]: // BindingIdentifier[?Yield,?Await]Initializer [In, ?Yield,?Await] opt - if (parseExpected(16 /* OpenParenToken */)) { + if (parseExpected(17 /* OpenParenToken */)) { var savedYieldContext = inYieldContext(); var savedAwaitContext = inAwaitContext(); setYieldContext(yieldContext); @@ -8838,7 +8976,7 @@ var ts; var result = parseDelimitedList(16 /* Parameters */, parseParameter); setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); - if (!parseExpected(17 /* CloseParenToken */) && requireCompleteParameterList) { + if (!parseExpected(18 /* CloseParenToken */) && requireCompleteParameterList) { // Caller insisted that we had to end with a ) We didn't. So just return // undefined here. return undefined; @@ -8853,7 +8991,7 @@ var ts; function parseTypeMemberSemicolon() { // We allow type members to be separated by commas or (possibly ASI) semicolons. // First check if it was a comma. If so, we're done with the member. - if (parseOptional(23 /* CommaToken */)) { + if (parseOptional(24 /* CommaToken */)) { return; } // Didn't have a comma. We must have a (possible ASI) semicolon. @@ -8861,15 +8999,15 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 145 /* ConstructSignature */) { - parseExpected(89 /* NewKeyword */); + if (kind === 146 /* ConstructSignature */) { + parseExpected(90 /* NewKeyword */); } - fillSignature(52 /* ColonToken */, false, false, false, node); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); parseTypeMemberSemicolon(); return finishNode(node); } function isIndexSignature() { - if (token !== 18 /* OpenBracketToken */) { + if (token !== 19 /* OpenBracketToken */) { return false; } return lookAhead(isUnambiguouslyIndexSignature); @@ -8892,7 +9030,7 @@ var ts; // [] // nextToken(); - if (token === 21 /* DotDotDotToken */ || token === 19 /* CloseBracketToken */) { + if (token === 22 /* DotDotDotToken */ || token === 20 /* CloseBracketToken */) { return true; } if (ts.isModifier(token)) { @@ -8911,24 +9049,24 @@ var ts; // A colon signifies a well formed indexer // A comma should be a badly formed indexer because comma expressions are not allowed // in computed properties. - if (token === 52 /* ColonToken */ || token === 23 /* CommaToken */) { + if (token === 53 /* ColonToken */ || token === 24 /* CommaToken */) { return true; } // Question mark could be an indexer with an optional property, // or it could be a conditional expression in a computed property. - if (token !== 51 /* QuestionToken */) { + if (token !== 52 /* QuestionToken */) { return false; } // If any of the following tokens are after the question mark, it cannot // be a conditional expression, so treat it as an indexer. nextToken(); - return token === 52 /* ColonToken */ || token === 23 /* CommaToken */ || token === 19 /* CloseBracketToken */; + return token === 53 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(146 /* IndexSignature */, fullStart); + var node = createNode(147 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); + node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); node.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); return finishNode(node); @@ -8936,19 +9074,19 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(51 /* QuestionToken */); - if (token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { - var method = createNode(139 /* MethodSignature */, fullStart); + var questionToken = parseOptionalToken(52 /* QuestionToken */); + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { + var method = createNode(140 /* MethodSignature */, fullStart); method.name = name; method.questionToken = questionToken; // Method signatues don't exist in expression contexts. So they have neither // [Yield] nor [Await] - fillSignature(52 /* ColonToken */, false, false, false, method); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(137 /* PropertySignature */, fullStart); + var property = createNode(138 /* PropertySignature */, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -8958,9 +9096,9 @@ var ts; } function isStartOfTypeMember() { switch (token) { - case 16 /* OpenParenToken */: - case 24 /* LessThanToken */: - case 18 /* OpenBracketToken */: + case 17 /* OpenParenToken */: + case 25 /* LessThanToken */: + case 19 /* OpenBracketToken */: return true; default: if (ts.isModifier(token)) { @@ -8980,29 +9118,29 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 /* OpenParenToken */ || - token === 24 /* LessThanToken */ || - token === 51 /* QuestionToken */ || - token === 52 /* ColonToken */ || + return token === 17 /* OpenParenToken */ || + token === 25 /* LessThanToken */ || + token === 52 /* QuestionToken */ || + token === 53 /* ColonToken */ || canParseSemicolon(); } function parseTypeMember() { switch (token) { - case 16 /* OpenParenToken */: - case 24 /* LessThanToken */: - return parseSignatureMember(144 /* CallSignature */); - case 18 /* OpenBracketToken */: + case 17 /* OpenParenToken */: + case 25 /* LessThanToken */: + return parseSignatureMember(145 /* CallSignature */); + case 19 /* OpenBracketToken */: // Indexer or computed property return isIndexSignature() - ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) + ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined) : parsePropertyOrMethodSignature(); - case 89 /* NewKeyword */: + case 90 /* NewKeyword */: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(145 /* ConstructSignature */); + return parseSignatureMember(146 /* ConstructSignature */); } // fall through. - case 8 /* StringLiteral */: - case 7 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: return parsePropertyOrMethodSignature(); default: // Index declaration as allowed as a type member. But as per the grammar, @@ -9032,18 +9170,18 @@ var ts; } function isStartOfConstructSignature() { nextToken(); - return token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */; + return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(152 /* TypeLiteral */); + var node = createNode(153 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseObjectTypeMembers() { var members; - if (parseExpected(14 /* OpenBraceToken */)) { + if (parseExpected(15 /* OpenBraceToken */)) { members = parseList(4 /* TypeMembers */, parseTypeMember); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { members = createMissingList(); @@ -9051,48 +9189,48 @@ var ts; return members; } function parseTupleType() { - var node = createNode(154 /* TupleType */); - node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); + var node = createNode(155 /* TupleType */); + node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(157 /* ParenthesizedType */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(158 /* ParenthesizedType */); + parseExpected(17 /* OpenParenToken */); node.type = parseType(); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 150 /* ConstructorType */) { - parseExpected(89 /* NewKeyword */); + if (kind === 151 /* ConstructorType */) { + parseExpected(90 /* NewKeyword */); } - fillSignature(33 /* EqualsGreaterThanToken */, false, false, false, node); + fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); return finishNode(node); } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 20 /* DotToken */ ? undefined : node; + return token === 21 /* DotToken */ ? undefined : node; } function parseNonArrayType() { switch (token) { - case 114 /* AnyKeyword */: - case 127 /* StringKeyword */: - case 125 /* NumberKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: + case 115 /* AnyKeyword */: + case 128 /* StringKeyword */: + case 126 /* NumberKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 100 /* VoidKeyword */: + case 101 /* VoidKeyword */: return parseTokenNode(); - case 98 /* TypeOfKeyword */: + case 99 /* TypeOfKeyword */: return parseTypeQuery(); - case 14 /* OpenBraceToken */: + case 15 /* OpenBraceToken */: return parseTypeLiteral(); - case 18 /* OpenBracketToken */: + case 19 /* OpenBracketToken */: return parseTupleType(); - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: return parseParenthesizedType(); default: return parseTypeReferenceOrTypePredicate(); @@ -9100,19 +9238,19 @@ var ts; } function isStartOfType() { switch (token) { - case 114 /* AnyKeyword */: - case 127 /* StringKeyword */: - case 125 /* NumberKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: - case 100 /* VoidKeyword */: - case 98 /* TypeOfKeyword */: - case 14 /* OpenBraceToken */: - case 18 /* OpenBracketToken */: - case 24 /* LessThanToken */: - case 89 /* NewKeyword */: + case 115 /* AnyKeyword */: + case 128 /* StringKeyword */: + case 126 /* NumberKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: + case 101 /* VoidKeyword */: + case 99 /* TypeOfKeyword */: + case 15 /* OpenBraceToken */: + case 19 /* OpenBracketToken */: + case 25 /* LessThanToken */: + case 90 /* NewKeyword */: return true; - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, // or something that starts a type. We don't want to consider things like '(1)' a type. return lookAhead(isStartOfParenthesizedOrFunctionType); @@ -9122,13 +9260,13 @@ var ts; } function isStartOfParenthesizedOrFunctionType() { nextToken(); - return token === 17 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); + return token === 18 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); } function parseArrayTypeOrHigher() { var type = parseNonArrayType(); - while (!scanner.hasPrecedingLineBreak() && parseOptional(18 /* OpenBracketToken */)) { - parseExpected(19 /* CloseBracketToken */); - var node = createNode(153 /* ArrayType */, type.pos); + while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { + parseExpected(20 /* CloseBracketToken */); + var node = createNode(154 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -9150,28 +9288,28 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(156 /* IntersectionType */, parseArrayTypeOrHigher, 44 /* AmpersandToken */); + return parseUnionOrIntersectionType(157 /* IntersectionType */, parseArrayTypeOrHigher, 45 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(155 /* UnionType */, parseIntersectionTypeOrHigher, 45 /* BarToken */); + return parseUnionOrIntersectionType(156 /* UnionType */, parseIntersectionTypeOrHigher, 46 /* BarToken */); } function isStartOfFunctionType() { - if (token === 24 /* LessThanToken */) { + if (token === 25 /* LessThanToken */) { return true; } - return token === 16 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); + return token === 17 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); } function isUnambiguouslyStartOfFunctionType() { nextToken(); - if (token === 17 /* CloseParenToken */ || token === 21 /* DotDotDotToken */) { + if (token === 18 /* CloseParenToken */ || token === 22 /* DotDotDotToken */) { // ( ) // ( ... return true; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 52 /* ColonToken */ || token === 23 /* CommaToken */ || - token === 51 /* QuestionToken */ || token === 54 /* EqualsToken */ || + if (token === 53 /* ColonToken */ || token === 24 /* CommaToken */ || + token === 52 /* QuestionToken */ || token === 55 /* EqualsToken */ || isIdentifier() || ts.isModifier(token)) { // ( id : // ( id , @@ -9180,9 +9318,9 @@ var ts; // ( modifier id return true; } - if (token === 17 /* CloseParenToken */) { + if (token === 18 /* CloseParenToken */) { nextToken(); - if (token === 33 /* EqualsGreaterThanToken */) { + if (token === 34 /* EqualsGreaterThanToken */) { // ( id ) => return true; } @@ -9197,37 +9335,37 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(149 /* FunctionType */); + return parseFunctionOrConstructorType(150 /* FunctionType */); } - if (token === 89 /* NewKeyword */) { - return parseFunctionOrConstructorType(150 /* ConstructorType */); + if (token === 90 /* NewKeyword */) { + return parseFunctionOrConstructorType(151 /* ConstructorType */); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(52 /* ColonToken */) ? parseType() : undefined; + return parseOptional(53 /* ColonToken */) ? parseType() : undefined; } // EXPRESSIONS function isStartOfLeftHandSideExpression() { switch (token) { - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: - case 90 /* NullKeyword */: - case 96 /* TrueKeyword */: - case 81 /* FalseKeyword */: - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 11 /* TemplateHead */: - case 16 /* OpenParenToken */: - case 18 /* OpenBracketToken */: - case 14 /* OpenBraceToken */: - case 84 /* FunctionKeyword */: - case 70 /* ClassKeyword */: - case 89 /* NewKeyword */: - case 37 /* SlashToken */: - case 58 /* SlashEqualsToken */: - case 66 /* Identifier */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: + case 91 /* NullKeyword */: + case 97 /* TrueKeyword */: + case 82 /* FalseKeyword */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 12 /* TemplateHead */: + case 17 /* OpenParenToken */: + case 19 /* OpenBracketToken */: + case 15 /* OpenBraceToken */: + case 85 /* FunctionKeyword */: + case 71 /* ClassKeyword */: + case 90 /* NewKeyword */: + case 38 /* SlashToken */: + case 59 /* SlashEqualsToken */: + case 67 /* Identifier */: return true; default: return isIdentifier(); @@ -9238,18 +9376,18 @@ var ts; return true; } switch (token) { - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 48 /* TildeToken */: - case 47 /* ExclamationToken */: - case 75 /* DeleteKeyword */: - case 98 /* TypeOfKeyword */: - case 100 /* VoidKeyword */: - case 39 /* PlusPlusToken */: - case 40 /* MinusMinusToken */: - case 24 /* LessThanToken */: - case 116 /* AwaitKeyword */: - case 111 /* YieldKeyword */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 49 /* TildeToken */: + case 48 /* ExclamationToken */: + case 76 /* DeleteKeyword */: + case 99 /* TypeOfKeyword */: + case 101 /* VoidKeyword */: + case 40 /* PlusPlusToken */: + case 41 /* MinusMinusToken */: + case 25 /* LessThanToken */: + case 117 /* AwaitKeyword */: + case 112 /* YieldKeyword */: // Yield/await always starts an expression. Either it is an identifier (in which case // it is definitely an expression). Or it's a keyword (either because we're in // a generator or async function, or in strict mode (or both)) and it started a yield or await expression. @@ -9267,10 +9405,10 @@ var ts; } function isStartOfExpressionStatement() { // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement. - return token !== 14 /* OpenBraceToken */ && - token !== 84 /* FunctionKeyword */ && - token !== 70 /* ClassKeyword */ && - token !== 53 /* AtToken */ && + return token !== 15 /* OpenBraceToken */ && + token !== 85 /* FunctionKeyword */ && + token !== 71 /* ClassKeyword */ && + token !== 54 /* AtToken */ && isStartOfExpression(); } function allowInAndParseExpression() { @@ -9287,7 +9425,7 @@ var ts; } var expr = parseAssignmentExpressionOrHigher(); var operatorToken; - while ((operatorToken = parseOptionalToken(23 /* CommaToken */))) { + while ((operatorToken = parseOptionalToken(24 /* CommaToken */))) { expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } if (saveDecoratorContext) { @@ -9296,7 +9434,7 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 54 /* EqualsToken */) { + if (token !== 55 /* EqualsToken */) { // It's not uncommon during typing for the user to miss writing the '=' token. Check if // there is no newline after the last token and if we're on an expression. If so, parse // this as an equals-value clause with a missing equals. @@ -9305,7 +9443,7 @@ var ts; // it's more likely that a { would be a allowed (as an object literal). While this // is also allowed for parameters, the risk is that we consume the { as an object // literal when it really will be for the block following the parameter. - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 14 /* OpenBraceToken */) || !isStartOfExpression()) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 15 /* OpenBraceToken */) || !isStartOfExpression()) { // preceding line break, open brace in a parameter (likely a function body) or current token is not an expression - // do not try to parse initializer return undefined; @@ -9313,7 +9451,7 @@ var ts; } // Initializer[In, Yield] : // = AssignmentExpression[?In, ?Yield] - parseExpected(54 /* EqualsToken */); + parseExpected(55 /* EqualsToken */); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -9347,11 +9485,11 @@ var ts; // Otherwise, we try to parse out the conditional expression bit. We want to allow any // binary expression here, so we pass in the 'lowest' precedence here so that it matches // and consumes anything. - var expr = parseBinaryExpressionOrHigher(0); + var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0); // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single // identifier and the current token is an arrow. - if (expr.kind === 66 /* Identifier */ && token === 33 /* EqualsGreaterThanToken */) { + if (expr.kind === 67 /* Identifier */ && token === 34 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } // Now see if we might be in cases '2' or '3'. @@ -9367,7 +9505,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 111 /* YieldKeyword */) { + if (token === 112 /* YieldKeyword */) { // If we have a 'yield' keyword, and htis is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { @@ -9396,15 +9534,15 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(181 /* YieldExpression */); + var node = createNode(182 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] // yield [no LineTerminator here] * [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] nextToken(); if (!scanner.hasPrecedingLineBreak() && - (token === 36 /* AsteriskToken */ || isStartOfExpression())) { - node.asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + (token === 37 /* AsteriskToken */ || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -9415,16 +9553,16 @@ var ts; } } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 33 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(171 /* ArrowFunction */, identifier.pos); - var parameter = createNode(135 /* Parameter */, identifier.pos); + ts.Debug.assert(token === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(172 /* ArrowFunction */, identifier.pos); + var parameter = createNode(136 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - node.equalsGreaterThanToken = parseExpectedToken(33 /* EqualsGreaterThanToken */, false, ts.Diagnostics._0_expected, "=>"); - node.body = parseArrowFunctionExpressionBody(false); + node.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, false, ts.Diagnostics._0_expected, "=>"); + node.body = parseArrowFunctionExpressionBody(/*isAsync*/ false); return finishNode(node); } function tryParseParenthesizedArrowFunctionExpression() { @@ -9438,7 +9576,7 @@ var ts; // it out, but don't allow any ambiguity, and return 'undefined' if this could be an // expression instead. var arrowFunction = triState === 1 /* True */ - ? parseParenthesizedArrowFunctionExpressionHead(true) + ? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { // Didn't appear to actually be a parenthesized arrow function. Just bail out. @@ -9448,8 +9586,8 @@ var ts; // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. var lastToken = token; - arrowFunction.equalsGreaterThanToken = parseExpectedToken(33 /* EqualsGreaterThanToken */, false, ts.Diagnostics._0_expected, "=>"); - arrowFunction.body = (lastToken === 33 /* EqualsGreaterThanToken */ || lastToken === 14 /* OpenBraceToken */) + arrowFunction.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, "=>"); + arrowFunction.body = (lastToken === 34 /* EqualsGreaterThanToken */ || lastToken === 15 /* OpenBraceToken */) ? parseArrowFunctionExpressionBody(isAsync) : parseIdentifier(); return finishNode(arrowFunction); @@ -9459,10 +9597,10 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */ || token === 115 /* AsyncKeyword */) { + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */ || token === 116 /* AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } - if (token === 33 /* EqualsGreaterThanToken */) { + if (token === 34 /* EqualsGreaterThanToken */) { // ERROR RECOVERY TWEAK: // If we see a standalone => try to parse it as an arrow function expression as that's // likely what the user intended to write. @@ -9472,28 +9610,28 @@ var ts; return 0 /* False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 115 /* AsyncKeyword */) { + if (token === 116 /* AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* False */; } - if (token !== 16 /* OpenParenToken */ && token !== 24 /* LessThanToken */) { + if (token !== 17 /* OpenParenToken */ && token !== 25 /* LessThanToken */) { return 0 /* False */; } } var first = token; var second = nextToken(); - if (first === 16 /* OpenParenToken */) { - if (second === 17 /* CloseParenToken */) { + if (first === 17 /* OpenParenToken */) { + if (second === 18 /* CloseParenToken */) { // Simple cases: "() =>", "(): ", and "() {". // This is an arrow function with no parameters. // The last one is not actually an arrow function, // but this is probably what the user intended. var third = nextToken(); switch (third) { - case 33 /* EqualsGreaterThanToken */: - case 52 /* ColonToken */: - case 14 /* OpenBraceToken */: + case 34 /* EqualsGreaterThanToken */: + case 53 /* ColonToken */: + case 15 /* OpenBraceToken */: return 1 /* True */; default: return 0 /* False */; @@ -9505,12 +9643,12 @@ var ts; // ({ x }) => { } // ([ x ]) // ({ x }) - if (second === 18 /* OpenBracketToken */ || second === 14 /* OpenBraceToken */) { + if (second === 19 /* OpenBracketToken */ || second === 15 /* OpenBraceToken */) { return 2 /* Unknown */; } // Simple case: "(..." // This is an arrow function with a rest parameter. - if (second === 21 /* DotDotDotToken */) { + if (second === 22 /* DotDotDotToken */) { return 1 /* True */; } // If we had "(" followed by something that's not an identifier, @@ -9523,7 +9661,7 @@ var ts; } // If we have something like "(a:", then we must have a // type-annotated parameter in an arrow function expression. - if (nextToken() === 52 /* ColonToken */) { + if (nextToken() === 53 /* ColonToken */) { return 1 /* True */; } // This *could* be a parenthesized arrow function. @@ -9531,7 +9669,7 @@ var ts; return 2 /* Unknown */; } else { - ts.Debug.assert(first === 24 /* LessThanToken */); + ts.Debug.assert(first === 25 /* LessThanToken */); // If we have "<" not followed by an identifier, // then this definitely is not an arrow function. if (!isIdentifier()) { @@ -9541,17 +9679,17 @@ var ts; if (sourceFile.languageVariant === 1 /* JSX */) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 80 /* ExtendsKeyword */) { + if (third === 81 /* ExtendsKeyword */) { var fourth = nextToken(); switch (fourth) { - case 54 /* EqualsToken */: - case 26 /* GreaterThanToken */: + case 55 /* EqualsToken */: + case 27 /* GreaterThanToken */: return false; default: return true; } } - else if (third === 23 /* CommaToken */) { + else if (third === 24 /* CommaToken */) { return true; } return false; @@ -9566,10 +9704,10 @@ var ts; } } function parsePossibleParenthesizedArrowFunctionExpressionHead() { - return parseParenthesizedArrowFunctionExpressionHead(false); + return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(171 /* ArrowFunction */); + var node = createNode(172 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512 /* Async */); // Arrow functions are never generators. @@ -9579,7 +9717,7 @@ var ts; // a => (b => c) // And think that "(b =>" was actually a parenthesized arrow function with a missing // close paren. - fillSignature(52 /* ColonToken */, false, isAsync, !allowAmbiguity, node); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node); // If we couldn't get parameters, we definitely could not parse out an arrow function. if (!node.parameters) { return undefined; @@ -9592,19 +9730,19 @@ var ts; // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation. // // So we need just a bit of lookahead to ensure that it can only be a signature. - if (!allowAmbiguity && token !== 33 /* EqualsGreaterThanToken */ && token !== 14 /* OpenBraceToken */) { + if (!allowAmbiguity && token !== 34 /* EqualsGreaterThanToken */ && token !== 15 /* OpenBraceToken */) { // Returning undefined here will cause our caller to rewind to where we started from. return undefined; } return node; } function parseArrowFunctionExpressionBody(isAsync) { - if (token === 14 /* OpenBraceToken */) { - return parseFunctionBlock(false, isAsync, false); + if (token === 15 /* OpenBraceToken */) { + return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); } - if (token !== 22 /* SemicolonToken */ && - token !== 84 /* FunctionKeyword */ && - token !== 70 /* ClassKeyword */ && + if (token !== 23 /* SemicolonToken */ && + token !== 85 /* FunctionKeyword */ && + token !== 71 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) { // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations) @@ -9621,7 +9759,7 @@ var ts; // up preemptively closing the containing construct. // // Note: even when 'ignoreMissingOpenBrace' is passed as true, parseBody will still error. - return parseFunctionBlock(false, isAsync, true); + return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ true); } return isAsync ? doInAwaitContext(parseAssignmentExpressionOrHigher) @@ -9629,17 +9767,17 @@ var ts; } function parseConditionalExpressionRest(leftOperand) { // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher. - var questionToken = parseOptionalToken(51 /* QuestionToken */); + var questionToken = parseOptionalToken(52 /* QuestionToken */); if (!questionToken) { return leftOperand; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(179 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(180 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(52 /* ColonToken */, false, ts.Diagnostics._0_expected, ts.tokenToString(52 /* ColonToken */)); + node.colonToken = parseExpectedToken(53 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(53 /* ColonToken */)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -9648,7 +9786,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 87 /* InKeyword */ || t === 131 /* OfKeyword */; + return t === 88 /* InKeyword */ || t === 132 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -9660,10 +9798,10 @@ var ts; if (newPrecedence <= precedence) { break; } - if (token === 87 /* InKeyword */ && inDisallowInContext()) { + if (token === 88 /* InKeyword */ && inDisallowInContext()) { break; } - if (token === 113 /* AsKeyword */) { + if (token === 114 /* AsKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -9684,46 +9822,46 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 87 /* InKeyword */) { + if (inDisallowInContext() && token === 88 /* InKeyword */) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 50 /* BarBarToken */: + case 51 /* BarBarToken */: return 1; - case 49 /* AmpersandAmpersandToken */: + case 50 /* AmpersandAmpersandToken */: return 2; - case 45 /* BarToken */: + case 46 /* BarToken */: return 3; - case 46 /* CaretToken */: + case 47 /* CaretToken */: return 4; - case 44 /* AmpersandToken */: + case 45 /* AmpersandToken */: return 5; - case 29 /* EqualsEqualsToken */: - case 30 /* ExclamationEqualsToken */: - case 31 /* EqualsEqualsEqualsToken */: - case 32 /* ExclamationEqualsEqualsToken */: + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: return 6; - case 24 /* LessThanToken */: - case 26 /* GreaterThanToken */: - case 27 /* LessThanEqualsToken */: - case 28 /* GreaterThanEqualsToken */: - case 88 /* InstanceOfKeyword */: - case 87 /* InKeyword */: - case 113 /* AsKeyword */: + case 25 /* LessThanToken */: + case 27 /* GreaterThanToken */: + case 28 /* LessThanEqualsToken */: + case 29 /* GreaterThanEqualsToken */: + case 89 /* InstanceOfKeyword */: + case 88 /* InKeyword */: + case 114 /* AsKeyword */: return 7; - case 41 /* LessThanLessThanToken */: - case 42 /* GreaterThanGreaterThanToken */: - case 43 /* GreaterThanGreaterThanGreaterThanToken */: + case 42 /* LessThanLessThanToken */: + case 43 /* GreaterThanGreaterThanToken */: + case 44 /* GreaterThanGreaterThanGreaterThanToken */: return 8; - case 34 /* PlusToken */: - case 35 /* MinusToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: return 9; - case 36 /* AsteriskToken */: - case 37 /* SlashToken */: - case 38 /* PercentToken */: + case 37 /* AsteriskToken */: + case 38 /* SlashToken */: + case 39 /* PercentToken */: return 10; } // -1 is lower than all other precedences. Returning it will cause binary expression @@ -9731,45 +9869,45 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(178 /* BinaryExpression */, left.pos); + var node = createNode(179 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(186 /* AsExpression */, left.pos); + var node = createNode(187 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(176 /* PrefixUnaryExpression */); + var node = createNode(177 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(172 /* DeleteExpression */); + var node = createNode(173 /* DeleteExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(173 /* TypeOfExpression */); + var node = createNode(174 /* TypeOfExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(174 /* VoidExpression */); + var node = createNode(175 /* VoidExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function isAwaitExpression() { - if (token === 116 /* AwaitKeyword */) { + if (token === 117 /* AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -9779,7 +9917,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(175 /* AwaitExpression */); + var node = createNode(176 /* AwaitExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -9789,25 +9927,25 @@ var ts; return parseAwaitExpression(); } switch (token) { - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 48 /* TildeToken */: - case 47 /* ExclamationToken */: - case 39 /* PlusPlusToken */: - case 40 /* MinusMinusToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 49 /* TildeToken */: + case 48 /* ExclamationToken */: + case 40 /* PlusPlusToken */: + case 41 /* MinusMinusToken */: return parsePrefixUnaryExpression(); - case 75 /* DeleteKeyword */: + case 76 /* DeleteKeyword */: return parseDeleteExpression(); - case 98 /* TypeOfKeyword */: + case 99 /* TypeOfKeyword */: return parseTypeOfExpression(); - case 100 /* VoidKeyword */: + case 101 /* VoidKeyword */: return parseVoidExpression(); - case 24 /* LessThanToken */: + case 25 /* LessThanToken */: if (sourceFile.languageVariant !== 1 /* JSX */) { return parseTypeAssertion(); } if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(); + return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); } // Fall through default: @@ -9817,8 +9955,8 @@ var ts; function parsePostfixExpressionOrHigher() { var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 39 /* PlusPlusToken */ || token === 40 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(177 /* PostfixUnaryExpression */, expression.pos); + if ((token === 40 /* PlusPlusToken */ || token === 41 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(178 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -9857,7 +9995,7 @@ var ts; // the last two CallExpression productions. Or we have a MemberExpression which either // completes the LeftHandSideExpression, or starts the beginning of the first four // CallExpression productions. - var expression = token === 92 /* SuperKeyword */ + var expression = token === 93 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); // Now, we *may* be complete. However, we might have consumed the start of a @@ -9917,47 +10055,47 @@ var ts; } function parseSuperExpression() { var expression = parseTokenNode(); - if (token === 16 /* OpenParenToken */ || token === 20 /* DotToken */) { + if (token === 17 /* OpenParenToken */ || token === 21 /* DotToken */ || token === 19 /* OpenBracketToken */) { return expression; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(163 /* PropertyAccessExpression */, expression.pos); + var node = createNode(164 /* PropertyAccessExpression */, expression.pos); node.expression = expression; - node.dotToken = parseExpectedToken(20 /* DotToken */, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); - node.name = parseRightSideOfDot(true); + node.dotToken = parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); return finishNode(node); } - function parseJsxElementOrSelfClosingElement() { - var opening = parseJsxOpeningOrSelfClosingElement(); - if (opening.kind === 232 /* JsxOpeningElement */) { - var node = createNode(230 /* JsxElement */, opening.pos); + function parseJsxElementOrSelfClosingElement(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + if (opening.kind === 233 /* JsxOpeningElement */) { + var node = createNode(231 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); - node.closingElement = parseJsxClosingElement(); + node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 231 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 232 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements return opening; } } function parseJsxText() { - var node = createNode(233 /* JsxText */, scanner.getStartPos()); + var node = createNode(234 /* JsxText */, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 233 /* JsxText */: + case 234 /* JsxText */: return parseJsxText(); - case 14 /* OpenBraceToken */: - return parseJsxExpression(); - case 24 /* LessThanToken */: - return parseJsxElementOrSelfClosingElement(); + case 15 /* OpenBraceToken */: + return parseJsxExpression(/*inExpressionContext*/ false); + case 25 /* LessThanToken */: + return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ false); } - ts.Debug.fail('Unknown JSX child kind ' + token); + ts.Debug.fail("Unknown JSX child kind " + token); } function parseJsxChildren(openingTagName) { var result = []; @@ -9966,7 +10104,7 @@ var ts; parsingContext |= 1 << 14 /* JsxChildren */; while (true) { token = scanner.reScanJsxToken(); - if (token === 25 /* LessThanSlashToken */) { + if (token === 26 /* LessThanSlashToken */) { break; } else if (token === 1 /* EndOfFileToken */) { @@ -9979,19 +10117,29 @@ var ts; parsingContext = saveParsingContext; return result; } - function parseJsxOpeningOrSelfClosingElement() { + function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); - parseExpected(24 /* LessThanToken */); + parseExpected(25 /* LessThanToken */); var tagName = parseJsxElementName(); var attributes = parseList(13 /* JsxAttributes */, parseJsxAttribute); var node; - if (parseOptional(26 /* GreaterThanToken */)) { - node = createNode(232 /* JsxOpeningElement */, fullStart); + if (token === 27 /* GreaterThanToken */) { + // Closing tag, so scan the immediately-following text with the JSX scanning instead + // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate + // scanning errors + node = createNode(233 /* JsxOpeningElement */, fullStart); + scanJsxText(); } else { - parseExpected(37 /* SlashToken */); - parseExpected(26 /* GreaterThanToken */); - node = createNode(231 /* JsxSelfClosingElement */, fullStart); + parseExpected(38 /* SlashToken */); + if (inExpressionContext) { + parseExpected(27 /* GreaterThanToken */); + } + else { + parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); + scanJsxText(); + } + node = createNode(232 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -10000,98 +10148,110 @@ var ts; function parseJsxElementName() { scanJsxIdentifier(); var elementName = parseIdentifierName(); - while (parseOptional(20 /* DotToken */)) { + while (parseOptional(21 /* DotToken */)) { scanJsxIdentifier(); - var node = createNode(132 /* QualifiedName */, elementName.pos); + var node = createNode(133 /* QualifiedName */, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); } return elementName; } - function parseJsxExpression() { - var node = createNode(237 /* JsxExpression */); - parseExpected(14 /* OpenBraceToken */); - if (token !== 15 /* CloseBraceToken */) { + function parseJsxExpression(inExpressionContext) { + var node = createNode(238 /* JsxExpression */); + parseExpected(15 /* OpenBraceToken */); + if (token !== 16 /* CloseBraceToken */) { node.expression = parseExpression(); } - parseExpected(15 /* CloseBraceToken */); + if (inExpressionContext) { + parseExpected(16 /* CloseBraceToken */); + } + else { + parseExpected(16 /* CloseBraceToken */, /*message*/ undefined, /*advance*/ false); + scanJsxText(); + } return finishNode(node); } function parseJsxAttribute() { - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(235 /* JsxAttribute */); + var node = createNode(236 /* JsxAttribute */); node.name = parseIdentifierName(); - if (parseOptional(54 /* EqualsToken */)) { + if (parseOptional(55 /* EqualsToken */)) { switch (token) { - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: node.initializer = parseLiteralNode(); break; default: - node.initializer = parseJsxExpression(); + node.initializer = parseJsxExpression(/*inExpressionContext*/ true); break; } } return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(236 /* JsxSpreadAttribute */); - parseExpected(14 /* OpenBraceToken */); - parseExpected(21 /* DotDotDotToken */); + var node = createNode(237 /* JsxSpreadAttribute */); + parseExpected(15 /* OpenBraceToken */); + parseExpected(22 /* DotDotDotToken */); node.expression = parseExpression(); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); return finishNode(node); } - function parseJsxClosingElement() { - var node = createNode(234 /* JsxClosingElement */); - parseExpected(25 /* LessThanSlashToken */); + function parseJsxClosingElement(inExpressionContext) { + var node = createNode(235 /* JsxClosingElement */); + parseExpected(26 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); - parseExpected(26 /* GreaterThanToken */); + if (inExpressionContext) { + parseExpected(27 /* GreaterThanToken */); + } + else { + parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); + scanJsxText(); + } return finishNode(node); } function parseTypeAssertion() { - var node = createNode(168 /* TypeAssertionExpression */); - parseExpected(24 /* LessThanToken */); + var node = createNode(169 /* TypeAssertionExpression */); + parseExpected(25 /* LessThanToken */); node.type = parseType(); - parseExpected(26 /* GreaterThanToken */); + parseExpected(27 /* GreaterThanToken */); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { - var dotToken = parseOptionalToken(20 /* DotToken */); + var dotToken = parseOptionalToken(21 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(163 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(164 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; - propertyAccess.name = parseRightSideOfDot(true); + propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName - if (!inDecoratorContext() && parseOptional(18 /* OpenBracketToken */)) { - var indexedAccess = createNode(164 /* ElementAccessExpression */, expression.pos); + if (!inDecoratorContext() && parseOptional(19 /* OpenBracketToken */)) { + var indexedAccess = createNode(165 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. - if (token !== 19 /* CloseBracketToken */) { + if (token !== 20 /* CloseBracketToken */) { indexedAccess.argumentExpression = allowInAnd(parseExpression); - if (indexedAccess.argumentExpression.kind === 8 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 7 /* NumericLiteral */) { + if (indexedAccess.argumentExpression.kind === 9 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 8 /* NumericLiteral */) { var literal = indexedAccess.argumentExpression; literal.text = internIdentifier(literal.text); } } - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); expression = finishNode(indexedAccess); continue; } - if (token === 10 /* NoSubstitutionTemplateLiteral */ || token === 11 /* TemplateHead */) { - var tagExpression = createNode(167 /* TaggedTemplateExpression */, expression.pos); + if (token === 11 /* NoSubstitutionTemplateLiteral */ || token === 12 /* TemplateHead */) { + var tagExpression = createNode(168 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 /* NoSubstitutionTemplateLiteral */ + tagExpression.template = token === 11 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); @@ -10103,7 +10263,7 @@ var ts; function parseCallExpressionRest(expression) { while (true) { expression = parseMemberExpressionRest(expression); - if (token === 24 /* LessThanToken */) { + if (token === 25 /* LessThanToken */) { // See if this is the start of a generic invocation. If so, consume it and // keep checking for postfix expressions. Otherwise, it's just a '<' that's // part of an arithmetic expression. Break out so we consume it higher in the @@ -10112,15 +10272,15 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(165 /* CallExpression */, expression.pos); + var callExpr = createNode(166 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); continue; } - else if (token === 16 /* OpenParenToken */) { - var callExpr = createNode(165 /* CallExpression */, expression.pos); + else if (token === 17 /* OpenParenToken */) { + var callExpr = createNode(166 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -10130,17 +10290,17 @@ var ts; } } function parseArgumentList() { - parseExpected(16 /* OpenParenToken */); + parseExpected(17 /* OpenParenToken */); var result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return result; } function parseTypeArgumentsInExpression() { - if (!parseOptional(24 /* LessThanToken */)) { + if (!parseOptional(25 /* LessThanToken */)) { return undefined; } var typeArguments = parseDelimitedList(18 /* TypeArguments */, parseType); - if (!parseExpected(26 /* GreaterThanToken */)) { + if (!parseExpected(27 /* GreaterThanToken */)) { // If it doesn't have the closing > then it's definitely not an type argument list. return undefined; } @@ -10152,32 +10312,32 @@ var ts; } function canFollowTypeArgumentsInExpression() { switch (token) { - case 16 /* OpenParenToken */: // foo( + case 17 /* OpenParenToken */: // foo( // this case are the only case where this token can legally follow a type argument // list. So we definitely want to treat this as a type arg list. - case 20 /* DotToken */: // foo. - case 17 /* CloseParenToken */: // foo) - case 19 /* CloseBracketToken */: // foo] - case 52 /* ColonToken */: // foo: - case 22 /* SemicolonToken */: // foo; - case 51 /* QuestionToken */: // foo? - case 29 /* EqualsEqualsToken */: // foo == - case 31 /* EqualsEqualsEqualsToken */: // foo === - case 30 /* ExclamationEqualsToken */: // foo != - case 32 /* ExclamationEqualsEqualsToken */: // foo !== - case 49 /* AmpersandAmpersandToken */: // foo && - case 50 /* BarBarToken */: // foo || - case 46 /* CaretToken */: // foo ^ - case 44 /* AmpersandToken */: // foo & - case 45 /* BarToken */: // foo | - case 15 /* CloseBraceToken */: // foo } + case 21 /* DotToken */: // foo. + case 18 /* CloseParenToken */: // foo) + case 20 /* CloseBracketToken */: // foo] + case 53 /* ColonToken */: // foo: + case 23 /* SemicolonToken */: // foo; + case 52 /* QuestionToken */: // foo? + case 30 /* EqualsEqualsToken */: // foo == + case 32 /* EqualsEqualsEqualsToken */: // foo === + case 31 /* ExclamationEqualsToken */: // foo != + case 33 /* ExclamationEqualsEqualsToken */: // foo !== + case 50 /* AmpersandAmpersandToken */: // foo && + case 51 /* BarBarToken */: // foo || + case 47 /* CaretToken */: // foo ^ + case 45 /* AmpersandToken */: // foo & + case 46 /* BarToken */: // foo | + case 16 /* CloseBraceToken */: // foo } case 1 /* EndOfFileToken */: // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. return true; - case 23 /* CommaToken */: // foo, - case 14 /* OpenBraceToken */: // foo { + case 24 /* CommaToken */: // foo, + case 15 /* OpenBraceToken */: // foo { // We don't want to treat these as type arguments. Otherwise we'll parse this // as an invocation expression. Instead, we want to parse out the expression // in isolation from the type arguments. @@ -10188,23 +10348,23 @@ var ts; } function parsePrimaryExpression() { switch (token) { - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: return parseLiteralNode(); - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: - case 90 /* NullKeyword */: - case 96 /* TrueKeyword */: - case 81 /* FalseKeyword */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: + case 91 /* NullKeyword */: + case 97 /* TrueKeyword */: + case 82 /* FalseKeyword */: return parseTokenNode(); - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: return parseParenthesizedExpression(); - case 18 /* OpenBracketToken */: + case 19 /* OpenBracketToken */: return parseArrayLiteralExpression(); - case 14 /* OpenBraceToken */: + case 15 /* OpenBraceToken */: return parseObjectLiteralExpression(); - case 115 /* AsyncKeyword */: + case 116 /* AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -10212,59 +10372,59 @@ var ts; break; } return parseFunctionExpression(); - case 70 /* ClassKeyword */: + case 71 /* ClassKeyword */: return parseClassExpression(); - case 84 /* FunctionKeyword */: + case 85 /* FunctionKeyword */: return parseFunctionExpression(); - case 89 /* NewKeyword */: + case 90 /* NewKeyword */: return parseNewExpression(); - case 37 /* SlashToken */: - case 58 /* SlashEqualsToken */: - if (reScanSlashToken() === 9 /* RegularExpressionLiteral */) { + case 38 /* SlashToken */: + case 59 /* SlashEqualsToken */: + if (reScanSlashToken() === 10 /* RegularExpressionLiteral */) { return parseLiteralNode(); } break; - case 11 /* TemplateHead */: + case 12 /* TemplateHead */: return parseTemplateExpression(); } return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(169 /* ParenthesizedExpression */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(170 /* ParenthesizedExpression */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(182 /* SpreadElementExpression */); - parseExpected(21 /* DotDotDotToken */); + var node = createNode(183 /* SpreadElementExpression */); + parseExpected(22 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 /* DotDotDotToken */ ? parseSpreadElement() : - token === 23 /* CommaToken */ ? createNode(184 /* OmittedExpression */) : + return token === 22 /* DotDotDotToken */ ? parseSpreadElement() : + token === 24 /* CommaToken */ ? createNode(185 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(161 /* ArrayLiteralExpression */); - parseExpected(18 /* OpenBracketToken */); + var node = createNode(162 /* ArrayLiteralExpression */); + parseExpected(19 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048 /* MultiLine */; node.elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(120 /* GetKeyword */)) { - return parseAccessorDeclaration(142 /* GetAccessor */, fullStart, decorators, modifiers); + if (parseContextualModifier(121 /* GetKeyword */)) { + return parseAccessorDeclaration(143 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(126 /* SetKeyword */)) { - return parseAccessorDeclaration(143 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(127 /* SetKeyword */)) { + return parseAccessorDeclaration(144 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -10276,39 +10436,39 @@ var ts; if (accessor) { return accessor; } - var asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + var asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); // Disallowing of optional property assignments happens in the grammar checker. - var questionToken = parseOptionalToken(51 /* QuestionToken */); - if (asteriskToken || token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { + var questionToken = parseOptionalToken(52 /* QuestionToken */); + if (asteriskToken || token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } // Parse to check if it is short-hand property assignment or normal property assignment - if ((token === 23 /* CommaToken */ || token === 15 /* CloseBraceToken */) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(243 /* ShorthandPropertyAssignment */, fullStart); + if ((token === 24 /* CommaToken */ || token === 16 /* CloseBraceToken */) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(244 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(242 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(243 /* PropertyAssignment */, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(162 /* ObjectLiteralExpression */); - parseExpected(14 /* OpenBraceToken */); + var node = createNode(163 /* ObjectLiteralExpression */); + parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048 /* MultiLine */; } - node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, true); - parseExpected(15 /* CloseBraceToken */); + node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimeter*/ true); + parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseFunctionExpression() { @@ -10321,10 +10481,10 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(170 /* FunctionExpression */); + var node = createNode(171 /* FunctionExpression */); setModifiers(node, parseModifiers()); - parseExpected(84 /* FunctionKeyword */); - node.asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + parseExpected(85 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512 /* Async */); node.name = @@ -10332,8 +10492,8 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(52 /* ColonToken */, isGenerator, isAsync, false, node); - node.body = parseFunctionBlock(isGenerator, isAsync, false); + fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); + node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); if (saveDecoratorContext) { setDecoratorContext(true); } @@ -10343,21 +10503,21 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(166 /* NewExpression */); - parseExpected(89 /* NewKeyword */); + var node = createNode(167 /* NewExpression */); + parseExpected(90 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); - if (node.typeArguments || token === 16 /* OpenParenToken */) { + if (node.typeArguments || token === 17 /* OpenParenToken */) { node.arguments = parseArgumentList(); } return finishNode(node); } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(189 /* Block */); - if (parseExpected(14 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { + var node = createNode(190 /* Block */); + if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -10384,84 +10544,84 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(191 /* EmptyStatement */); - parseExpected(22 /* SemicolonToken */); + var node = createNode(192 /* EmptyStatement */); + parseExpected(23 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(193 /* IfStatement */); - parseExpected(85 /* IfKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(194 /* IfStatement */); + parseExpected(86 /* IfKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(77 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(78 /* ElseKeyword */) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(194 /* DoStatement */); - parseExpected(76 /* DoKeyword */); + var node = createNode(195 /* DoStatement */); + parseExpected(77 /* DoKeyword */); node.statement = parseStatement(); - parseExpected(101 /* WhileKeyword */); - parseExpected(16 /* OpenParenToken */); + parseExpected(102 /* WhileKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby // do;while(0)x will have a semicolon inserted before x. - parseOptional(22 /* SemicolonToken */); + parseOptional(23 /* SemicolonToken */); return finishNode(node); } function parseWhileStatement() { - var node = createNode(195 /* WhileStatement */); - parseExpected(101 /* WhileKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(196 /* WhileStatement */); + parseExpected(102 /* WhileKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); node.statement = parseStatement(); return finishNode(node); } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(83 /* ForKeyword */); - parseExpected(16 /* OpenParenToken */); + parseExpected(84 /* ForKeyword */); + parseExpected(17 /* OpenParenToken */); var initializer = undefined; - if (token !== 22 /* SemicolonToken */) { - if (token === 99 /* VarKeyword */ || token === 105 /* LetKeyword */ || token === 71 /* ConstKeyword */) { - initializer = parseVariableDeclarationList(true); + if (token !== 23 /* SemicolonToken */) { + if (token === 100 /* VarKeyword */ || token === 106 /* LetKeyword */ || token === 72 /* ConstKeyword */) { + initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true); } else { initializer = disallowInAnd(parseExpression); } } var forOrForInOrForOfStatement; - if (parseOptional(87 /* InKeyword */)) { - var forInStatement = createNode(197 /* ForInStatement */, pos); + if (parseOptional(88 /* InKeyword */)) { + var forInStatement = createNode(198 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(131 /* OfKeyword */)) { - var forOfStatement = createNode(198 /* ForOfStatement */, pos); + else if (parseOptional(132 /* OfKeyword */)) { + var forOfStatement = createNode(199 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(196 /* ForStatement */, pos); + var forStatement = createNode(197 /* ForStatement */, pos); forStatement.initializer = initializer; - parseExpected(22 /* SemicolonToken */); - if (token !== 22 /* SemicolonToken */ && token !== 17 /* CloseParenToken */) { + parseExpected(23 /* SemicolonToken */); + if (token !== 23 /* SemicolonToken */ && token !== 18 /* CloseParenToken */) { forStatement.condition = allowInAnd(parseExpression); } - parseExpected(22 /* SemicolonToken */); - if (token !== 17 /* CloseParenToken */) { + parseExpected(23 /* SemicolonToken */); + if (token !== 18 /* CloseParenToken */) { forStatement.incrementor = allowInAnd(parseExpression); } - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forStatement; } forOrForInOrForOfStatement.statement = parseStatement(); @@ -10469,7 +10629,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 200 /* BreakStatement */ ? 67 /* BreakKeyword */ : 72 /* ContinueKeyword */); + parseExpected(kind === 201 /* BreakStatement */ ? 68 /* BreakKeyword */ : 73 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -10477,8 +10637,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(201 /* ReturnStatement */); - parseExpected(91 /* ReturnKeyword */); + var node = createNode(202 /* ReturnStatement */); + parseExpected(92 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -10486,42 +10646,42 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(202 /* WithStatement */); - parseExpected(102 /* WithKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(203 /* WithStatement */); + parseExpected(103 /* WithKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); node.statement = parseStatement(); return finishNode(node); } function parseCaseClause() { - var node = createNode(238 /* CaseClause */); - parseExpected(68 /* CaseKeyword */); + var node = createNode(239 /* CaseClause */); + parseExpected(69 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(239 /* DefaultClause */); - parseExpected(74 /* DefaultKeyword */); - parseExpected(52 /* ColonToken */); + var node = createNode(240 /* DefaultClause */); + parseExpected(75 /* DefaultKeyword */); + parseExpected(53 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 68 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 69 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(203 /* SwitchStatement */); - parseExpected(93 /* SwitchKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(204 /* SwitchStatement */); + parseExpected(94 /* SwitchKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); - var caseBlock = createNode(217 /* CaseBlock */, scanner.getStartPos()); - parseExpected(14 /* OpenBraceToken */); + parseExpected(18 /* CloseParenToken */); + var caseBlock = createNode(218 /* CaseBlock */, scanner.getStartPos()); + parseExpected(15 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); node.caseBlock = finishNode(caseBlock); return finishNode(node); } @@ -10533,39 +10693,39 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(205 /* ThrowStatement */); - parseExpected(95 /* ThrowKeyword */); + var node = createNode(206 /* ThrowStatement */); + parseExpected(96 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(206 /* TryStatement */); - parseExpected(97 /* TryKeyword */); - node.tryBlock = parseBlock(false); - node.catchClause = token === 69 /* CatchKeyword */ ? parseCatchClause() : undefined; + var node = createNode(207 /* TryStatement */); + parseExpected(98 /* TryKeyword */); + node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); + node.catchClause = token === 70 /* CatchKeyword */ ? parseCatchClause() : undefined; // If we don't have a catch clause, then we must have a finally clause. Try to parse // one out no matter what. - if (!node.catchClause || token === 82 /* FinallyKeyword */) { - parseExpected(82 /* FinallyKeyword */); - node.finallyBlock = parseBlock(false); + if (!node.catchClause || token === 83 /* FinallyKeyword */) { + parseExpected(83 /* FinallyKeyword */); + node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(241 /* CatchClause */); - parseExpected(69 /* CatchKeyword */); - if (parseExpected(16 /* OpenParenToken */)) { + var result = createNode(242 /* CatchClause */); + parseExpected(70 /* CatchKeyword */); + if (parseExpected(17 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); } - parseExpected(17 /* CloseParenToken */); - result.block = parseBlock(false); + parseExpected(18 /* CloseParenToken */); + result.block = parseBlock(/*ignoreMissingOpenBrace*/ false); return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(207 /* DebuggerStatement */); - parseExpected(73 /* DebuggerKeyword */); + var node = createNode(208 /* DebuggerStatement */); + parseExpected(74 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } @@ -10575,21 +10735,21 @@ var ts; // a colon. var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 66 /* Identifier */ && parseOptional(52 /* ColonToken */)) { - var labeledStatement = createNode(204 /* LabeledStatement */, fullStart); + if (expression.kind === 67 /* Identifier */ && parseOptional(53 /* ColonToken */)) { + var labeledStatement = createNode(205 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(192 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(193 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); } } function isIdentifierOrKeyword() { - return token >= 66 /* Identifier */; + return token >= 67 /* Identifier */; } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); @@ -10597,21 +10757,21 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 84 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); + return token === 85 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 7 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak(); + return (isIdentifierOrKeyword() || token === 8 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { switch (token) { - case 99 /* VarKeyword */: - case 105 /* LetKeyword */: - case 71 /* ConstKeyword */: - case 84 /* FunctionKeyword */: - case 70 /* ClassKeyword */: - case 78 /* EnumKeyword */: + case 100 /* VarKeyword */: + case 106 /* LetKeyword */: + case 72 /* ConstKeyword */: + case 85 /* FunctionKeyword */: + case 71 /* ClassKeyword */: + case 79 /* EnumKeyword */: return true; // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers; // however, an identifier cannot be followed by another identifier on the same line. This is what we @@ -10634,36 +10794,36 @@ var ts; // I {} // // could be legal, it would add complexity for very little gain. - case 104 /* InterfaceKeyword */: - case 129 /* TypeKeyword */: + case 105 /* InterfaceKeyword */: + case 130 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 122 /* ModuleKeyword */: - case 123 /* NamespaceKeyword */: + case 123 /* ModuleKeyword */: + case 124 /* NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 115 /* AsyncKeyword */: - case 119 /* DeclareKeyword */: + case 116 /* AsyncKeyword */: + case 120 /* DeclareKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 86 /* ImportKeyword */: + case 87 /* ImportKeyword */: nextToken(); - return token === 8 /* StringLiteral */ || token === 36 /* AsteriskToken */ || - token === 14 /* OpenBraceToken */ || isIdentifierOrKeyword(); - case 79 /* ExportKeyword */: + return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || + token === 15 /* OpenBraceToken */ || isIdentifierOrKeyword(); + case 80 /* ExportKeyword */: nextToken(); - if (token === 54 /* EqualsToken */ || token === 36 /* AsteriskToken */ || - token === 14 /* OpenBraceToken */ || token === 74 /* DefaultKeyword */) { + if (token === 55 /* EqualsToken */ || token === 37 /* AsteriskToken */ || + token === 15 /* OpenBraceToken */ || token === 75 /* DefaultKeyword */) { return true; } continue; - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 110 /* StaticKeyword */: - case 112 /* AbstractKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 111 /* StaticKeyword */: + case 113 /* AbstractKeyword */: nextToken(); continue; default: @@ -10676,47 +10836,47 @@ var ts; } function isStartOfStatement() { switch (token) { - case 53 /* AtToken */: - case 22 /* SemicolonToken */: - case 14 /* OpenBraceToken */: - case 99 /* VarKeyword */: - case 105 /* LetKeyword */: - case 84 /* FunctionKeyword */: - case 70 /* ClassKeyword */: - case 78 /* EnumKeyword */: - case 85 /* IfKeyword */: - case 76 /* DoKeyword */: - case 101 /* WhileKeyword */: - case 83 /* ForKeyword */: - case 72 /* ContinueKeyword */: - case 67 /* BreakKeyword */: - case 91 /* ReturnKeyword */: - case 102 /* WithKeyword */: - case 93 /* SwitchKeyword */: - case 95 /* ThrowKeyword */: - case 97 /* TryKeyword */: - case 73 /* DebuggerKeyword */: + case 54 /* AtToken */: + case 23 /* SemicolonToken */: + case 15 /* OpenBraceToken */: + case 100 /* VarKeyword */: + case 106 /* LetKeyword */: + case 85 /* FunctionKeyword */: + case 71 /* ClassKeyword */: + case 79 /* EnumKeyword */: + case 86 /* IfKeyword */: + case 77 /* DoKeyword */: + case 102 /* WhileKeyword */: + case 84 /* ForKeyword */: + case 73 /* ContinueKeyword */: + case 68 /* BreakKeyword */: + case 92 /* ReturnKeyword */: + case 103 /* WithKeyword */: + case 94 /* SwitchKeyword */: + case 96 /* ThrowKeyword */: + case 98 /* TryKeyword */: + case 74 /* DebuggerKeyword */: // 'catch' and 'finally' do not actually indicate that the code is part of a statement, // however, we say they are here so that we may gracefully parse them and error later. - case 69 /* CatchKeyword */: - case 82 /* FinallyKeyword */: + case 70 /* CatchKeyword */: + case 83 /* FinallyKeyword */: return true; - case 71 /* ConstKeyword */: - case 79 /* ExportKeyword */: - case 86 /* ImportKeyword */: + case 72 /* ConstKeyword */: + case 80 /* ExportKeyword */: + case 87 /* ImportKeyword */: return isStartOfDeclaration(); - case 115 /* AsyncKeyword */: - case 119 /* DeclareKeyword */: - case 104 /* InterfaceKeyword */: - case 122 /* ModuleKeyword */: - case 123 /* NamespaceKeyword */: - case 129 /* TypeKeyword */: + case 116 /* AsyncKeyword */: + case 120 /* DeclareKeyword */: + case 105 /* InterfaceKeyword */: + case 123 /* ModuleKeyword */: + case 124 /* NamespaceKeyword */: + case 130 /* TypeKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 110 /* StaticKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 111 /* StaticKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -10726,7 +10886,7 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuring() { nextToken(); - return isIdentifier() || token === 14 /* OpenBraceToken */ || token === 18 /* OpenBracketToken */; + return isIdentifier() || token === 15 /* OpenBraceToken */ || token === 19 /* OpenBracketToken */; } function isLetDeclaration() { // In ES6 'let' always starts a lexical declaration if followed by an identifier or { @@ -10735,65 +10895,65 @@ var ts; } function parseStatement() { switch (token) { - case 22 /* SemicolonToken */: + case 23 /* SemicolonToken */: return parseEmptyStatement(); - case 14 /* OpenBraceToken */: - return parseBlock(false); - case 99 /* VarKeyword */: - return parseVariableStatement(scanner.getStartPos(), undefined, undefined); - case 105 /* LetKeyword */: + case 15 /* OpenBraceToken */: + return parseBlock(/*ignoreMissingOpenBrace*/ false); + case 100 /* VarKeyword */: + return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); + case 106 /* LetKeyword */: if (isLetDeclaration()) { - return parseVariableStatement(scanner.getStartPos(), undefined, undefined); + return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); } break; - case 84 /* FunctionKeyword */: - return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); - case 70 /* ClassKeyword */: - return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); - case 85 /* IfKeyword */: + case 85 /* FunctionKeyword */: + return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); + case 71 /* ClassKeyword */: + return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); + case 86 /* IfKeyword */: return parseIfStatement(); - case 76 /* DoKeyword */: + case 77 /* DoKeyword */: return parseDoStatement(); - case 101 /* WhileKeyword */: + case 102 /* WhileKeyword */: return parseWhileStatement(); - case 83 /* ForKeyword */: + case 84 /* ForKeyword */: return parseForOrForInOrForOfStatement(); - case 72 /* ContinueKeyword */: - return parseBreakOrContinueStatement(199 /* ContinueStatement */); - case 67 /* BreakKeyword */: - return parseBreakOrContinueStatement(200 /* BreakStatement */); - case 91 /* ReturnKeyword */: + case 73 /* ContinueKeyword */: + return parseBreakOrContinueStatement(200 /* ContinueStatement */); + case 68 /* BreakKeyword */: + return parseBreakOrContinueStatement(201 /* BreakStatement */); + case 92 /* ReturnKeyword */: return parseReturnStatement(); - case 102 /* WithKeyword */: + case 103 /* WithKeyword */: return parseWithStatement(); - case 93 /* SwitchKeyword */: + case 94 /* SwitchKeyword */: return parseSwitchStatement(); - case 95 /* ThrowKeyword */: + case 96 /* ThrowKeyword */: return parseThrowStatement(); - case 97 /* TryKeyword */: + case 98 /* TryKeyword */: // Include 'catch' and 'finally' for error recovery. - case 69 /* CatchKeyword */: - case 82 /* FinallyKeyword */: + case 70 /* CatchKeyword */: + case 83 /* FinallyKeyword */: return parseTryStatement(); - case 73 /* DebuggerKeyword */: + case 74 /* DebuggerKeyword */: return parseDebuggerStatement(); - case 53 /* AtToken */: + case 54 /* AtToken */: return parseDeclaration(); - case 115 /* AsyncKeyword */: - case 104 /* InterfaceKeyword */: - case 129 /* TypeKeyword */: - case 122 /* ModuleKeyword */: - case 123 /* NamespaceKeyword */: - case 119 /* DeclareKeyword */: - case 71 /* ConstKeyword */: - case 78 /* EnumKeyword */: - case 79 /* ExportKeyword */: - case 86 /* ImportKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 109 /* PublicKeyword */: - case 112 /* AbstractKeyword */: - case 110 /* StaticKeyword */: + case 116 /* AsyncKeyword */: + case 105 /* InterfaceKeyword */: + case 130 /* TypeKeyword */: + case 123 /* ModuleKeyword */: + case 124 /* NamespaceKeyword */: + case 120 /* DeclareKeyword */: + case 72 /* ConstKeyword */: + case 79 /* EnumKeyword */: + case 80 /* ExportKeyword */: + case 87 /* ImportKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 110 /* PublicKeyword */: + case 113 /* AbstractKeyword */: + case 111 /* StaticKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -10806,35 +10966,35 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 99 /* VarKeyword */: - case 105 /* LetKeyword */: - case 71 /* ConstKeyword */: + case 100 /* VarKeyword */: + case 106 /* LetKeyword */: + case 72 /* ConstKeyword */: return parseVariableStatement(fullStart, decorators, modifiers); - case 84 /* FunctionKeyword */: + case 85 /* FunctionKeyword */: return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 70 /* ClassKeyword */: + case 71 /* ClassKeyword */: return parseClassDeclaration(fullStart, decorators, modifiers); - case 104 /* InterfaceKeyword */: + case 105 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 129 /* TypeKeyword */: + case 130 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 78 /* EnumKeyword */: + case 79 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 122 /* ModuleKeyword */: - case 123 /* NamespaceKeyword */: + case 123 /* ModuleKeyword */: + case 124 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); - case 86 /* ImportKeyword */: + case 87 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 79 /* ExportKeyword */: + case 80 /* ExportKeyword */: nextToken(); - return token === 74 /* DefaultKeyword */ || token === 54 /* EqualsToken */ ? + return token === 75 /* DefaultKeyword */ || token === 55 /* EqualsToken */ ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(228 /* MissingDeclaration */, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(229 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -10844,86 +11004,86 @@ var ts; } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 8 /* StringLiteral */); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 9 /* StringLiteral */); } function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) { - if (token !== 14 /* OpenBraceToken */ && canParseSemicolon()) { + if (token !== 15 /* OpenBraceToken */ && canParseSemicolon()) { parseSemicolon(); return; } - return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage); + return parseFunctionBlock(isGenerator, isAsync, /*ignoreMissingOpenBrace*/ false, diagnosticMessage); } // DECLARATIONS function parseArrayBindingElement() { - if (token === 23 /* CommaToken */) { - return createNode(184 /* OmittedExpression */); + if (token === 24 /* CommaToken */) { + return createNode(185 /* OmittedExpression */); } - var node = createNode(160 /* BindingElement */); - node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); + var node = createNode(161 /* BindingElement */); + node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); - node.initializer = parseBindingElementInitializer(false); + node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(160 /* BindingElement */); + var node = createNode(161 /* BindingElement */); // TODO(andersh): Handle computed properties var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 52 /* ColonToken */) { + if (tokenIsIdentifier && token !== 53 /* ColonToken */) { node.name = propertyName; } else { - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } - node.initializer = parseBindingElementInitializer(false); + node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(158 /* ObjectBindingPattern */); - parseExpected(14 /* OpenBraceToken */); + var node = createNode(159 /* ObjectBindingPattern */); + parseExpected(15 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(159 /* ArrayBindingPattern */); - parseExpected(18 /* OpenBracketToken */); + var node = createNode(160 /* ArrayBindingPattern */); + parseExpected(19 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); return finishNode(node); } function isIdentifierOrPattern() { - return token === 14 /* OpenBraceToken */ || token === 18 /* OpenBracketToken */ || isIdentifier(); + return token === 15 /* OpenBraceToken */ || token === 19 /* OpenBracketToken */ || isIdentifier(); } function parseIdentifierOrPattern() { - if (token === 18 /* OpenBracketToken */) { + if (token === 19 /* OpenBracketToken */) { return parseArrayBindingPattern(); } - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { return parseObjectBindingPattern(); } return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(208 /* VariableDeclaration */); + var node = createNode(209 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { - node.initializer = parseInitializer(false); + node.initializer = parseInitializer(/*inParameter*/ false); } return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(209 /* VariableDeclarationList */); + var node = createNode(210 /* VariableDeclarationList */); switch (token) { - case 99 /* VarKeyword */: + case 100 /* VarKeyword */: break; - case 105 /* LetKeyword */: + case 106 /* LetKeyword */: node.flags |= 16384 /* Let */; break; - case 71 /* ConstKeyword */: + case 72 /* ConstKeyword */: node.flags |= 32768 /* Const */; break; default: @@ -10939,7 +11099,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token === 131 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 132 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -10951,40 +11111,40 @@ var ts; return finishNode(node); } function canFollowContextualOfKeyword() { - return nextTokenIsIdentifier() && nextToken() === 17 /* CloseParenToken */; + return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(190 /* VariableStatement */, fullStart); + var node = createNode(191 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.declarationList = parseVariableDeclarationList(false); + node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(210 /* FunctionDeclaration */, fullStart); + var node = createNode(211 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(84 /* FunctionKeyword */); - node.asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + parseExpected(85 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); node.name = node.flags & 1024 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512 /* Async */); - fillSignature(52 /* ColonToken */, isGenerator, isAsync, false, node); + fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(141 /* Constructor */, pos); + var node = createNode(142 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(118 /* ConstructorKeyword */); - fillSignature(52 /* ColonToken */, false, false, false, node); - node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); + parseExpected(119 /* ConstructorKeyword */); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(140 /* MethodDeclaration */, fullStart); + var method = createNode(141 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -10992,12 +11152,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512 /* Async */); - fillSignature(52 /* ColonToken */, isGenerator, isAsync, false, method); + fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(138 /* PropertyDeclaration */, fullStart); + var property = createNode(139 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -11019,12 +11179,12 @@ var ts; return finishNode(property); } function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { - var asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + var asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var name = parsePropertyName(); // Note: this is not legal as per the grammar. But we allow it in the parser and // report an error in the grammar checker. - var questionToken = parseOptionalToken(51 /* QuestionToken */); - if (asteriskToken || token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { + var questionToken = parseOptionalToken(52 /* QuestionToken */); + if (asteriskToken || token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { @@ -11032,23 +11192,23 @@ var ts; } } function parseNonParameterInitializer() { - return parseInitializer(false); + return parseInitializer(/*inParameter*/ false); } function parseAccessorDeclaration(kind, fullStart, decorators, modifiers) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(52 /* ColonToken */, false, false, false, node); - node.body = parseFunctionBlockOrSemicolon(false, false); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 110 /* StaticKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 111 /* StaticKeyword */: return true; default: return false; @@ -11056,7 +11216,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 53 /* AtToken */) { + if (token === 54 /* AtToken */) { return true; } // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. @@ -11073,7 +11233,7 @@ var ts; } nextToken(); } - if (token === 36 /* AsteriskToken */) { + if (token === 37 /* AsteriskToken */) { return true; } // Try to get the first property-like token following all modifiers. @@ -11083,23 +11243,23 @@ var ts; nextToken(); } // Index signatures and computed properties are class members; we can parse. - if (token === 18 /* OpenBracketToken */) { + if (token === 19 /* OpenBracketToken */) { return true; } // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 126 /* SetKeyword */ || idToken === 120 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 127 /* SetKeyword */ || idToken === 121 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along // to see if it should actually be parsed as a class member. switch (token) { - case 16 /* OpenParenToken */: // Method declaration - case 24 /* LessThanToken */: // Generic Method declaration - case 52 /* ColonToken */: // Type Annotation for declaration - case 54 /* EqualsToken */: // Initializer for declaration - case 51 /* QuestionToken */: + case 17 /* OpenParenToken */: // Method declaration + case 25 /* LessThanToken */: // Generic Method declaration + case 53 /* ColonToken */: // Type Annotation for declaration + case 55 /* EqualsToken */: // Initializer for declaration + case 52 /* QuestionToken */: return true; default: // Covers @@ -11116,14 +11276,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(53 /* AtToken */)) { + if (!parseOptional(54 /* AtToken */)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(136 /* Decorator */, decoratorStart); + var decorator = createNode(137 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -11157,7 +11317,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 115 /* AsyncKeyword */) { + if (token === 116 /* AsyncKeyword */) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -11171,8 +11331,8 @@ var ts; return modifiers; } function parseClassElement() { - if (token === 22 /* SemicolonToken */) { - var result = createNode(188 /* SemicolonClassElement */); + if (token === 23 /* SemicolonToken */) { + var result = createNode(189 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -11183,7 +11343,7 @@ var ts; if (accessor) { return accessor; } - if (token === 118 /* ConstructorKeyword */) { + if (token === 119 /* ConstructorKeyword */) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { @@ -11192,16 +11352,16 @@ var ts; // It is very important that we check this *after* checking indexers because // the [ token can start an index signature or a computed property name if (isIdentifierOrKeyword() || - token === 8 /* StringLiteral */ || - token === 7 /* NumericLiteral */ || - token === 36 /* AsteriskToken */ || - token === 18 /* OpenBracketToken */) { + token === 9 /* StringLiteral */ || + token === 8 /* NumericLiteral */ || + token === 37 /* AsteriskToken */ || + token === 19 /* OpenBracketToken */) { return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_7 = createMissingNode(66 /* Identifier */, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, undefined); + var name_7 = createMissingNode(67 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -11210,24 +11370,24 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 183 /* ClassExpression */); + /*modifiers*/ undefined, 184 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 211 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(70 /* ClassKeyword */); + parseExpected(71 /* ClassKeyword */); node.name = parseOptionalIdentifier(); node.typeParameters = parseTypeParameters(); - node.heritageClauses = parseHeritageClauses(true); - if (parseExpected(14 /* OpenBraceToken */)) { + node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ true); + if (parseExpected(15 /* OpenBraceToken */)) { // ClassTail[Yield,Await] : (Modified) See 14.5 // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } node.members = parseClassMembers(); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -11246,8 +11406,8 @@ var ts; return parseList(20 /* HeritageClauses */, parseHeritageClause); } function parseHeritageClause() { - if (token === 80 /* ExtendsKeyword */ || token === 103 /* ImplementsKeyword */) { - var node = createNode(240 /* HeritageClause */); + if (token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */) { + var node = createNode(241 /* HeritageClause */); node.token = token; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -11256,38 +11416,38 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(185 /* ExpressionWithTypeArguments */); + var node = createNode(186 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); - if (token === 24 /* LessThanToken */) { - node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 24 /* LessThanToken */, 26 /* GreaterThanToken */); + if (token === 25 /* LessThanToken */) { + node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); } return finishNode(node); } function isHeritageClause() { - return token === 80 /* ExtendsKeyword */ || token === 103 /* ImplementsKeyword */; + return token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; } function parseClassMembers() { return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212 /* InterfaceDeclaration */, fullStart); + var node = createNode(213 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(104 /* InterfaceKeyword */); + parseExpected(105 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - node.heritageClauses = parseHeritageClauses(false); + node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ false); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213 /* TypeAliasDeclaration */, fullStart); + var node = createNode(214 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(129 /* TypeKeyword */); + parseExpected(130 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(54 /* EqualsToken */); + parseExpected(55 /* EqualsToken */); node.type = parseType(); parseSemicolon(); return finishNode(node); @@ -11297,20 +11457,20 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(244 /* EnumMember */, scanner.getStartPos()); + var node = createNode(245 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214 /* EnumDeclaration */, fullStart); + var node = createNode(215 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(78 /* EnumKeyword */); + parseExpected(79 /* EnumKeyword */); node.name = parseIdentifier(); - if (parseExpected(14 /* OpenBraceToken */)) { + if (parseExpected(15 /* OpenBraceToken */)) { node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -11318,10 +11478,10 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(216 /* ModuleBlock */, scanner.getStartPos()); - if (parseExpected(14 /* OpenBraceToken */)) { + var node = createNode(217 /* ModuleBlock */, scanner.getStartPos()); + if (parseExpected(15 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -11329,84 +11489,84 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(215 /* ModuleDeclaration */, fullStart); + var node = createNode(216 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 /* Export */) + node.body = parseOptional(21 /* DotToken */) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215 /* ModuleDeclaration */, fullStart); + var node = createNode(216 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.name = parseLiteralNode(true); + node.name = parseLiteralNode(/*internName*/ true); node.body = parseModuleBlock(); return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(123 /* NamespaceKeyword */)) { + if (parseOptional(124 /* NamespaceKeyword */)) { flags |= 131072 /* Namespace */; } else { - parseExpected(122 /* ModuleKeyword */); - if (token === 8 /* StringLiteral */) { + parseExpected(123 /* ModuleKeyword */); + if (token === 9 /* StringLiteral */) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } } return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 124 /* RequireKeyword */ && + return token === 125 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { - return nextToken() === 16 /* OpenParenToken */; + return nextToken() === 17 /* OpenParenToken */; } function nextTokenIsSlash() { - return nextToken() === 37 /* SlashToken */; + return nextToken() === 38 /* SlashToken */; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 /* CommaToken */ || - token === 130 /* FromKeyword */; + return token === 24 /* CommaToken */ || + token === 131 /* FromKeyword */; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(86 /* ImportKeyword */); + parseExpected(87 /* ImportKeyword */); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 23 /* CommaToken */ && token !== 130 /* FromKeyword */) { + if (token !== 24 /* CommaToken */ && token !== 131 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(218 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(219 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(54 /* EqualsToken */); + parseExpected(55 /* EqualsToken */); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } // Import statement - var importDeclaration = createNode(219 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(220 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: // import ImportClause from ModuleSpecifier ; // import ModuleSpecifier; if (identifier || - token === 36 /* AsteriskToken */ || - token === 14 /* OpenBraceToken */) { + token === 37 /* AsteriskToken */ || + token === 15 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(130 /* FromKeyword */); + parseExpected(131 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -11419,7 +11579,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(220 /* ImportClause */, fullStart); + var importClause = createNode(221 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -11428,22 +11588,22 @@ var ts; // If there was no default import or if there is comma token after default import // parse namespace or named imports if (!importClause.name || - parseOptional(23 /* CommaToken */)) { - importClause.namedBindings = token === 36 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(222 /* NamedImports */); + parseOptional(24 /* CommaToken */)) { + importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(223 /* NamedImports */); } return finishNode(importClause); } function parseModuleReference() { return isExternalModuleReference() ? parseExternalModuleReference() - : parseEntityName(false); + : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(229 /* ExternalModuleReference */); - parseExpected(124 /* RequireKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(230 /* ExternalModuleReference */); + parseExpected(125 /* RequireKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = parseModuleSpecifier(); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseModuleSpecifier() { @@ -11453,7 +11613,7 @@ var ts; var result = parseExpression(); // Ensure the string being required is in our 'identifier' table. This will ensure // that features like 'find refs' will look inside this file when search for its name. - if (result.kind === 8 /* StringLiteral */) { + if (result.kind === 9 /* StringLiteral */) { internIdentifier(result.text); } return result; @@ -11461,9 +11621,9 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(221 /* NamespaceImport */); - parseExpected(36 /* AsteriskToken */); - parseExpected(113 /* AsKeyword */); + var namespaceImport = createNode(222 /* NamespaceImport */); + parseExpected(37 /* AsteriskToken */); + parseExpected(114 /* AsKeyword */); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } @@ -11476,14 +11636,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 222 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 14 /* OpenBraceToken */, 15 /* CloseBraceToken */); + node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 223 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(227 /* ExportSpecifier */); + return parseImportOrExportSpecifier(228 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(223 /* ImportSpecifier */); + return parseImportOrExportSpecifier(224 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -11497,9 +11657,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 113 /* AsKeyword */) { + if (token === 114 /* AsKeyword */) { node.propertyName = identifierName; - parseExpected(113 /* AsKeyword */); + parseExpected(114 /* AsKeyword */); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -11508,27 +11668,27 @@ var ts; else { node.name = identifierName; } - if (kind === 223 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 224 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225 /* ExportDeclaration */, fullStart); + var node = createNode(226 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(36 /* AsteriskToken */)) { - parseExpected(130 /* FromKeyword */); + if (parseOptional(37 /* AsteriskToken */)) { + parseExpected(131 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(226 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(227 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token === 130 /* FromKeyword */ || (token === 8 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(130 /* FromKeyword */); + if (token === 131 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(131 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -11536,21 +11696,21 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(224 /* ExportAssignment */, fullStart); + var node = createNode(225 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(54 /* EqualsToken */)) { + if (parseOptional(55 /* EqualsToken */)) { node.isExportEquals = true; } else { - parseExpected(74 /* DefaultKeyword */); + parseExpected(75 /* DefaultKeyword */); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); return finishNode(node); } function processReferenceComments(sourceFile) { - var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0 /* Standard */, sourceText); + var triviaScanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText); var referencedFiles = []; var amdDependencies = []; var amdModuleName; @@ -11609,10 +11769,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 /* Export */ - || node.kind === 218 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 229 /* ExternalModuleReference */ - || node.kind === 219 /* ImportDeclaration */ - || node.kind === 224 /* ExportAssignment */ - || node.kind === 225 /* ExportDeclaration */ + || node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 230 /* ExternalModuleReference */ + || node.kind === 220 /* ImportDeclaration */ + || node.kind === 225 /* ExportAssignment */ + || node.kind === 226 /* ExportDeclaration */ ? node : undefined; }); @@ -11657,23 +11817,23 @@ var ts; (function (JSDocParser) { function isJSDocType() { switch (token) { - case 36 /* AsteriskToken */: - case 51 /* QuestionToken */: - case 16 /* OpenParenToken */: - case 18 /* OpenBracketToken */: - case 47 /* ExclamationToken */: - case 14 /* OpenBraceToken */: - case 84 /* FunctionKeyword */: - case 21 /* DotDotDotToken */: - case 89 /* NewKeyword */: - case 94 /* ThisKeyword */: + case 37 /* AsteriskToken */: + case 52 /* QuestionToken */: + case 17 /* OpenParenToken */: + case 19 /* OpenBracketToken */: + case 48 /* ExclamationToken */: + case 15 /* OpenBraceToken */: + case 85 /* FunctionKeyword */: + case 22 /* DotDotDotToken */: + case 90 /* NewKeyword */: + case 95 /* ThisKeyword */: return true; } return isIdentifierOrKeyword(); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, undefined); + initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -11687,23 +11847,23 @@ var ts; scanner.setText(sourceText, start, length); // Prime the first token for us to start processing. token = nextToken(); - var result = createNode(246 /* JSDocTypeExpression */); - parseExpected(14 /* OpenBraceToken */); + var result = createNode(247 /* JSDocTypeExpression */); + parseExpected(15 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); fixupParentReferences(result); return finishNode(result); } JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 45 /* BarToken */) { - var unionType = createNode(250 /* JSDocUnionType */, type.pos); + if (token === 46 /* BarToken */) { + var unionType = createNode(251 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 54 /* EqualsToken */) { - var optionalType = createNode(257 /* JSDocOptionalType */, type.pos); + if (token === 55 /* EqualsToken */) { + var optionalType = createNode(258 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -11713,21 +11873,21 @@ var ts; function parseJSDocType() { var type = parseBasicTypeExpression(); while (true) { - if (token === 18 /* OpenBracketToken */) { - var arrayType = createNode(249 /* JSDocArrayType */, type.pos); + if (token === 19 /* OpenBracketToken */) { + var arrayType = createNode(250 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); type = finishNode(arrayType); } - else if (token === 51 /* QuestionToken */) { - var nullableType = createNode(252 /* JSDocNullableType */, type.pos); + else if (token === 52 /* QuestionToken */) { + var nullableType = createNode(253 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 47 /* ExclamationToken */) { - var nonNullableType = createNode(253 /* JSDocNonNullableType */, type.pos); + else if (token === 48 /* ExclamationToken */) { + var nonNullableType = createNode(254 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -11740,85 +11900,85 @@ var ts; } function parseBasicTypeExpression() { switch (token) { - case 36 /* AsteriskToken */: + case 37 /* AsteriskToken */: return parseJSDocAllType(); - case 51 /* QuestionToken */: + case 52 /* QuestionToken */: return parseJSDocUnknownOrNullableType(); - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: return parseJSDocUnionType(); - case 18 /* OpenBracketToken */: + case 19 /* OpenBracketToken */: return parseJSDocTupleType(); - case 47 /* ExclamationToken */: + case 48 /* ExclamationToken */: return parseJSDocNonNullableType(); - case 14 /* OpenBraceToken */: + case 15 /* OpenBraceToken */: return parseJSDocRecordType(); - case 84 /* FunctionKeyword */: + case 85 /* FunctionKeyword */: return parseJSDocFunctionType(); - case 21 /* DotDotDotToken */: + case 22 /* DotDotDotToken */: return parseJSDocVariadicType(); - case 89 /* NewKeyword */: + case 90 /* NewKeyword */: return parseJSDocConstructorType(); - case 94 /* ThisKeyword */: + case 95 /* ThisKeyword */: return parseJSDocThisType(); - case 114 /* AnyKeyword */: - case 127 /* StringKeyword */: - case 125 /* NumberKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: - case 100 /* VoidKeyword */: + case 115 /* AnyKeyword */: + case 128 /* StringKeyword */: + case 126 /* NumberKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: + case 101 /* VoidKeyword */: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(261 /* JSDocThisType */); + var result = createNode(262 /* JSDocThisType */); nextToken(); - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(260 /* JSDocConstructorType */); + var result = createNode(261 /* JSDocConstructorType */); nextToken(); - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(259 /* JSDocVariadicType */); + var result = createNode(260 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(258 /* JSDocFunctionType */); + var result = createNode(259 /* JSDocFunctionType */); nextToken(); - parseExpected(16 /* OpenParenToken */); + parseExpected(17 /* OpenParenToken */); result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); checkForTrailingComma(result.parameters); - parseExpected(17 /* CloseParenToken */); - if (token === 52 /* ColonToken */) { + parseExpected(18 /* CloseParenToken */); + if (token === 53 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(135 /* Parameter */); + var parameter = createNode(136 /* Parameter */); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(257 /* JSDocOptionalType */, type.pos); + var result = createNode(258 /* JSDocOptionalType */, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(256 /* JSDocTypeReference */); + var result = createNode(257 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); - while (parseOptional(20 /* DotToken */)) { - if (token === 24 /* LessThanToken */) { + while (parseOptional(21 /* DotToken */)) { + if (token === 25 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); break; } @@ -11834,7 +11994,7 @@ var ts; var typeArguments = parseDelimitedList(23 /* JSDocTypeArguments */, parseJSDocType); checkForTrailingComma(typeArguments); checkForEmptyTypeArgumentList(typeArguments); - parseExpected(26 /* GreaterThanToken */); + parseExpected(27 /* GreaterThanToken */); return typeArguments; } function checkForEmptyTypeArgumentList(typeArguments) { @@ -11845,40 +12005,40 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(132 /* QualifiedName */, left.pos); + var result = createNode(133 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(254 /* JSDocRecordType */); + var result = createNode(255 /* JSDocRecordType */); nextToken(); result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); checkForTrailingComma(result.members); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(255 /* JSDocRecordMember */); + var result = createNode(256 /* JSDocRecordMember */); result.name = parseSimplePropertyName(); - if (token === 52 /* ColonToken */) { + if (token === 53 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(253 /* JSDocNonNullableType */); + var result = createNode(254 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(251 /* JSDocTupleType */); + var result = createNode(252 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); return finishNode(result); } function checkForTrailingComma(list) { @@ -11888,10 +12048,10 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(250 /* JSDocUnionType */); + var result = createNode(251 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return finishNode(result); } function parseJSDocTypeList(firstType) { @@ -11899,14 +12059,14 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(45 /* BarToken */)) { + while (parseOptional(46 /* BarToken */)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(247 /* JSDocAllType */); + var result = createNode(248 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -11923,24 +12083,24 @@ var ts; // Foo // Foo(?= // (?| - if (token === 23 /* CommaToken */ || - token === 15 /* CloseBraceToken */ || - token === 17 /* CloseParenToken */ || - token === 26 /* GreaterThanToken */ || - token === 54 /* EqualsToken */ || - token === 45 /* BarToken */) { - var result = createNode(248 /* JSDocUnknownType */, pos); + if (token === 24 /* CommaToken */ || + token === 16 /* CloseBraceToken */ || + token === 18 /* CloseParenToken */ || + token === 27 /* GreaterThanToken */ || + token === 55 /* EqualsToken */ || + token === 46 /* BarToken */) { + var result = createNode(249 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(252 /* JSDocNullableType */, pos); + var result = createNode(253 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, undefined); - var jsDocComment = parseJSDocComment(undefined, start, length); + initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + var jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); var diagnostics = parseDiagnostics; clearState(); return jsDocComment ? { jsDocComment: jsDocComment, diagnostics: diagnostics } : undefined; @@ -12021,7 +12181,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(262 /* JSDocComment */, start); + var result = createNode(263 /* JSDocComment */, start); result.tags = tags; return finishNode(result, end); } @@ -12032,7 +12192,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64 /* at */); - var atToken = createNode(53 /* AtToken */, pos - 1); + var atToken = createNode(54 /* AtToken */, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -12058,7 +12218,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(263 /* JSDocTag */, atToken.pos); + var result = createNode(264 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -12110,7 +12270,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(264 /* JSDocParameterTag */, atToken.pos); + var result = createNode(265 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -12120,27 +12280,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 265 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 266 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(265 /* JSDocReturnTag */, atToken.pos); + var result = createNode(266 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 267 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266 /* JSDocTypeTag */, atToken.pos); + var result = createNode(267 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -12153,7 +12313,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(134 /* TypeParameter */, name_8.pos); + var typeParameter = createNode(135 /* TypeParameter */, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -12164,7 +12324,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(267 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(268 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -12185,7 +12345,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(66 /* Identifier */, startPos); + var result = createNode(67 /* Identifier */, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -12205,7 +12365,7 @@ var ts; if (sourceFile.statements.length === 0) { // If we don't have any statements in the current source file, then there's no real // way to incrementally parse. So just do a full parse instead. - return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true); + return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setNodeParents*/ true); } // Make sure we're not trying to incrementally update a source file more than once. Once // we do an update the original source file is considered unusbale from that point onwards. @@ -12261,7 +12421,7 @@ var ts; // inconsistent tree. Setting the parents on the new tree should be very fast. We // will immediately bail out of walking any subtrees when we can see that their parents // are already correct. - var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true); + var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true); return result; } IncrementalParser.updateSourceFile = updateSourceFile; @@ -12274,7 +12434,7 @@ var ts; } return; function visitNode(node) { - var text = ''; + var text = ""; if (aggressiveChecks && shouldCheckNode(node)) { text = oldText.substring(node.pos, node.end); } @@ -12306,9 +12466,9 @@ var ts; } function shouldCheckNode(node) { switch (node.kind) { - case 8 /* StringLiteral */: - case 7 /* NumericLiteral */: - case 66 /* Identifier */: + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + case 67 /* Identifier */: return true; } return false; @@ -12400,7 +12560,7 @@ var ts; if (child.pos > changeRangeOldEnd) { // Node is entirely past the change range. We need to move both its pos and // end, forward or backward appropriately. - moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks); + moveElementEntirelyPastChangeRange(child, /*isArray*/ false, delta, oldText, newText, aggressiveChecks); return; } // Check if the element intersects the change range. If it does, then it is not @@ -12424,7 +12584,7 @@ var ts; if (array.pos > changeRangeOldEnd) { // Array is entirely after the change range. We need to move it, and move any of // its children. - moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks); + moveElementEntirelyPastChangeRange(array, /*isArray*/ true, delta, oldText, newText, aggressiveChecks); return; } // Check if the element intersects the change range. If it does, then it is not @@ -12717,17 +12877,20 @@ var ts; isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + // The language service will always care about the narrowed type of a symbol, because that is + // the type the language says the symbol should have. + getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, + getBaseTypes: getBaseTypes, getReturnTypeOfSignature: getReturnTypeOfSignature, getSymbolsInScope: getSymbolsInScope, getSymbolAtLocation: getSymbolAtLocation, getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getTypeAtLocation: getTypeAtLocation, + getTypeAtLocation: getTypeOfNode, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -12744,7 +12907,8 @@ var ts; getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, getJsxElementAttributesType: getJsxElementAttributesType, - getJsxIntrinsicTagNames: getJsxIntrinsicTagNames + getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, + isOptionalParameter: isOptionalParameter }; var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); @@ -12752,16 +12916,19 @@ var ts; var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); - var esSymbolType = createIntrinsicType(4194304 /* ESSymbol */, "symbol"); + var esSymbolType = createIntrinsicType(16777216 /* ESSymbol */, "symbol"); var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 1048576 /* ContainsUndefinedOrNull */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 1048576 /* ContainsUndefinedOrNull */, "null"); + var undefinedType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); + var nullType = createIntrinsicType(64 /* Null */ | 2097152 /* ContainsUndefinedOrNull */, "null"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); var circularType = createIntrinsicType(1 /* Any */, "__circular__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + // The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated + // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. + anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); @@ -12806,6 +12973,7 @@ var ts; var emitGenerator = false; var resolutionTargets = []; var resolutionResults = []; + var resolutionPropertyNames = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -12827,7 +12995,7 @@ var ts; }, "symbol": { type: esSymbolType, - flags: 4194304 /* ESSymbol */ + flags: 16777216 /* ESSymbol */ } }; var JsxNames = { @@ -12840,6 +13008,15 @@ var ts; var subtypeRelation = {}; var assignableRelation = {}; var identityRelation = {}; + // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. + var _displayBuilder; + var TypeSystemPropertyName; + (function (TypeSystemPropertyName) { + TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type"; + TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType"; + TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType"; + TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; + })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); initializeTypeChecker(); return checker; function getEmitResolver(sourceFile, cancellationToken) { @@ -12984,10 +13161,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 245 /* SourceFile */); + return ts.getAncestor(node, 246 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 245 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 246 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -13013,7 +13190,7 @@ var ts; if (file1 === file2) { return node1.pos <= node2.pos; } - if (!compilerOptions.out) { + if (!compilerOptions.outFile && !compilerOptions.out) { return true; } var sourceFiles = host.getSourceFiles(); @@ -13044,13 +13221,13 @@ var ts; } } switch (location.kind) { - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 245 /* SourceFile */ || - (location.kind === 215 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { + if (location.kind === 246 /* SourceFile */ || + (location.kind === 216 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { // It's an external module. Because of module/namespace merging, a module's exports are in scope, // yet we never want to treat an export specifier as putting a member in scope. Therefore, // if the name we find is purely an export specifier, it is not actually considered in scope. @@ -13064,7 +13241,7 @@ var ts; // which is not the desired behavior. if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 227 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 228 /* ExportSpecifier */)) { break; } result = moduleExports["default"]; @@ -13078,13 +13255,13 @@ var ts; break loop; } break; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -13101,9 +13278,9 @@ var ts; } } break; - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 213 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -13114,7 +13291,7 @@ var ts; } break loop; } - if (location.kind === 183 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 184 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -13130,9 +13307,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 212 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 213 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -13140,19 +13317,19 @@ var ts; } } break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 170 /* FunctionExpression */: + case 171 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -13165,7 +13342,7 @@ var ts; } } break; - case 136 /* Decorator */: + case 137 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -13174,7 +13351,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 135 /* Parameter */) { + if (location.parent && location.parent.kind === 136 /* Parameter */) { location = location.parent; } // @@ -13209,7 +13386,18 @@ 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 */) { + // Only check for block-scoped variable if we are looking for the + // name with variable meaning + // For example, + // declare module foo { + // interface bar {} + // } + // let foo/*1*/: foo/*2*/.bar; + // The foo at /*1*/ and /*2*/ will share same symbol with two meaning + // block - scope variable and namespace module. However, only when we + // try to resolve name in /*1*/ which is used in variable position, + // we want to check for block- scoped + if (meaning & 2 /* BlockScopedVariable */ && result.flags & 2 /* BlockScopedVariable */) { checkResolvedBlockScopedVariable(result, errorLocation); } } @@ -13230,16 +13418,16 @@ var ts; // for (let x in x) // for (let x of x) // climb up to the variable declaration skipping binding patterns - var variableDeclaration = ts.getAncestor(declaration, 208 /* VariableDeclaration */); + var variableDeclaration = ts.getAncestor(declaration, 209 /* VariableDeclaration */); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 190 /* VariableStatement */ || - variableDeclaration.parent.parent.kind === 196 /* ForStatement */) { + if (variableDeclaration.parent.parent.kind === 191 /* VariableStatement */ || + variableDeclaration.parent.parent.kind === 197 /* ForStatement */) { // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 198 /* ForOfStatement */ || - variableDeclaration.parent.parent.kind === 197 /* ForInStatement */) { + else if (variableDeclaration.parent.parent.kind === 199 /* ForOfStatement */ || + variableDeclaration.parent.parent.kind === 198 /* ForInStatement */) { // ForIn/ForOf case - use site should not be used in expression part var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); @@ -13266,10 +13454,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 218 /* ImportEqualsDeclaration */) { + if (node.kind === 219 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 219 /* ImportDeclaration */) { + while (node && node.kind !== 220 /* ImportDeclaration */) { node = node.parent; } return node; @@ -13279,7 +13467,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 229 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 230 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -13386,17 +13574,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 220 /* ImportClause */: + case 221 /* ImportClause */: return getTargetOfImportClause(node); - case 221 /* NamespaceImport */: + case 222 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 223 /* ImportSpecifier */: + case 224 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 227 /* ExportSpecifier */: + case 228 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return getTargetOfExportAssignment(node); } } @@ -13441,11 +13629,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 224 /* ExportAssignment */) { + if (node.kind === 225 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 227 /* ExportSpecifier */) { + else if (node.kind === 228 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -13458,7 +13646,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 218 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 219 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -13467,17 +13655,17 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (entityName.kind === 66 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 67 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 66 /* Identifier */ || entityName.parent.kind === 132 /* QualifiedName */) { + if (entityName.kind === 67 /* Identifier */ || entityName.parent.kind === 133 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 218 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 219 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -13490,16 +13678,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 66 /* Identifier */) { + if (name.kind === 67 /* Identifier */) { var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 132 /* QualifiedName */ || name.kind === 163 /* PropertyAccessExpression */) { - var left = name.kind === 132 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 132 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 133 /* QualifiedName */ || name.kind === 164 /* PropertyAccessExpression */) { + var left = name.kind === 133 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 133 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -13524,7 +13712,7 @@ var ts; 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 !== 9 /* StringLiteral */) { return; } var moduleReferenceLiteral = moduleReferenceExpression; @@ -13532,29 +13720,18 @@ var ts; // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) + if (!moduleName) { return; + } var isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); + var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); if (symbol) { return symbol; } } - var fileName; - var sourceFile; - while (true) { - fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); - if (sourceFile || isRelative) { - break; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } + var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); + var sourceFile = fileName && host.getSourceFile(fileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -13662,7 +13839,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 141 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 142 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -13732,17 +13909,17 @@ var ts; } } switch (location_1.kind) { - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (!ts.isExternalModule(location_1)) { break; } - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -13783,7 +13960,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 227 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -13820,7 +13997,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 227 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -13836,7 +14013,7 @@ var ts; var meaningToLook = meaning; while (symbol) { // Symbol is accessible if it by itself is accessible - var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false); + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false); if (accessibleSymbolChain) { var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); if (!hasAccessibleDeclarations) { @@ -13893,8 +14070,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 215 /* ModuleDeclaration */ && declaration.name.kind === 8 /* StringLiteral */) || - (declaration.kind === 245 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 216 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || + (declaration.kind === 246 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -13930,12 +14107,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 151 /* TypeQuery */) { + if (entityName.parent.kind === 152 /* TypeQuery */) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 132 /* QualifiedName */ || entityName.kind === 163 /* PropertyAccessExpression */ || - entityName.parent.kind === 218 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 133 /* QualifiedName */ || entityName.kind === 164 /* PropertyAccessExpression */ || + entityName.parent.kind === 219 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -13945,7 +14122,7 @@ var ts; meaning = 793056 /* Type */; } var firstIdentifier = getFirstIdentifier(entityName); - var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); + var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); // Verify if the symbol is accessible return (symbol && hasVisibleDeclarations(symbol)) || { accessibility: 1 /* NotAccessible */, @@ -13990,17 +14167,15 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 157 /* ParenthesizedType */) { + while (node.kind === 158 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 213 /* TypeAliasDeclaration */) { + if (node.kind === 214 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } return undefined; } - // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. - var _displayBuilder; function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -14009,10 +14184,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: return "(Anonymous class)"; - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -14042,7 +14217,7 @@ var ts; buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 20 /* DotToken */); + writePunctuation(writer, 21 /* DotToken */); } parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); @@ -14098,7 +14273,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { // Write undefined/null type as any - if (type.flags & 4194431 /* Intrinsic */) { + if (type.flags & 16777343 /* Intrinsic */) { // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && isTypeAny(type) ? "any" @@ -14126,23 +14301,23 @@ var ts; else { // Should never get here // { ... } - writePunctuation(writer, 14 /* OpenBraceToken */); + writePunctuation(writer, 15 /* OpenBraceToken */); writeSpace(writer); - writePunctuation(writer, 21 /* DotDotDotToken */); + writePunctuation(writer, 22 /* DotDotDotToken */); writeSpace(writer); - writePunctuation(writer, 15 /* CloseBraceToken */); + writePunctuation(writer, 16 /* CloseBraceToken */); } } function writeTypeList(types, delimiter) { for (var i = 0; i < types.length; i++) { if (i > 0) { - if (delimiter !== 23 /* CommaToken */) { + if (delimiter !== 24 /* CommaToken */) { writeSpace(writer); } writePunctuation(writer, delimiter); writeSpace(writer); } - writeType(types[i], delimiter === 23 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */); + writeType(types[i], delimiter === 24 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */); } } function writeSymbolTypeReference(symbol, typeArguments, pos, end) { @@ -14152,22 +14327,22 @@ var ts; buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056 /* Type */); } if (pos < end) { - writePunctuation(writer, 24 /* LessThanToken */); + writePunctuation(writer, 25 /* LessThanToken */); writeType(typeArguments[pos++], 0 /* None */); while (pos < end) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); writeType(typeArguments[pos++], 0 /* None */); } - writePunctuation(writer, 26 /* GreaterThanToken */); + writePunctuation(writer, 27 /* GreaterThanToken */); } } function writeTypeReference(type, flags) { var typeArguments = type.typeArguments; if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(typeArguments[0], 64 /* InElementType */); - writePunctuation(writer, 18 /* OpenBracketToken */); - writePunctuation(writer, 19 /* CloseBracketToken */); + writePunctuation(writer, 19 /* OpenBracketToken */); + writePunctuation(writer, 20 /* CloseBracketToken */); } else { // Write the type reference in the format f.g.C where A and B are type arguments @@ -14188,7 +14363,7 @@ var ts; // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { writeSymbolTypeReference(parent_3, typeArguments, start, i); - writePunctuation(writer, 20 /* DotToken */); + writePunctuation(writer, 21 /* DotToken */); } } } @@ -14196,17 +14371,17 @@ var ts; } } function writeTupleType(type) { - writePunctuation(writer, 18 /* OpenBracketToken */); - writeTypeList(type.elementTypes, 23 /* CommaToken */); - writePunctuation(writer, 19 /* CloseBracketToken */); + writePunctuation(writer, 19 /* OpenBracketToken */); + writeTypeList(type.elementTypes, 24 /* CommaToken */); + writePunctuation(writer, 20 /* CloseBracketToken */); } function writeUnionOrIntersectionType(type, flags) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 17 /* OpenParenToken */); } - writeTypeList(type.types, type.flags & 16384 /* Union */ ? 45 /* BarToken */ : 44 /* AmpersandToken */); + writeTypeList(type.types, type.flags & 16384 /* Union */ ? 46 /* BarToken */ : 45 /* AmpersandToken */); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 18 /* CloseParenToken */); } } function writeAnonymousType(type, flags) { @@ -14228,7 +14403,7 @@ var ts; } else { // Recursive usage, use any - writeKeyword(writer, 114 /* AnyKeyword */); + writeKeyword(writer, 115 /* AnyKeyword */); } } else { @@ -14252,7 +14427,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 245 /* SourceFile */ || declaration.parent.kind === 216 /* ModuleBlock */; + return declaration.parent.kind === 246 /* SourceFile */ || declaration.parent.kind === 217 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -14262,7 +14437,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 98 /* TypeOfKeyword */); + writeKeyword(writer, 99 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } @@ -14280,76 +14455,76 @@ var ts; var resolved = resolveStructuredTypeMembers(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, 15 /* OpenBraceToken */); + writePunctuation(writer, 16 /* CloseBraceToken */); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 17 /* OpenParenToken */); } buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 18 /* CloseParenToken */); } return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 17 /* OpenParenToken */); } - writeKeyword(writer, 89 /* NewKeyword */); + writeKeyword(writer, 90 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 18 /* CloseParenToken */); } return; } } - writePunctuation(writer, 14 /* OpenBraceToken */); + writePunctuation(writer, 15 /* OpenBraceToken */); writer.writeLine(); writer.increaseIndent(); for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 89 /* NewKeyword */); + writeKeyword(writer, 90 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } if (resolved.stringIndexType) { // [x: string]: - writePunctuation(writer, 18 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, "x")); - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 19 /* OpenBracketToken */); + writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, /*fallbackName*/ "x")); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 127 /* StringKeyword */); - writePunctuation(writer, 19 /* CloseBracketToken */); - writePunctuation(writer, 52 /* ColonToken */); + writeKeyword(writer, 128 /* StringKeyword */); + writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); writeType(resolved.stringIndexType, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } if (resolved.numberIndexType) { // [x: number]: - writePunctuation(writer, 18 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, "x")); - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 19 /* OpenBracketToken */); + writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, /*fallbackName*/ "x")); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 125 /* NumberKeyword */); - writePunctuation(writer, 19 /* CloseBracketToken */); - writePunctuation(writer, 52 /* ColonToken */); + writeKeyword(writer, 126 /* NumberKeyword */); + writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); writeType(resolved.numberIndexType, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { @@ -14361,27 +14536,27 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 51 /* QuestionToken */); + writePunctuation(writer, 52 /* QuestionToken */); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } } else { buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 51 /* QuestionToken */); + writePunctuation(writer, 52 /* QuestionToken */); } - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } } writer.decreaseIndent(); - writePunctuation(writer, 15 /* CloseBraceToken */); + writePunctuation(writer, 16 /* CloseBraceToken */); } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -14395,7 +14570,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 80 /* ExtendsKeyword */); + writeKeyword(writer, 81 /* ExtendsKeyword */); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -14403,67 +14578,67 @@ var ts; function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; if (ts.isRestParameter(parameterNode)) { - writePunctuation(writer, 21 /* DotDotDotToken */); + writePunctuation(writer, 22 /* DotDotDotToken */); } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 51 /* QuestionToken */); + writePunctuation(writer, 52 /* QuestionToken */); } - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24 /* LessThanToken */); + writePunctuation(writer, 25 /* LessThanToken */); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 26 /* GreaterThanToken */); + writePunctuation(writer, 27 /* GreaterThanToken */); } } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24 /* LessThanToken */); + writePunctuation(writer, 25 /* LessThanToken */); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); } - writePunctuation(writer, 26 /* GreaterThanToken */); + writePunctuation(writer, 27 /* GreaterThanToken */); } } function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 17 /* OpenParenToken */); for (var i = 0; i < parameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 18 /* CloseParenToken */); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); - writePunctuation(writer, 33 /* EqualsGreaterThanToken */); + writePunctuation(writer, 34 /* EqualsGreaterThanToken */); } else { - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 53 /* ColonToken */); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 121 /* IsKeyword */); + writeKeyword(writer, 122 /* IsKeyword */); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -14485,15 +14660,12 @@ var ts; buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } 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 @@ -14502,12 +14674,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 215 /* ModuleDeclaration */) { - if (node.name.kind === 8 /* StringLiteral */) { + if (node.kind === 216 /* ModuleDeclaration */) { + if (node.name.kind === 9 /* StringLiteral */) { return node; } } - else if (node.kind === 245 /* SourceFile */) { + else if (node.kind === 246 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -14556,70 +14728,70 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 160 /* BindingElement */: + case 161 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 215 /* ModuleDeclaration */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 210 /* FunctionDeclaration */: - case 214 /* EnumDeclaration */: - case 218 /* ImportEqualsDeclaration */: + case 216 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 211 /* FunctionDeclaration */: + case 215 /* EnumDeclaration */: + case 219 /* ImportEqualsDeclaration */: var parent_4 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && - !(node.kind !== 218 /* ImportEqualsDeclaration */ && parent_4.kind !== 245 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 219 /* ImportEqualsDeclaration */ && parent_4.kind !== 246 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent_4); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (node.flags & (32 /* Private */ | 64 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so let it fall into next case statement - case 141 /* Constructor */: - case 145 /* ConstructSignature */: - case 144 /* CallSignature */: - case 146 /* IndexSignature */: - case 135 /* Parameter */: - case 216 /* ModuleBlock */: - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 152 /* TypeLiteral */: - case 148 /* TypeReference */: - case 153 /* ArrayType */: - case 154 /* TupleType */: - case 155 /* UnionType */: - case 156 /* IntersectionType */: - case 157 /* ParenthesizedType */: + case 142 /* Constructor */: + case 146 /* ConstructSignature */: + case 145 /* CallSignature */: + case 147 /* IndexSignature */: + case 136 /* Parameter */: + case 217 /* ModuleBlock */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 153 /* TypeLiteral */: + case 149 /* TypeReference */: + case 154 /* ArrayType */: + case 155 /* TupleType */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: + case 158 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 220 /* ImportClause */: - case 221 /* NamespaceImport */: - case 223 /* ImportSpecifier */: + case 221 /* ImportClause */: + case 222 /* NamespaceImport */: + case 224 /* ImportSpecifier */: return false; // Type parameters are always visible - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: // Source file is always visible - case 245 /* SourceFile */: + case 246 /* SourceFile */: return true; // Export assignements do not create name bindings outside the module - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -14635,11 +14807,14 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 224 /* ExportAssignment */) { - exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */, ts.Diagnostics.Cannot_find_name_0, node); + if (node.parent && node.parent.kind === 225 /* ExportAssignment */) { + exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 227 /* ExportSpecifier */) { - exportSymbol = getTargetOfExportSpecifier(node.parent); + else if (node.parent.kind === 228 /* ExportSpecifier */) { + var exportSpecifier = node.parent; + exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? + getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : + resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } var result = []; if (exportSymbol) { @@ -14663,40 +14838,71 @@ var ts; }); } } - // Push an entry on the type resolution stack. If an entry with the given target is not already on the stack, - // a new entry with that target and an associated result value of true is pushed on the stack, and the value - // true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and - // all entries pushed after it are changed to false, and the value false is returned. The target object provides - // a unique identity for a particular type resolution result: Symbol instances are used to track resolution of - // SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and - // Signature instances are used to track resolution of Signature.resolvedReturnType. - function pushTypeResolution(target) { - var i = 0; - var count = resolutionTargets.length; - while (i < count && resolutionTargets[i] !== target) { - i++; - } - if (i < count) { - do { - resolutionResults[i++] = false; - } while (i < count); + /** + * Push an entry on the type resolution stack. If an entry with the given target and the given property name + * is already on the stack, and no entries in between already have a type, then a circularity has occurred. + * In this case, the result values of the existing entry and all entries pushed after it are changed to false, + * and the value false is returned. Otherwise, the new entry is just pushed onto the stack, and true is returned. + * In order to see if the same query has already been done before, the target object and the propertyName both + * must match the one passed in. + * + * @param target The symbol, type, or signature whose type is being queried + * @param propertyName The property name that should be used to query the target for its type + */ + function pushTypeResolution(target, propertyName) { + var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); + if (resolutionCycleStartIndex >= 0) { + // A cycle was found + var length_2 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_2; i++) { + resolutionResults[i] = false; + } return false; } resolutionTargets.push(target); resolutionResults.push(true); + resolutionPropertyNames.push(propertyName); return true; } + function findResolutionCycleStartIndex(target, propertyName) { + for (var i = resolutionTargets.length - 1; i >= 0; i--) { + if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) { + return -1; + } + if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) { + return i; + } + } + return -1; + } + function hasType(target, propertyName) { + if (propertyName === 0 /* Type */) { + return getSymbolLinks(target).type; + } + if (propertyName === 2 /* DeclaredType */) { + return getSymbolLinks(target).declaredType; + } + if (propertyName === 1 /* ResolvedBaseConstructorType */) { + ts.Debug.assert(!!(target.flags & 1024 /* Class */)); + return target.resolvedBaseConstructorType; + } + if (propertyName === 3 /* ResolvedReturnType */) { + return target.resolvedReturnType; + } + ts.Debug.fail("Unhandled TypeSystemPropertyName " + propertyName); + } // Pop an entry from the type resolution stack and return its associated result value. The result value will // be true if no circularities were detected, or false if a circularity was found. function popTypeResolution() { resolutionTargets.pop(); + resolutionPropertyNames.pop(); return resolutionResults.pop(); } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === 208 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + return node.kind === 209 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 @@ -14732,7 +14938,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 158 /* ObjectBindingPattern */) { + if (pattern.kind === 159 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, @@ -14749,11 +14955,8 @@ var ts; // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - var elementType = checkIteratedTypeOrElementType(parentType, pattern, false); + var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false); if (!declaration.dotDotDotToken) { - if (isTypeAny(elementType)) { - return elementType; - } // Use specific property type when parent is a tuple or numeric index type when parent is an array var propName = "" + ts.indexOf(pattern.elements, declaration); type = isTupleLikeType(parentType) @@ -14779,10 +14982,10 @@ var ts; // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration) { // A variable declared in a for..in statement is always of type any - if (declaration.parent.parent.kind === 197 /* ForInStatement */) { + if (declaration.parent.parent.kind === 198 /* ForInStatement */) { return anyType; } - if (declaration.parent.parent.kind === 198 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 199 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -14796,11 +14999,11 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 135 /* Parameter */) { + if (declaration.kind === 136 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 143 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 142 /* GetAccessor */); + if (func.kind === 144 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -14816,9 +15019,13 @@ var ts; return checkExpressionCached(declaration.initializer); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 243 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 244 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } + // If the declaration specifies a binding pattern, use the type implied by the binding pattern + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name); + } // No type specified and nothing can be inferred return undefined; } @@ -14851,7 +15058,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 184 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 185 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -14874,7 +15081,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern) { - return pattern.kind === 158 /* ObjectBindingPattern */ + return pattern.kind === 159 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } @@ -14896,19 +15103,14 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - return declaration.kind !== 242 /* PropertyAssignment */ ? getWidenedType(type) : type; - } - // If no type was specified and nothing could be inferred, and if the declaration specifies a binding pattern, use - // the type implied by the binding pattern - if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return declaration.kind !== 243 /* PropertyAssignment */ ? getWidenedType(type) : type; } // Rest parameters default to type any[], other parameters default to type any type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 135 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 136 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -14923,18 +15125,18 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 241 /* CatchClause */) { + if (declaration.parent.kind === 242 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 224 /* ExportAssignment */) { + if (declaration.kind === 225 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } // Handle variable, parameter or property - if (!pushTypeResolution(symbol)) { + if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); + var type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); if (!popTypeResolution()) { if (symbol.valueDeclaration.type) { // Variable has type annotation that circularly references the variable itself @@ -14955,7 +15157,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 142 /* GetAccessor */) { + if (accessor.kind === 143 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -14968,11 +15170,11 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (!pushTypeResolution(symbol)) { + if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 142 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 143 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 143 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 144 /* SetAccessor */); var type; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); @@ -15001,7 +15203,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 142 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 143 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -15101,9 +15303,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 211 /* ClassDeclaration */ || node.kind === 183 /* ClassExpression */ || - node.kind === 210 /* FunctionDeclaration */ || node.kind === 170 /* FunctionExpression */ || - node.kind === 140 /* MethodDeclaration */ || node.kind === 171 /* ArrowFunction */) { + if (node.kind === 212 /* ClassDeclaration */ || node.kind === 184 /* ClassExpression */ || + node.kind === 211 /* FunctionDeclaration */ || node.kind === 171 /* FunctionExpression */ || + node.kind === 141 /* MethodDeclaration */ || node.kind === 172 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -15113,7 +15315,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 212 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -15122,8 +15324,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 212 /* InterfaceDeclaration */ || node.kind === 211 /* ClassDeclaration */ || - node.kind === 183 /* ClassExpression */ || node.kind === 213 /* TypeAliasDeclaration */) { + if (node.kind === 213 /* InterfaceDeclaration */ || node.kind === 212 /* ClassDeclaration */ || + node.kind === 184 /* ClassExpression */ || node.kind === 214 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -15166,7 +15368,7 @@ var ts; if (!baseTypeNode) { return type.resolvedBaseConstructorType = undefinedType; } - if (!pushTypeResolution(type)) { + if (!pushTypeResolution(type, 1 /* ResolvedBaseConstructorType */)) { return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); @@ -15234,7 +15436,7 @@ var ts; return; } if (type === baseType || hasBaseType(baseType, type)) { - error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */)); + error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */)); return; } type.resolvedBaseTypes = [baseType]; @@ -15243,7 +15445,7 @@ var ts; type.resolvedBaseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 212 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 213 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -15253,7 +15455,7 @@ var ts; type.resolvedBaseTypes.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, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */)); } } else { @@ -15289,10 +15491,10 @@ var ts; if (!links.declaredType) { // Note that we use the links object as the target here because the symbol object is used as the unique // identity for resolution of the 'type' property in SymbolLinks. - if (!pushTypeResolution(links)) { + if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 213 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 214 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -15325,7 +15527,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 134 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -15492,43 +15694,70 @@ var ts; 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; + function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + for (var _i = 0; _i < signatureList.length; _i++) { + var s = signatureList[_i]; + if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { + return s; } } - return true; } - // If the lists of call or construct signatures in the given types are all identical except for return types, - // and if none of the signatures are generic, return a list of signatures that has substitutes a union of the - // return types of the corresponding signatures in each resulting signature. - 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++) { - var signature = signatures[_i]; - if (signature.typeParameters) { - return emptyArray; + function findMatchingSignatures(signatureLists, signature, listIndex) { + if (signature.typeParameters) { + // We require an exact match for generic signatures, so we only return signatures from the first + // signature list and only if they have exact matches in the other signature lists. + if (listIndex > 0) { + return undefined; } - } - for (var i_1 = 1; i_1 < signatureLists.length; i_1++) { - if (!signatureListsIdentical(signatures, signatureLists[i_1])) { - return emptyArray; + for (var i = 1; i < signatureLists.length; i++) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + return undefined; + } } + return [signature]; } - var result = ts.map(signatures, cloneSignature); - for (var i = 0; i < result.length; i++) { - var s = result[i]; - // Clear resolved return type we possibly got from cloneSignature - s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + // Allow matching non-generic signatures to have excess parameters and different return types + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); + if (!match) { + return undefined; + } + if (!ts.contains(result, match)) { + (result || (result = [])).push(match); + } } return result; } + // The signatures of a union type are those signatures that are present in each of the constituent types. + // Generic signatures must match exactly, but non-generic signatures are allowed to have extra optional + // parameters and may differ in return types. When signatures differ in return types, the resulting return + // type is the union of the constituent return types. + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { + var signature = _a[_i]; + // Only process signatures with parameter lists that aren't already in the result list + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + var unionSignatures = findMatchingSignatures(signatureLists, signature, i); + if (unionSignatures) { + var s = signature; + // Union the result types when more than one signature matches + if (unionSignatures.length > 1) { + s = cloneSignature(signature); + // Clear resolved return type we possibly got from cloneSignature + s.resolvedReturnType = undefined; + s.unionSignatures = unionSignatures; + } + (result || (result = [])).push(s); + } + } + } + } + return result || emptyArray; + } function getUnionIndexType(types, kind) { var indexTypes = []; for (var _i = 0; _i < types.length; _i++) { @@ -15679,9 +15908,6 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - if (type.flags & 16384 /* Union */) { - type = getReducedTypeOfUnionType(type); - } if (type.flags & 512 /* TypeParameter */) { do { type = getConstraintOfTypeParameter(type); @@ -15699,7 +15925,7 @@ var ts; else if (type.flags & 8 /* Boolean */) { type = globalBooleanType; } - else if (type.flags & 4194304 /* ESSymbol */) { + else if (type.flags & 16777216 /* ESSymbol */) { type = globalESSymbolType; } return type; @@ -15784,6 +16010,29 @@ var ts; } return undefined; } + // Check if a property with the given name is known anywhere in the given type. In an object + // type, a property is considered known if the object type is empty, if it has any index + // signatures, or if the property is actually declared in the type. In a union or intersection + // type, a property is considered known if it is known in any constituent type. + function isKnownProperty(type, name) { + if (type.flags & 80896 /* ObjectType */ && type !== globalObjectType) { + var resolved = resolveStructuredTypeMembers(type); + return !!(resolved.properties.length === 0 || + resolved.stringIndexType || + resolved.numberIndexType || + getPropertyOfType(type, name)); + } + if (type.flags & 49152 /* UnionOrIntersection */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } function getSignaturesOfStructuredType(type, kind) { if (type.flags & 130048 /* StructuredType */) { var resolved = resolveStructuredTypeMembers(type); @@ -15791,8 +16040,10 @@ var ts; } return emptyArray; } - // Return the signatures of the given kind in the given type. Creates synthetic union signatures when necessary and - // maps primitive types and type parameters are to their apparent types. + /** + * Return the signatures of the given kind in the given type. Creates synthetic union signatures when necessary and + * maps primitive types and type parameters are to their apparent types. + */ function getSignaturesOfType(type, kind) { return getSignaturesOfStructuredType(getApparentType(type), kind); } @@ -15845,12 +16096,22 @@ var ts; return result; } function isOptionalParameter(node) { - return ts.hasQuestionToken(node) || !!node.initializer; + if (ts.hasQuestionToken(node)) { + return true; + } + if (node.initializer) { + var signatureDeclaration = node.parent; + var signature = getSignatureFromDeclaration(signatureDeclaration); + var parameterIndex = signatureDeclaration.parameters.indexOf(node); + ts.Debug.assert(parameterIndex >= 0); + return parameterIndex >= signature.minArgumentCount; + } + return false; } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 141 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 142 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -15859,14 +16120,18 @@ 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 === 9 /* StringLiteral */) { hasStringLiterals = true; } - if (minArgumentCount < 0) { - if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (minArgumentCount < 0) { minArgumentCount = i; } } + else { + // If we see any required parameters, it means the prior ones were not in fact optional. + minArgumentCount = -1; + } } if (minArgumentCount < 0) { minArgumentCount = declaration.parameters.length; @@ -15878,7 +16143,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 147 /* TypePredicate */) { + if (declaration.type.kind === 148 /* TypePredicate */) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -15890,8 +16155,8 @@ var ts; else { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 142 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 143 /* SetAccessor */); + if (declaration.kind === 143 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 144 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -15909,19 +16174,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -15938,7 +16203,7 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - if (!pushTypeResolution(signature)) { + if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) { return unknownType; } var type; @@ -15998,7 +16263,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 141 /* Constructor */ || signature.declaration.kind === 145 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 142 /* Constructor */ || signature.declaration.kind === 146 /* ConstructSignature */; var type = createObjectType(65536 /* Anonymous */ | 262144 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -16012,7 +16277,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 125 /* NumberKeyword */ : 127 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 126 /* NumberKeyword */ : 128 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -16041,13 +16306,13 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 134 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 134 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135 /* TypeParameter */).parent); } function getTypeListId(types) { switch (types.length) { @@ -16066,22 +16331,23 @@ var ts; return result; } } - // This function is used to propagate widening flags when creating new object types references and union types. - // It is only necessary to do so if a constituent type might be the undefined type, the null type, or the type - // of an object literal (since those types have widening related information we need to track). - function getWideningFlagsOfTypes(types) { + // This function is used to propagate certain flags when creating new object type references and union types. + // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type + // of an object literal or the anyFunctionType. This is because there are operations in the type checker + // that care about the presence of such types at arbitrary depth in a containing type. + function getPropagatingFlagsOfTypes(types) { var result = 0; for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } - return result & 3145728 /* RequiresWidening */; + return result & 14680064 /* PropagatingFlags */; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | getWideningFlagsOfTypes(typeArguments); + var flags = 4096 /* Reference */ | getPropagatingFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -16100,16 +16366,16 @@ var ts; currentNode = currentNode.parent; } // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 134 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 148 /* TypeReference */ && n.typeName.kind === 66 /* Identifier */) { + if (n.kind === 149 /* TypeReference */ && n.typeName.kind === 67 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { - var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, undefined, undefined); + var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); if (symbol && (symbol.flags & 262144 /* TypeParameter */)) { // TypeScript 1.0 spec (April 2014): 3.4.1 // Type parameters declared in a particular type parameter list @@ -16138,7 +16404,7 @@ var ts; var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - 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, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); return unknownType; } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -16193,7 +16459,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 148 /* TypeReference */ ? node.typeName : + var typeNameOrExpression = node.kind === 149 /* TypeReference */ ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; @@ -16225,9 +16491,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: return declaration; } } @@ -16261,14 +16527,14 @@ var ts; } function tryGetGlobalType(name, arity) { if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056 /* Type */, undefined), arity); + return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056 /* Type */, /*diagnostic*/ undefined), arity); } /** * Returns a type that is inside a namespace at the global scope, e.g. * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type */ function getExportedTypeFromNamespace(namespace, name) { - var namespaceSymbol = getGlobalSymbol(namespace, 1536 /* Namespace */, undefined); + var namespaceSymbol = getGlobalSymbol(namespace, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } @@ -16310,7 +16576,7 @@ var ts; var id = getTypeListId(elementTypes); var type = tupleTypes[id]; if (!type) { - type = tupleTypes[id] = createObjectType(8192 /* Tuple */ | getWideningFlagsOfTypes(elementTypes)); + type = tupleTypes[id] = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); type.elementTypes = elementTypes; } return type; @@ -16338,20 +16604,71 @@ var ts; addTypeToSet(typeSet, type, typeSetKind); } } - function isSubtypeOfAny(candidate, types) { + function isObjectLiteralTypeDuplicateOf(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return false; + } + for (var _i = 0; _i < sourceProperties.length; _i++) { + var sourceProp = sourceProperties[_i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp || + getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */) || + !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { + return false; + } + } + return true; + } + function isTupleTypeDuplicateOf(source, target) { + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + if (sourceTypes.length !== targetTypes.length) { + return false; + } + for (var i = 0; i < sourceTypes.length; i++) { + if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { + return false; + } + } + return true; + } + // Returns true if the source type is a duplicate of the target type. A source type is a duplicate of + // a target type if the the two are identical, with the exception that the source type may have null or + // undefined in places where the target type doesn't. This is by design an asymmetric relationship. + function isTypeDuplicateOf(source, target) { + if (source === target) { + return true; + } + if (source.flags & 32 /* Undefined */ || source.flags & 64 /* Null */ && !(target.flags & 32 /* Undefined */)) { + return true; + } + if (source.flags & 524288 /* ObjectLiteral */ && target.flags & 80896 /* ObjectType */) { + return isObjectLiteralTypeDuplicateOf(source, target); + } + if (isArrayType(source) && isArrayType(target)) { + return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]); + } + if (isTupleType(source) && isTupleType(target)) { + return isTupleTypeDuplicateOf(source, target); + } + return isTypeIdenticalTo(source, target); + } + function isTypeDuplicateOfSomeType(candidate, types) { for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; - if (candidate !== type && isTypeSubtypeOf(candidate, type)) { + if (candidate !== type && isTypeDuplicateOf(candidate, type)) { return true; } } return false; } - function removeSubtypes(types) { + function removeDuplicateTypes(types) { var i = types.length; while (i > 0) { i--; - if (isSubtypeOfAny(types[i], types)) { + if (isTypeDuplicateOfSomeType(types[i], types)) { types.splice(i, 1); } } @@ -16374,29 +16691,26 @@ var ts; } } } - function compareTypeIds(type1, type2) { - return type1.id - type2.id; - } - // The noSubtypeReduction flag is there because it isn't possible to always do subtype reduction. The flag - // is true when creating a union type from a type node and when instantiating a union type. In both of those - // cases subtype reduction has to be deferred to properly support recursive union types. For example, a - // type alias of the form "type Item = string | (() => Item)" cannot be reduced during its declaration. - function getUnionType(types, noSubtypeReduction) { + // We always deduplicate the constituent type set based on object identity, but we'll also deduplicate + // based on the structure of the types unless the noDeduplication flag is true, which is the case when + // creating a union type from a type node and when instantiating a union type. In both of those cases, + // structural deduplication has to be deferred to properly support recursive union types. For example, + // a type of the form "type Item = string | (() => Item)" cannot be deduplicated during its declaration. + function getUnionType(types, noDeduplication) { if (types.length === 0) { return emptyObjectType; } var typeSet = []; addTypesToSet(typeSet, types, 16384 /* Union */); - typeSet.sort(compareTypeIds); - if (noSubtypeReduction) { - if (containsTypeAny(typeSet)) { - return anyType; - } + if (containsTypeAny(typeSet)) { + return anyType; + } + if (noDeduplication) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeSubtypes(typeSet); + removeDuplicateTypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -16404,37 +16718,19 @@ var ts; var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getWideningFlagsOfTypes(typeSet)); + type = unionTypes[id] = createObjectType(16384 /* Union */ | getPropagatingFlagsOfTypes(typeSet)); type.types = typeSet; - type.reducedType = noSubtypeReduction ? undefined : type; } return type; } - // Subtype reduction is basically an optimization we do to avoid excessively large union types, which take longer - // to process and look strange in quick info and error messages. Semantically there is no difference between the - // reduced type and the type itself. So, when we detect a circularity we simply say that the reduced type is the - // type itself. - function getReducedTypeOfUnionType(type) { - if (!type.reducedType) { - type.reducedType = circularType; - var reducedType = getUnionType(type.types, false); - if (type.reducedType === circularType) { - type.reducedType = reducedType; - } - } - else if (type.reducedType === circularType) { - type.reducedType = type; - } - return type.reducedType; - } function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noDeduplication*/ true); } return links.resolvedType; } - // We do not perform supertype reduction on intersection types. Intersection types are created only by the & + // We do not perform structural deduplication on intersection types. Intersection types are created only by the & // type operator and we can't reduce those because we want to support recursive intersection types. For example, // a type alias of the form "type List = T & { next: List }" cannot be reduced during its declaration. // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution @@ -16454,7 +16750,7 @@ var ts; var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | getWideningFlagsOfTypes(typeSet)); + type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | getPropagatingFlagsOfTypes(typeSet)); type.types = typeSet; } return type; @@ -16491,47 +16787,47 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 114 /* AnyKeyword */: + case 115 /* AnyKeyword */: return anyType; - case 127 /* StringKeyword */: + case 128 /* StringKeyword */: return stringType; - case 125 /* NumberKeyword */: + case 126 /* NumberKeyword */: return numberType; - case 117 /* BooleanKeyword */: + case 118 /* BooleanKeyword */: return booleanType; - case 128 /* SymbolKeyword */: + case 129 /* SymbolKeyword */: return esSymbolType; - case 100 /* VoidKeyword */: + case 101 /* VoidKeyword */: return voidType; - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 148 /* TypeReference */: + case 149 /* TypeReference */: return getTypeFromTypeReference(node); - case 147 /* TypePredicate */: + case 148 /* TypePredicate */: return booleanType; - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 153 /* ArrayType */: + case 154 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 154 /* TupleType */: + case 155 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 155 /* UnionType */: + case 156 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 156 /* IntersectionType */: + case 157 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: return getTypeFromTypeNode(node.type); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 152 /* TypeLiteral */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 153 /* TypeLiteral */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode - case 66 /* Identifier */: - case 132 /* QualifiedName */: - var symbol = getSymbolInfo(node); + case 67 /* Identifier */: + case 133 /* QualifiedName */: + var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType; @@ -16590,7 +16886,7 @@ var ts; }; } function createInferenceMapper(context) { - return function (t) { + var mapper = function (t) { for (var i = 0; i < context.typeParameters.length; i++) { if (t === context.typeParameters[i]) { context.inferences[i].isFixed = true; @@ -16599,6 +16895,8 @@ var ts; } return t; }; + mapper.context = context; + return mapper; } function identityMapper(type) { return type; @@ -16689,7 +16987,7 @@ var ts; return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); } if (type.flags & 16384 /* Union */) { - return getUnionType(instantiateList(type.types, mapper, instantiateType), true); + return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noDeduplication*/ true); } if (type.flags & 32768 /* Intersection */) { return getIntersectionType(instantiateList(type.types, mapper, instantiateType)); @@ -16700,27 +16998,27 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 140 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 178 /* BinaryExpression */: - return node.operatorToken.kind === 50 /* BarBarToken */ && + case 179 /* BinaryExpression */: + return node.operatorToken.kind === 51 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 242 /* PropertyAssignment */: + case 243 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; @@ -16744,16 +17042,16 @@ var ts; } // TYPE CHECKING function isTypeIdenticalTo(source, target) { - return checkTypeRelatedTo(source, target, identityRelation, undefined); + return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined); } function compareTypes(source, target) { - return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 /* True */ : 0 /* False */; + return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined) ? -1 /* True */ : 0 /* False */; } function isTypeSubtypeOf(source, target) { - return checkTypeSubtypeOf(source, target, undefined); + return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined); } function isTypeAssignableTo(source, target) { - return checkTypeAssignableTo(source, target, undefined); + return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); @@ -16764,7 +17062,7 @@ var ts; function isSignatureAssignableTo(source, target) { var sourceType = getOrCreateTypeFromSignature(source); var targetType = getOrCreateTypeFromSignature(target); - return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); + return checkTypeRelatedTo(sourceType, targetType, assignableRelation, /*errorNode*/ undefined); } /** * Checks if 'source' is related to 'target' (e.g.: is a assignable to). @@ -16809,6 +17107,15 @@ var ts; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } + function reportRelationError(message, source, target) { + var sourceType = typeToString(source); + var targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); + targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); + } + reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + } // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or @@ -16818,110 +17125,140 @@ var ts; // both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases if (source === target) return -1 /* True */; - if (relation !== identityRelation) { - if (isTypeAny(target)) - return -1 /* True */; - if (source === undefinedType) - return -1 /* True */; - if (source === nullType && target !== undefinedType) - return -1 /* True */; - if (source.flags & 128 /* Enum */ && target === numberType) + if (relation === identityRelation) { + return isIdenticalTo(source, target); + } + if (isTypeAny(target)) + return -1 /* True */; + if (source === undefinedType) + return -1 /* True */; + 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 */; + if (relation === assignableRelation) { + if (isTypeAny(source)) return -1 /* True */; - if (source.flags & 256 /* StringLiteral */ && target === stringType) + if (source === numberType && target.flags & 128 /* Enum */) return -1 /* True */; - if (relation === assignableRelation) { - if (isTypeAny(source)) - return -1 /* True */; - if (source === numberType && target.flags & 128 /* Enum */) - return -1 /* True */; + } + if (source.flags & 1048576 /* FreshObjectLiteral */) { + if (hasExcessProperties(source, target, reportErrors)) { + if (reportErrors) { + reportRelationError(headMessage, source, target); + } + return 0 /* False */; } + // Above we check for excess properties with respect to the entire target type. When union + // and intersection types are further deconstructed on the target side, we don't want to + // make the check again (as it might fail for a partial target type). Therefore we obtain + // the regular source type and proceed with that. + source = getRegularTypeOfObjectLiteral(source); } var saveErrorInfo = errorInfo; - if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { - // We have type references to same target type, see if relationship holds for all type arguments - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + // Note that the "each" checks must precede the "some" checks to produce the correct results + if (source.flags & 16384 /* Union */) { + if (result = eachTypeRelatedToType(source, target, reportErrors)) { return result; } } - else if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { - if (result = typeParameterRelatedTo(source, target, reportErrors)) { + else if (target.flags & 32768 /* Intersection */) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - else if (relation !== identityRelation) { - // Note that the "each" checks must precede the "some" checks to produce the correct results - if (source.flags & 16384 /* Union */) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + else { + // It is necessary to try "some" checks on both sides because there may be nested "each" checks + // on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or + // A & B = (A & B) | (C & D). + if (source.flags & 32768 /* Intersection */) { + // If target is a union type the following check will report errors so we suppress them here + if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384 /* Union */))) { return result; } } - else if (target.flags & 32768 /* Intersection */) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + if (target.flags & 16384 /* Union */) { + if (result = typeRelatedToSomeType(source, target, reportErrors)) { return result; } } - else { - // It is necessary to try "each" checks on both sides because there may be nested "some" checks - // on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or - // A & B = (A & B) | (C & D). - if (source.flags & 32768 /* Intersection */) { - // If target is a union type the following check will report errors so we suppress them here - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384 /* Union */))) { - return result; - } - } - if (target.flags & 16384 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { - return result; - } - } - } } - else { - if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || - source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { - return result; - } - } - } - } - // Even if relationship doesn't hold for unions, type parameters, or generic type references, - // it may hold in a structural comparison. - // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - // Identity relation does not use apparent type - var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates - // to X. Failing both of those we want to check if the aggregation of A and B's members structurally - // relates to X. Thus, we include intersection types on the source side here. - if (sourceOrApparentType.flags & (80896 /* ObjectType */ | 32768 /* Intersection */) && target.flags & 80896 /* ObjectType */) { - if (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors)) { + if (source.flags & 512 /* TypeParameter */) { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1 /* Any */) { + constraint = emptyObjectType; + } + // Report constraint errors only if the constraint is not the empty object type + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { errorInfo = saveErrorInfo; return result; } } - else if (source.flags & 512 /* TypeParameter */ && sourceOrApparentType.flags & 49152 /* UnionOrIntersection */) { - // We clear the errors first because the following check often gives a better error than - // the union or intersection comparison above if it is applicable. - errorInfo = saveErrorInfo; - if (result = isRelatedTo(sourceOrApparentType, target, reportErrors)) { - return result; + else { + if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + // We have type references to same target type, see if relationship holds for all type arguments + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; + } + } + // Even if relationship doesn't hold for unions, intersections, or generic type references, + // it may hold in a structural comparison. + var apparentType = getApparentType(source); + // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates + // to X. Failing both of those we want to check if the aggregation of A and B's members structurally + // relates to X. Thus, we include intersection types on the source side here. + if (apparentType.flags & (80896 /* ObjectType */ | 32768 /* Intersection */) && target.flags & 80896 /* ObjectType */) { + // Report structural errors only if we haven't reported any errors yet + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; + if (result = objectTypeRelatedTo(apparentType, target, reportStructuralErrors)) { + 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 /* UseFullyQualifiedType */); - targetType = typeToString(target, undefined, 128 /* UseFullyQualifiedType */); + reportRelationError(headMessage, source, target); + } + return 0 /* False */; + } + function isIdenticalTo(source, target) { + var result; + if (source.flags & 80896 /* ObjectType */ && target.flags & 80896 /* ObjectType */) { + if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + // We have type references to same target type, see if all type arguments are identical + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, /*reportErrors*/ false)) { + return result; + } + } + return objectTypeRelatedTo(source, target, /*reportErrors*/ false); + } + if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { + return typeParameterIdenticalTo(source, target); + } + if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || + source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { + if (result = eachTypeRelatedToSomeType(source, target)) { + if (result &= eachTypeRelatedToSomeType(target, source)) { + return result; + } } - reportError(headMessage, sourceType, targetType); } return 0 /* False */; } + function hasExcessProperties(source, target, reportErrors) { + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (!isKnownProperty(target, prop.name)) { + if (reportErrors) { + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } + return true; + } + } + } function eachTypeRelatedToSomeType(source, target) { var result = -1 /* True */; var sourceTypes = source.types; @@ -16992,31 +17329,18 @@ var ts; } return result; } - function typeParameterRelatedTo(source, target, reportErrors) { - if (relation === identityRelation) { - if (source.symbol.name !== target.symbol.name) { - return 0 /* False */; - } - // covers case when both type parameters does not have constraint (both equal to noConstraintType) - if (source.constraint === target.constraint) { - return -1 /* True */; - } - if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return 0 /* False */; - } - return isRelatedTo(source.constraint, target.constraint, reportErrors); + function typeParameterIdenticalTo(source, target) { + if (source.symbol.name !== target.symbol.name) { + return 0 /* False */; } - else { - while (true) { - var constraint = getConstraintOfTypeParameter(source); - if (constraint === target) - return -1 /* True */; - if (!(constraint && constraint.flags & 512 /* TypeParameter */)) - break; - source = constraint; - } + // covers case when both type parameters does not have constraint (both equal to noConstraintType) + if (source.constraint === target.constraint) { + return -1 /* True */; + } + if (source.constraint === noConstraintType || target.constraint === noConstraintType) { return 0 /* False */; } + return isIdenticalTo(source.constraint, target.constraint); } // Determine if two object types are related by structure. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. @@ -17211,26 +17535,20 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1 /* True */; var saveErrorInfo = errorInfo; - // Because the "abstractness" of a class is the same across all construct signatures - // (internally we are checking the corresponding declaration), it is enough to perform - // the check and report an error once over all pairs of source and target construct signatures. - var sourceSig = sourceSignatures[0]; - // Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds. - var targetSig = targetSignatures[0]; - if (sourceSig && targetSig) { - var sourceErasedSignature = getErasedSignature(sourceSig); - var targetErasedSignature = getErasedSignature(targetSig); - var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); - var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211 /* ClassDeclaration */); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211 /* ClassDeclaration */); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */; - if (sourceIsAbstract && !targetIsAbstract) { - if (reportErrors) { - reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - } - return 0 /* False */; + if (kind === 1 /* Construct */) { + // Only want to compare the construct signatures for abstractness guarantees. + // Because the "abstractness" of a class is the same across all construct signatures + // (internally we are checking the corresponding declaration), it is enough to perform + // the check and report an error once over all pairs of source and target construct signatures. + // + // sourceSig and targetSig are (possibly) undefined. + // + // Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds. + var sourceSig = sourceSignatures[0]; + var targetSig = targetSignatures[0]; + result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig); + if (result !== -1 /* True */) { + return result; } } outer: for (var _i = 0; _i < targetSignatures.length; _i++) { @@ -17255,6 +17573,33 @@ var ts; } } return result; + function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { + if (sourceSig && targetSig) { + var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212 /* ClassDeclaration */); + var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212 /* ClassDeclaration */); + if (!sourceDecl) { + // If the source object isn't itself a class declaration, it can be freely assigned, regardless + // of whether the constructed object is abstract or not. + return -1 /* True */; + } + var sourceErasedSignature = getErasedSignature(sourceSig); + var targetErasedSignature = getErasedSignature(targetSig); + var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); + var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212 /* ClassDeclaration */); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212 /* ClassDeclaration */); + var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */; + var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */; + if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { + // if target isn't a class-declaration type, then it can be new'd, so we forbid the assignment. + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0 /* False */; + } + } + return -1 /* True */; + } } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -17345,7 +17690,7 @@ var ts; } var result = -1 /* True */; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; } @@ -17358,7 +17703,7 @@ var ts; return indexTypesIdenticalTo(0 /* String */, source, target); } var targetType = getIndexTypeOfType(target, 0 /* String */); - if (targetType) { + if (targetType && !(targetType.flags & 1 /* Any */)) { var sourceType = getIndexTypeOfType(source, 0 /* String */); if (!sourceType) { if (reportErrors) { @@ -17382,7 +17727,7 @@ var ts; return indexTypesIdenticalTo(1 /* Number */, source, target); } var targetType = getIndexTypeOfType(target, 1 /* Number */); - if (targetType) { + if (targetType && !(targetType.flags & 1 /* Any */)) { var sourceStringType = getIndexTypeOfType(source, 0 /* String */); var sourceNumberType = getIndexTypeOfType(source, 1 /* Number */); if (!(sourceStringType || sourceNumberType)) { @@ -17469,14 +17814,18 @@ var ts; } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } - function compareSignatures(source, target, compareReturnTypes, compareTypes) { + function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { if (source === target) { return -1 /* True */; } if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { - return 0 /* False */; + if (!partialMatch || + source.parameters.length < target.parameters.length && !source.hasRestParameter || + source.minArgumentCount > target.minArgumentCount) { + return 0 /* False */; + } } var result = -1 /* True */; if (source.typeParameters && target.typeParameters) { @@ -17498,16 +17847,18 @@ var ts; // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N 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 sourceLen = source.parameters.length; + var targetLen = target.parameters.length; + for (var i = 0; i < targetLen; i++) { + var s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0 /* False */; } result &= related; } - if (compareReturnTypes) { + if (!ignoreReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } return result; @@ -17573,6 +17924,23 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192 /* Tuple */); } + function getRegularTypeOfObjectLiteral(type) { + if (type.flags & 1048576 /* FreshObjectLiteral */) { + var regularType = type.regularType; + if (!regularType) { + regularType = createType(type.flags & ~1048576 /* FreshObjectLiteral */); + regularType.symbol = type.symbol; + regularType.members = type.members; + regularType.properties = type.properties; + regularType.callSignatures = type.callSignatures; + regularType.constructSignatures = type.constructSignatures; + regularType.stringIndexType = type.stringIndexType; + regularType.numberIndexType = type.numberIndexType; + } + return regularType; + } + return type; + } function getWidenedTypeOfObjectLiteral(type) { var properties = getPropertiesOfObjectType(type); var members = {}; @@ -17600,7 +17968,7 @@ var ts; return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); } function getWidenedType(type) { - if (type.flags & 3145728 /* RequiresWidening */) { + if (type.flags & 6291456 /* RequiresWidening */) { if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { return anyType; } @@ -17655,7 +18023,7 @@ var ts; for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); - if (t.flags & 1048576 /* ContainsUndefinedOrNull */) { + if (t.flags & 2097152 /* ContainsUndefinedOrNull */) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -17669,22 +18037,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 135 /* Parameter */: + case 136 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -17697,7 +18065,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 1048576 /* ContainsUndefinedOrNull */) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152 /* ContainsUndefinedOrNull */) { // Report implicit any error within type if possible, otherwise report error on declaration if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); @@ -17734,7 +18102,9 @@ var ts; var inferences = []; for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; - inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); + inferences.push({ + primary: undefined, secondary: undefined, isFixed: false + }); } return { typeParameters: typeParameters, @@ -17758,11 +18128,16 @@ var ts; return false; } function inferFromTypes(source, target) { - if (source === anyFunctionType) { - return; - } if (target.flags & 512 /* TypeParameter */) { - // If target is a type parameter, make an inference + // If target is a type parameter, make an inference, unless the source type contains + // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). + // Because the anyFunctionType is internal, it should not be exposed to the user by adding + // it as an inference candidate. Hopefully, a better candidate will come along that does + // not contain anyFunctionType when we come back to this argument for its second round + // of inference. + if (source.flags & 8388608 /* ContainsAnyFunctionType */) { + return; + } var typeParameters = context.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { @@ -17793,6 +18168,14 @@ var ts; inferFromTypes(sourceTypes[i], targetTypes[i]); } } + else if (source.flags & 8192 /* Tuple */ && target.flags & 8192 /* Tuple */ && source.elementTypes.length === target.elementTypes.length) { + // If source and target are tuples of the same size, infer from element types + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } else if (target.flags & 49152 /* UnionOrIntersection */) { var targetTypes = target.types; var typeParameterCount = 0; @@ -17959,10 +18342,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return true; - case 66 /* Identifier */: - case 132 /* QualifiedName */: + case 67 /* Identifier */: + case 133 /* QualifiedName */: node = node.parent; continue; default: @@ -18008,12 +18391,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 54 /* FirstAssignment */ && node.operatorToken.kind <= 65 /* LastAssignment */) { + if (node.operatorToken.kind >= 55 /* FirstAssignment */ && node.operatorToken.kind <= 66 /* LastAssignment */) { var n = node.left; - while (n.kind === 169 /* ParenthesizedExpression */) { + while (n.kind === 170 /* ParenthesizedExpression */) { n = n.expression; } - if (n.kind === 66 /* Identifier */ && getResolvedSymbol(n) === symbol) { + if (n.kind === 67 /* Identifier */ && getResolvedSymbol(n) === symbol) { return true; } } @@ -18027,96 +18410,60 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: return isAssignedInVariableDeclaration(node); - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: - case 161 /* ArrayLiteralExpression */: - case 162 /* ObjectLiteralExpression */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: - case 169 /* ParenthesizedExpression */: - case 176 /* PrefixUnaryExpression */: - case 172 /* DeleteExpression */: - case 175 /* AwaitExpression */: - case 173 /* TypeOfExpression */: - case 174 /* VoidExpression */: - case 177 /* PostfixUnaryExpression */: - case 181 /* YieldExpression */: - case 179 /* ConditionalExpression */: - case 182 /* SpreadElementExpression */: - case 189 /* Block */: - case 190 /* VariableStatement */: - case 192 /* ExpressionStatement */: - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 201 /* ReturnStatement */: - case 202 /* WithStatement */: - case 203 /* SwitchStatement */: - case 238 /* CaseClause */: - case 239 /* DefaultClause */: - case 204 /* LabeledStatement */: - case 205 /* ThrowStatement */: - case 206 /* TryStatement */: - case 241 /* CatchClause */: - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: - case 235 /* JsxAttribute */: - case 236 /* JsxSpreadAttribute */: - case 232 /* JsxOpeningElement */: - case 237 /* JsxExpression */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: + case 162 /* ArrayLiteralExpression */: + case 163 /* ObjectLiteralExpression */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: + case 170 /* ParenthesizedExpression */: + case 177 /* PrefixUnaryExpression */: + case 173 /* DeleteExpression */: + case 176 /* AwaitExpression */: + case 174 /* TypeOfExpression */: + case 175 /* VoidExpression */: + case 178 /* PostfixUnaryExpression */: + case 182 /* YieldExpression */: + case 180 /* ConditionalExpression */: + case 183 /* SpreadElementExpression */: + case 190 /* Block */: + case 191 /* VariableStatement */: + case 193 /* ExpressionStatement */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 202 /* ReturnStatement */: + case 203 /* WithStatement */: + case 204 /* SwitchStatement */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: + case 205 /* LabeledStatement */: + case 206 /* ThrowStatement */: + case 207 /* TryStatement */: + case 242 /* CatchClause */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: + case 236 /* JsxAttribute */: + case 237 /* JsxSpreadAttribute */: + case 233 /* JsxOpeningElement */: + case 238 /* JsxExpression */: return ts.forEachChild(node, isAssignedIn); } return false; } } - function resolveLocation(node) { - // Resolve location from top down towards node if it is a context sensitive expression - // That helps in making sure not assigning types as any when resolved out of order - var containerNodes = []; - for (var parent_5 = node.parent; parent_5; parent_5 = parent_5.parent) { - if ((ts.isExpression(parent_5) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(parent_5)) { - containerNodes.unshift(parent_5); - } - } - 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); - // Get the narrowed type of symbol at given location instead of just getting - // the type of the symbol. - // eg. - // function foo(a: string | number) { - // if (typeof a === "string") { - // a/**/ - // } - // } - // getTypeOfSymbol for a would return type of parameter symbol string | number - // Unless we provide location /**/, checker wouldn't know how to narrow the type - // By using getNarrowedTypeOfSymbol would return string since it would be able to narrow - // it by typeguard in the if true condition - return getNarrowedTypeOfSymbol(symbol, node); - } // Get the narrowed type of a given symbol at a given location function getNarrowedTypeOfSymbol(symbol, node) { var type = getTypeOfSymbol(symbol); @@ -18128,37 +18475,37 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 193 /* IfStatement */: + case 194 /* IfStatement */: // In a branch of an if statement, narrow based on controlling expression if (child !== node.expression) { - narrowedType = narrowType(type, node.expression, child === node.thenStatement); + narrowedType = narrowType(type, node.expression, /*assumeTrue*/ child === node.thenStatement); } break; - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: // In a branch of a conditional expression, narrow based on controlling condition if (child !== node.condition) { - narrowedType = narrowType(type, node.condition, child === node.whenTrue); + narrowedType = narrowType(type, node.condition, /*assumeTrue*/ child === node.whenTrue); } break; - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: // In the right operand of an && or ||, narrow based on left operand if (child === node.right) { - if (node.operatorToken.kind === 49 /* AmpersandAmpersandToken */) { - narrowedType = narrowType(type, node.left, true); + if (node.operatorToken.kind === 50 /* AmpersandAmpersandToken */) { + narrowedType = narrowType(type, node.left, /*assumeTrue*/ true); } - else if (node.operatorToken.kind === 50 /* BarBarToken */) { - narrowedType = narrowType(type, node.left, false); + else if (node.operatorToken.kind === 51 /* BarBarToken */) { + narrowedType = narrowType(type, node.left, /*assumeTrue*/ false); } } break; - case 245 /* SourceFile */: - case 215 /* ModuleDeclaration */: - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 141 /* Constructor */: + case 246 /* SourceFile */: + case 216 /* ModuleDeclaration */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 142 /* Constructor */: // Stop at the first containing function or module declaration break loop; } @@ -18175,23 +18522,23 @@ var ts; return type; function narrowTypeByEquality(type, expr, assumeTrue) { // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 173 /* TypeOfExpression */ || expr.right.kind !== 8 /* StringLiteral */) { + if (expr.left.kind !== 174 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 66 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 67 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operatorToken.kind === 32 /* ExclamationEqualsEqualsToken */) { + if (expr.operatorToken.kind === 33 /* 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, 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */ | 4194304 /* ESSymbol */, - /*isOfTypeKind*/ true, false); + return removeTypesFromUnionType(type, /*typeKind*/ 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */ | 16777216 /* ESSymbol */, + /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); } // Check was for a primitive type, return that primitive type if it is a subtype if (isTypeSubtypeOf(typeInfo.type, type)) { @@ -18199,12 +18546,12 @@ var ts; } // Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is // union of enum types and other types. - return removeTypesFromUnionType(type, typeInfo.flags, false, false); + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ false); } else { // Assumed result is false. If check was for a primitive type, remove that primitive type if (typeInfo) { - return removeTypesFromUnionType(type, typeInfo.flags, true, false); + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); } // Otherwise we don't have enough information to do anything. return type; @@ -18213,14 +18560,14 @@ var ts; function narrowTypeByAnd(type, expr, assumeTrue) { if (assumeTrue) { // The assumed result is true, therefore we narrow assuming each operand to be true. - return narrowType(narrowType(type, expr.left, true), expr.right, true); + return narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ true); } else { // The assumed result is false. This means either the first operand was false, or the first operand was true // and the second operand was false. We narrow with those assumptions and union the two resulting types. return getUnionType([ - narrowType(type, expr.left, false), - narrowType(narrowType(type, expr.left, true), expr.right, false) + narrowType(type, expr.left, /*assumeTrue*/ false), + narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ false) ]); } } @@ -18229,18 +18576,18 @@ var ts; // The assumed result is true. This means either the first operand was true, or the first operand was false // and the second operand was true. We narrow with those assumptions and union the two resulting types. return getUnionType([ - narrowType(type, expr.left, true), - narrowType(narrowType(type, expr.left, false), expr.right, true) + narrowType(type, expr.left, /*assumeTrue*/ true), + narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ true) ]); } else { // The assumed result is false, therefore we narrow assuming each operand to be false. - return narrowType(narrowType(type, expr.left, false), expr.right, false); + return narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ false); } } function narrowTypeByInstanceof(type, expr, assumeTrue) { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 66 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { return type; } // Check that right operand is a function type with a prototype property @@ -18276,13 +18623,17 @@ var ts; return type; } function getNarrowedType(originalType, narrowedTypeCandidate) { - // Narrow to the target type if it's a subtype of the current type - if (isTypeSubtypeOf(narrowedTypeCandidate, originalType)) { - return narrowedTypeCandidate; - } - // If the current type is a union type, remove all constituents that aren't subtypes of the target. + // If the current type is a union type, remove all constituents that aren't assignable to target. If that produces + // 0 candidates, fall back to the assignability check if (originalType.flags & 16384 /* Union */) { - return getUnionType(ts.filter(originalType.types, function (t) { return isTypeSubtypeOf(t, narrowedTypeCandidate); })); + var assignableConstituents = ts.filter(originalType.types, function (t) { return isTypeAssignableTo(t, narrowedTypeCandidate); }); + if (assignableConstituents.length) { + return getUnionType(assignableConstituents); + } + } + if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { + // Narrow to the target type if it's assignable to the current type + return narrowedTypeCandidate; } return originalType; } @@ -18308,27 +18659,27 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 165 /* CallExpression */: + case 166 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: var operator = expr.operatorToken.kind; - if (operator === 31 /* EqualsEqualsEqualsToken */ || operator === 32 /* ExclamationEqualsEqualsToken */) { + if (operator === 32 /* EqualsEqualsEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 49 /* AmpersandAmpersandToken */) { + else if (operator === 50 /* AmpersandAmpersandToken */) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 50 /* BarBarToken */) { + else if (operator === 51 /* BarBarToken */) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 88 /* InstanceOfKeyword */) { + else if (operator === 89 /* InstanceOfKeyword */) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 176 /* PrefixUnaryExpression */: - if (expr.operator === 47 /* ExclamationToken */) { + case 177 /* PrefixUnaryExpression */: + if (expr.operator === 48 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -18346,7 +18697,7 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 171 /* ArrowFunction */) { + if (container.kind === 172 /* ArrowFunction */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -18377,7 +18728,7 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & 2 /* BlockScopedVariable */) === 0 || - symbol.valueDeclaration.parent.kind === 241 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 242 /* CatchClause */) { return; } // - check if binding is used in some function @@ -18386,19 +18737,19 @@ var ts; // nesting structure: // (variable declaration or binding element) -> variable declaration list -> container var container = symbol.valueDeclaration; - while (container.kind !== 209 /* VariableDeclarationList */) { + while (container.kind !== 210 /* VariableDeclarationList */) { container = container.parent; } // get the parent of variable declaration list container = container.parent; - if (container.kind === 190 /* VariableStatement */) { + if (container.kind === 191 /* VariableStatement */) { // if parent is variable statement - get its parent container = container.parent; } var inFunction = isInsideFunction(node.parent, container); var current = container; while (current && !ts.nodeStartsNewLexicalEnvironment(current)) { - if (isIterationStatement(current, false)) { + if (isIterationStatement(current, /*lookInLabeledStatements*/ false)) { if (inFunction) { grammarErrorOnFirstToken(current, ts.Diagnostics.Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher, ts.declarationNameToString(node)); } @@ -18411,7 +18762,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 138 /* PropertyDeclaration */ || container.kind === 141 /* Constructor */) { + if (container.kind === 139 /* PropertyDeclaration */ || container.kind === 142 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -18422,35 +18773,35 @@ var ts; function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. - var container = ts.getThisContainer(node, true); + var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 171 /* ArrowFunction */) { - container = ts.getThisContainer(container, false); + if (container.kind === 172 /* ArrowFunction */) { + container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); } switch (container.kind) { - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 141 /* Constructor */: + case 142 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -18465,98 +18816,105 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 135 /* Parameter */) { + if (n.kind === 136 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 165 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 166 /* CallExpression */ && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; + var container = ts.getSuperContainer(node, /*includeFunctions*/ true); + var needToCaptureLexicalThis = false; + if (!isCallExpression) { + // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting + while (container && container.kind === 172 /* ArrowFunction */) { + container = ts.getSuperContainer(container, /*includeFunctions*/ true); + needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; + } + } + var canUseSuperExpression = isLegalUsageOfSuperExpression(container); + var nodeCheckFlag = 0; + // always set NodeCheckFlags for 'super' expression node + if (canUseSuperExpression) { + if ((container.flags & 128 /* Static */) || isCallExpression) { + nodeCheckFlag = 512 /* SuperStatic */; + } + else { + nodeCheckFlag = 256 /* SuperInstance */; + } + getNodeLinks(node).flags |= nodeCheckFlag; + if (needToCaptureLexicalThis) { + // call expressions are allowed only in constructors so they should always capture correct 'this' + // super property access expressions can also appear in arrow functions - + // in this case they should also use correct lexical this + captureLexicalThis(node.parent, container); + } + } if (!baseClassType) { if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) { 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; - var needToCaptureLexicalThis; + if (!canUseSuperExpression) { + if (container && container.kind === 134 /* ComputedPropertyName */) { + 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; + } + if (container.kind === 142 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + return unknownType; + } + return nodeCheckFlag === 512 /* SuperStatic */ + ? getBaseConstructorTypeOfClass(classType) + : baseClassType; + function isLegalUsageOfSuperExpression(container) { + if (!container) { + return false; + } if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - canUseSuperExpression = container.kind === 141 /* Constructor */; + return container.kind === 142 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) // 'super' property access is allowed // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor - // super property access might appear in arrow functions with arbitrary deep nesting - needToCaptureLexicalThis = false; - while (container && container.kind === 171 /* ArrowFunction */) { - container = ts.getSuperContainer(container, true); - needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; - } // topmost container must be something that is directly nested in the class declaration if (container && ts.isClassLike(container.parent)) { if (container.flags & 128 /* Static */) { - canUseSuperExpression = - container.kind === 140 /* MethodDeclaration */ || - container.kind === 139 /* MethodSignature */ || - container.kind === 142 /* GetAccessor */ || - container.kind === 143 /* SetAccessor */; + return container.kind === 141 /* MethodDeclaration */ || + container.kind === 140 /* MethodSignature */ || + container.kind === 143 /* GetAccessor */ || + container.kind === 144 /* SetAccessor */; } else { - canUseSuperExpression = - container.kind === 140 /* MethodDeclaration */ || - container.kind === 139 /* MethodSignature */ || - container.kind === 142 /* GetAccessor */ || - container.kind === 143 /* SetAccessor */ || - container.kind === 138 /* PropertyDeclaration */ || - container.kind === 137 /* PropertySignature */ || - container.kind === 141 /* Constructor */; + return container.kind === 141 /* MethodDeclaration */ || + container.kind === 140 /* MethodSignature */ || + container.kind === 143 /* GetAccessor */ || + container.kind === 144 /* SetAccessor */ || + container.kind === 139 /* PropertyDeclaration */ || + container.kind === 138 /* PropertySignature */ || + container.kind === 142 /* Constructor */; } } } - if (canUseSuperExpression) { - var returnType; - if ((container.flags & 128 /* Static */) || isCallExpression) { - getNodeLinks(node).flags |= 512 /* SuperStatic */; - returnType = getBaseConstructorTypeOfClass(classType); - } - else { - getNodeLinks(node).flags |= 256 /* SuperInstance */; - returnType = baseClassType; - } - if (container.kind === 141 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { - // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) - error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); - returnType = unknownType; - } - if (!isCallExpression && needToCaptureLexicalThis) { - // call expressions are allowed only in constructors so they should always capture correct 'this' - // super property access expressions can also appear in arrow functions - - // in this case they should also use correct lexical this - captureLexicalThis(node.parent, container); - } - return returnType; - } - } - if (container && container.kind === 133 /* ComputedPropertyName */) { - 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 false; } - return unknownType; } // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter) { @@ -18592,7 +18950,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 135 /* Parameter */) { + if (declaration.kind === 136 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -18625,7 +18983,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 135 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 136 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -18636,8 +18994,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 141 /* Constructor */ || - functionDecl.kind === 142 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 143 /* SetAccessor */))) { + functionDecl.kind === 142 /* Constructor */ || + functionDecl.kind === 143 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -18659,7 +19017,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 167 /* TaggedTemplateExpression */) { + if (template.parent.kind === 168 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -18667,13 +19025,13 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 54 /* FirstAssignment */ && operator <= 65 /* LastAssignment */) { + if (operator >= 55 /* FirstAssignment */ && operator <= 66 /* LastAssignment */) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 50 /* BarBarToken */) { + else if (operator === 51 /* BarBarToken */) { // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // expression has no contextual type, the right operand is contextually typed by the type of the left operand. var type = getContextualType(binaryExpression); @@ -18769,7 +19127,7 @@ var ts; var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1 /* Number */) - || (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(type, undefined) : undefined); + || (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(type, /*errorNode*/ undefined) : undefined); } return undefined; } @@ -18780,7 +19138,7 @@ var ts; } function getContextualTypeForJsxExpression(expr) { // Contextual type only applies to JSX expressions that are in attribute assignments (not in 'Children' positions) - if (expr.parent.kind === 235 /* JsxAttribute */) { + if (expr.parent.kind === 236 /* JsxAttribute */) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -18790,7 +19148,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 236 /* JsxSpreadAttribute */) { + if (expr.kind === 237 /* JsxSpreadAttribute */) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -18811,38 +19169,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 208 /* VariableDeclaration */: - case 135 /* Parameter */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 136 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 161 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 171 /* ArrowFunction */: - case 201 /* ReturnStatement */: + case 172 /* ArrowFunction */: + case 202 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 242 /* PropertyAssignment */: + case 243 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 187 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 180 /* TemplateExpression */); + case 188 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 181 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return getContextualType(parent); - case 237 /* JsxExpression */: - case 236 /* JsxSpreadAttribute */: + case 238 /* JsxExpression */: + case 237 /* JsxSpreadAttribute */: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -18859,7 +19217,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 170 /* FunctionExpression */ || node.kind === 171 /* ArrowFunction */; + return node.kind === 171 /* FunctionExpression */ || node.kind === 172 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -18873,7 +19231,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 140 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -18887,19 +19245,13 @@ var ts; var types = type.types; for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; - // The signature set of all constituent type with call signatures should match - // So number of signatures allowed is either 0 or 1 - if (signatureList && - getSignaturesOfStructuredType(current, 0 /* Call */).length > 1) { - return undefined; - } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { + else if (!compareSignatures(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypes)) { // Signatures aren't identical, do not use return undefined; } @@ -18919,23 +19271,36 @@ var ts; } return result; } - // Presence of a contextual type mapper indicates inferential typing, except the identityMapper object is - // used as a special marker for other purposes. + /** + * Detect if the mapper implies an inference context. Specifically, there are 4 possible values + * for a mapper. Let's go through each one of them: + * + * 1. undefined - this means we are not doing inferential typing, but we may do contextual typing, + * which could cause us to assign a parameter a type + * 2. identityMapper - means we want to avoid assigning a parameter a type, whether or not we are in + * inferential typing (context is undefined for the identityMapper) + * 3. a mapper created by createInferenceMapper - we are doing inferential typing, we want to assign + * types to parameters and fix type parameters (context is defined) + * 4. an instantiation mapper created by createTypeMapper or createTypeEraser - this should never be + * passed as the contextual mapper when checking an expression (context is undefined for these) + * + * isInferentialContext is detecting if we are in case 3 + */ function isInferentialContext(mapper) { - return mapper && mapper !== identityMapper; + return mapper && mapper.context; } // A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property // assignment in an object literal that is an assignment target, or if it is parented by an array literal that is // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 178 /* BinaryExpression */ && parent.operatorToken.kind === 54 /* EqualsToken */ && parent.left === node) { + if (parent.kind === 179 /* BinaryExpression */ && parent.operatorToken.kind === 55 /* EqualsToken */ && parent.left === node) { return true; } - if (parent.kind === 242 /* PropertyAssignment */) { + if (parent.kind === 243 /* PropertyAssignment */) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 161 /* ArrayLiteralExpression */) { + if (parent.kind === 162 /* ArrayLiteralExpression */) { return isAssignmentTarget(parent); } return false; @@ -18948,7 +19313,7 @@ var ts; // So the fact that contextualMapper is passed is not important, because the operand of a spread // element is not contextually typed. var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); - return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -18960,7 +19325,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 182 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 183 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -18975,7 +19340,7 @@ var ts; // if there is no index type / iterated type. var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1 /* Number */) || - (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(restArrayType, undefined) : undefined); + (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined); if (restElementType) { elementTypes.push(restElementType); } @@ -18984,7 +19349,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 182 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 183 /* SpreadElementExpression */; } if (!hasSpreadElement) { var contextualType = getContextualType(node); @@ -18995,7 +19360,7 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 133 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 134 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -19035,11 +19400,11 @@ var ts; links.resolvedType = checkExpression(node.expression); // 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 (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 /* NumberLike */ | 258 /* StringLike */ | 4194304 /* ESSymbol */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 /* NumberLike */ | 258 /* StringLike */ | 16777216 /* ESSymbol */)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { - checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true); } } return links.resolvedType; @@ -19054,18 +19419,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 242 /* PropertyAssignment */ || - memberDecl.kind === 243 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 243 /* PropertyAssignment */ || + memberDecl.kind === 244 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 242 /* PropertyAssignment */) { + if (memberDecl.kind === 243 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 140 /* MethodDeclaration */) { + else if (memberDecl.kind === 141 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 243 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 244 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -19085,7 +19450,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 142 /* GetAccessor */ || memberDecl.kind === 143 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 143 /* GetAccessor */ || memberDecl.kind === 144 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -19096,7 +19461,7 @@ var ts; var stringIndexType = getIndexType(0 /* String */); var numberIndexType = getIndexType(1 /* Number */); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 524288 /* ObjectLiteral */ | 2097152 /* ContainsObjectLiteral */ | (typeFlags & 1048576 /* ContainsUndefinedOrNull */); + result.flags |= 524288 /* ObjectLiteral */ | 1048576 /* FreshObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | (typeFlags & 14680064 /* PropagatingFlags */); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -19129,35 +19494,39 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 66 /* Identifier */) { + if (lhs.kind === 67 /* Identifier */) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && tagNamesAreEquivalent(lhs.left, rhs.left); } function checkJsxElement(node) { + // Check attributes + checkJsxOpeningLikeElement(node.openingElement); // Check that the closing tag matches if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { error(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNode(node.openingElement.tagName)); } - // Check attributes - checkJsxOpeningLikeElement(node.openingElement); + else { + // Perform resolution on the closing tag so that rename/go to definition/etc work + getJsxElementTagSymbol(node.closingElement); + } // Check children for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 237 /* JsxExpression */: + case 238 /* JsxExpression */: checkJsxExpression(child); break; - case 230 /* JsxElement */: + case 231 /* JsxElement */: checkJsxElement(child); break; - case 231 /* JsxSelfClosingElement */: + case 232 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; default: // No checks for JSX Text - ts.Debug.assert(child.kind === 233 /* JsxText */); + ts.Debug.assert(child.kind === 234 /* JsxText */); } } return jsxElementType || anyType; @@ -19173,7 +19542,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 132 /* QualifiedName */) { + if (tagName.kind === 133 /* QualifiedName */) { return false; } else { @@ -19190,10 +19559,19 @@ var ts; else if (elementAttributesType && !isTypeAny(elementAttributesType)) { var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - // If there's no corresponding property with this name, error - if (!correspondingPropType && isUnhyphenatedJsxName(node.name.text)) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; + if (isUnhyphenatedJsxName(node.name.text)) { + // Maybe there's a string indexer? + var indexerType = getIndexTypeOfType(elementAttributesType, 0 /* String */); + if (indexerType) { + correspondingPropType = indexerType; + } + else { + // If there's no corresponding property with this name, error + if (!correspondingPropType) { + error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); + return unknownType; + } + } } } var exprType; @@ -19269,7 +19647,7 @@ var ts; return intrinsicElementsType.symbol; } // Wasn't found - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, 'JSX.' + JsxNames.IntrinsicElements); + error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); return unknownSymbol; } else { @@ -19279,22 +19657,24 @@ var ts; } } function lookupClassTag(node) { - var valueSymbol; + var valueSymbol = resolveJsxTagName(node); // Look up the value in the current scope - if (node.tagName.kind === 66 /* Identifier */) { - var tag = node.tagName; - var sym = getResolvedSymbol(tag); - valueSymbol = sym.exportSymbol || sym; - } - else { - valueSymbol = checkQualifiedName(node.tagName).symbol; - } if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4 /* ClassElement */; getSymbolLinks(valueSymbol).referenced = true; } return valueSymbol || unknownSymbol; } + function resolveJsxTagName(node) { + if (node.tagName.kind === 67 /* Identifier */) { + var tag = node.tagName; + var sym = getResolvedSymbol(tag); + return sym.exportSymbol || sym; + } + else { + return checkQualifiedName(node.tagName).symbol; + } + } } /** * Given a JSX element that is a class element, finds the Element Instance Type. If the @@ -19302,10 +19682,9 @@ var ts; * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). */ function getJsxElementInstanceType(node) { - if (!(getNodeLinks(node).jsxFlags & 4 /* ClassElement */)) { - // There is no such thing as an instance type for a non-class element - return undefined; - } + // There is no such thing as an instance type for a non-class element. This + // line shouldn't be hit. + ts.Debug.assert(!!(getNodeLinks(node).jsxFlags & 4 /* ClassElement */), "Should not call getJsxElementInstanceType on non-class Element"); var classSymbol = getJsxElementTagSymbol(node); if (classSymbol === unknownSymbol) { // Couldn't find the class instance type. Error has already been issued @@ -19324,15 +19703,10 @@ var ts; if (signatures.length === 0) { // We found no signatures at all, which is an error error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return undefined; + return unknownType; } } - // Check that the constructor/factory returns an object type - var returnType = getUnionType(signatures.map(function (s) { return getReturnTypeOfSignature(s); })); - if (!isTypeAny(returnType) && !(returnType.flags & 80896 /* ObjectType */)) { - error(node.tagName, ts.Diagnostics.The_return_type_of_a_JSX_element_constructor_must_return_an_object_type); - return undefined; - } + var returnType = getUnionType(signatures.map(getReturnTypeOfSignature)); // Issue an error if this return type isn't assignable to JSX.ElementClass var elemClassType = getJsxGlobalElementClassType(); if (elemClassType) { @@ -19347,7 +19721,7 @@ var ts; /// non-instrinsic elements' attributes type is the element instance type) function getJsxElementPropertiesName() { // JSX - var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536 /* Namespace */, undefined); + var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); // JSX.ElementAttributesProperty [symbol] var attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, 793056 /* Type */); // JSX.ElementAttributesProperty [type] @@ -19383,7 +19757,7 @@ var ts; if (links.jsxFlags & 4 /* ClassElement */) { var elemInstanceType = getJsxElementInstanceType(node); if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = anyType; + return links.resolvedJsxType = elemInstanceType; } var propsName = getJsxElementPropertiesName(); if (propsName === undefined) { @@ -19465,7 +19839,7 @@ var ts; // be marked as 'used' so we don't incorrectly elide its import. And if there // is no 'React' symbol in scope, we should issue an error. if (compilerOptions.jsx === 2 /* React */) { - var reactSym = resolveName(node.tagName, 'React', 107455 /* Value */, ts.Diagnostics.Cannot_find_name_0, 'React'); + var reactSym = resolveName(node.tagName, "React", 107455 /* Value */, ts.Diagnostics.Cannot_find_name_0, "React"); if (reactSym) { getSymbolLinks(reactSym).referenced = true; } @@ -19477,11 +19851,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 235 /* JsxAttribute */) { + if (node.attributes[i].kind === 236 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 236 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 237 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -19511,7 +19885,7 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 138 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 139 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; @@ -19527,8 +19901,8 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 92 /* SuperKeyword */) { - var errorNode = node.kind === 163 /* PropertyAccessExpression */ ? + if (left.kind === 93 /* SuperKeyword */) { + var errorNode = node.kind === 164 /* PropertyAccessExpression */ ? node.name : node.right; // TS 1.0 spec (April 2014): 4.8.2 @@ -19538,7 +19912,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (getDeclarationKindFromSymbol(prop) !== 140 /* MethodDeclaration */) { + if (getDeclarationKindFromSymbol(prop) !== 141 /* MethodDeclaration */) { // `prop` refers to a *property* declared in the super class // rather than a *method*, so it does not satisfy the above criteria. error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); @@ -19571,7 +19945,7 @@ var ts; } // Property is known to be protected at this point // All protected properties of a supertype are accessible in a super access - if (left.kind === 92 /* SuperKeyword */) { + if (left.kind === 93 /* SuperKeyword */) { return true; } // A protected property is accessible in the declaring class and classes derived from it @@ -19621,7 +19995,7 @@ var ts; return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 163 /* PropertyAccessExpression */ + var left = node.kind === 164 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -19637,7 +20011,7 @@ var ts; // Grammar checking if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 166 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 167 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -19656,7 +20030,7 @@ var ts; } var isConstEnum = isConstEnumObjectType(objectType); if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8 /* StringLiteral */)) { + (!node.argumentExpression || node.argumentExpression.kind !== 9 /* StringLiteral */)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -19684,7 +20058,7 @@ var ts; } } // Check for compatible indexer types. - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 /* StringLike */ | 132 /* NumberLike */ | 4194304 /* ESSymbol */)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 /* StringLike */ | 132 /* NumberLike */ | 16777216 /* ESSymbol */)) { // Try to use a number indexer. if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132 /* NumberLike */)) { var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); @@ -19714,10 +20088,10 @@ var ts; * Otherwise, returns undefined. */ function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { - if (indexArgumentExpression.kind === 8 /* StringLiteral */ || indexArgumentExpression.kind === 7 /* NumericLiteral */) { + if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { return indexArgumentExpression.text; } - if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { var rightHandSideName = indexArgumentExpression.name.text; return ts.getPropertyNameForKnownSymbolName(rightHandSideName); } @@ -19739,7 +20113,7 @@ var ts; return false; } // Make sure the property type is the primitive symbol type - if ((expressionType.flags & 4194304 /* ESSymbol */) === 0) { + if ((expressionType.flags & 16777216 /* ESSymbol */) === 0) { if (reportError) { error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); } @@ -19766,10 +20140,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 167 /* TaggedTemplateExpression */) { + if (node.kind === 168 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 136 /* Decorator */) { + else if (node.kind !== 137 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -19799,13 +20173,13 @@ var ts; for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_6 = signature.declaration && signature.declaration.parent; + var parent_5 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_6 === lastParent) { + if (lastParent && parent_5 === lastParent) { index++; } else { - lastParent = parent_6; + lastParent = parent_5; index = cutoffIndex; } } @@ -19813,7 +20187,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_6; + lastParent = parent_5; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -19835,7 +20209,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 182 /* SpreadElementExpression */) { + if (arg && arg.kind === 183 /* SpreadElementExpression */) { return i; } } @@ -19847,13 +20221,13 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 167 /* TaggedTemplateExpression */) { + if (node.kind === 168 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 180 /* TemplateExpression */) { + if (tagExpression.template.kind === 181 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -19866,20 +20240,20 @@ var ts; // then this might actually turn out to be a TemplateHead in the future; // so we consider the call to be incomplete. var templateLiteral = tagExpression.template; - ts.Debug.assert(templateLiteral.kind === 10 /* NoSubstitutionTemplateLiteral */); + ts.Debug.assert(templateLiteral.kind === 11 /* NoSubstitutionTemplateLiteral */); callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 136 /* Decorator */) { + else if (node.kind === 137 /* Decorator */) { isDecorator = true; typeArguments = undefined; - adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); + adjustedArgCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); } else { var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 166 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 167 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -19922,7 +20296,7 @@ var ts; } // Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec) function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature.typeParameters, true); + var context = createInferenceContext(signature.typeParameters, /*inferUnionTypes*/ true); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type inferTypes(context, instantiateType(source, contextualMapper), target); @@ -19958,7 +20332,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 184 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 185 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type @@ -20017,14 +20391,14 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 184 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 185 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type // for the argument. In that case, we should check the argument. if (argType === undefined) { - argType = arg.kind === 8 /* StringLiteral */ && !reportErrors + argType = arg.kind === 9 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } @@ -20049,16 +20423,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 167 /* TaggedTemplateExpression */) { + if (node.kind === 168 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 180 /* TemplateExpression */) { + if (template.kind === 181 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 136 /* Decorator */) { + else if (node.kind === 137 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. @@ -20083,25 +20457,25 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 136 /* Decorator */) { + if (node.kind === 137 /* Decorator */) { switch (node.parent.kind) { - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 135 /* Parameter */: + case 136 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -20126,25 +20500,25 @@ var ts; function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. switch (node.kind) { - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 135 /* Parameter */: + case 136 /* Parameter */: // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 141 /* Constructor */) { + if (node.kind === 142 /* Constructor */) { var classSymbol_1 = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol_1); } // fall-through - case 138 /* PropertyDeclaration */: - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -20173,35 +20547,35 @@ var ts; function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; - case 135 /* Parameter */: + case 136 /* Parameter */: node = node.parent; - if (node.kind === 141 /* Constructor */) { + if (node.kind === 142 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } // For a non-constructor parameter decorator, the `propertyKey` will be either // a string or a symbol, based on the name of the parameter's containing method. // fall-through - case 138 /* PropertyDeclaration */: - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will // be either string or symbol. var element = node; switch (element.name.kind) { - case 66 /* Identifier */: - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: + case 67 /* Identifier */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: return getStringLiteralType(element.name); - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 4194304 /* ESSymbol */)) { + if (allConstituentTypesHaveKind(nameType, 16777216 /* ESSymbol */)) { return nameType; } else { @@ -20227,18 +20601,18 @@ var ts; // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a paramter decorator switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; - case 135 /* Parameter */: + case 136 /* Parameter */: // The `parameterIndex` for a parameter decorator is always a number return numberType; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -20271,10 +20645,10 @@ var ts; // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 136 /* Decorator */) { + if (node.kind === 137 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 167 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */) { return globalTemplateStringsArrayType; } // This is not a synthetic argument, so we return 'undefined' @@ -20286,8 +20660,8 @@ var ts; */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 136 /* Decorator */ || - (argIndex === 0 && node.kind === 167 /* TaggedTemplateExpression */)) { + if (node.kind === 137 /* Decorator */ || + (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -20296,11 +20670,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 136 /* Decorator */) { + if (node.kind === 137 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 167 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -20309,13 +20683,13 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 167 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 136 /* Decorator */; + var isTaggedTemplate = node.kind === 168 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 137 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; // We already perform checking on the type arguments on the class declaration itself. - if (node.expression.kind !== 92 /* SuperKeyword */) { + if (node.expression.kind !== 93 /* SuperKeyword */) { ts.forEach(typeArguments, checkSourceElement); } } @@ -20412,17 +20786,18 @@ var ts; // in arguments too early. If possible, we'd like to only type them once we know the correct // overload. However, this matters for the case where the call is correct. When the call is // an error, we don't need to exclude any arguments, although it would cause no harm to do so. - checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true); } else if (candidateForTypeArgumentError) { if (!isTaggedTemplate && !isDecorator && typeArguments) { - checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true, headMessage); + checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], /*reportErrors*/ true, headMessage); } 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)); + var diagnosticChainHead = ts.chainDiagnosticMessages(/*details*/ undefined, // details will be provided by call to reportNoCommonSupertypeError + ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); if (headMessage) { diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage); } @@ -20441,6 +20816,9 @@ var ts; for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { + if (candidate.typeParameters && typeArguments) { + candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); + } return candidate; } } @@ -20463,7 +20841,7 @@ var ts; var candidate = void 0; var typeArgumentsAreValid = void 0; var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate.typeParameters, false) + ? createInferenceContext(originalCandidate.typeParameters, /*inferUnionTypes*/ false) : undefined; while (true) { candidate = originalCandidate; @@ -20471,7 +20849,7 @@ var ts; var typeArgumentTypes = void 0; if (typeArguments) { typeArgumentTypes = new Array(candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); } else { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); @@ -20483,7 +20861,7 @@ var ts; } candidate = getSignatureInstantiation(candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; @@ -20518,7 +20896,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 92 /* SuperKeyword */) { + if (node.expression.kind === 93 /* SuperKeyword */) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated @@ -20592,7 +20970,7 @@ var ts; // Note, only class declarations can be declared abstract. // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 211 /* ClassDeclaration */); + var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212 /* ClassDeclaration */); if (valueDecl && valueDecl.flags & 256 /* Abstract */) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -20651,16 +21029,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 135 /* Parameter */: + case 136 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -20697,16 +21075,16 @@ var ts; // to correctly fill the candidatesOutArray. if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 165 /* CallExpression */) { + if (node.kind === 166 /* CallExpression */) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 166 /* NewExpression */) { + else if (node.kind === 167 /* NewExpression */) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 167 /* TaggedTemplateExpression */) { + else if (node.kind === 168 /* TaggedTemplateExpression */) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 136 /* Decorator */) { + else if (node.kind === 137 /* Decorator */) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -20724,15 +21102,15 @@ var ts; // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 92 /* SuperKeyword */) { + if (node.expression.kind === 93 /* SuperKeyword */) { return voidType; } - if (node.kind === 166 /* NewExpression */) { + if (node.kind === 167 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 141 /* Constructor */ && - declaration.kind !== 145 /* ConstructSignature */ && - declaration.kind !== 150 /* ConstructorType */) { + declaration.kind !== 142 /* Constructor */ && + declaration.kind !== 146 /* ConstructSignature */ && + declaration.kind !== 151 /* ConstructorType */) { // When resolved signature is a call signature (and not a construct signature) the result type is any if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); @@ -20746,7 +21124,7 @@ var ts; return getReturnTypeOfSignature(getResolvedSignature(node)); } function checkAssertion(node) { - var exprType = checkExpression(node.expression); + var exprType = getRegularTypeOfObjectLiteral(checkExpression(node.expression)); var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); @@ -20765,13 +21143,51 @@ var ts; 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); + var contextualParameterType = getTypeAtPosition(context, i); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { var parameter = ts.lastOrUndefined(signature.parameters); - var links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(ts.lastOrUndefined(context.parameters)), mapper); + var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + } + } + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + var links = getSymbolLinks(parameter); + if (!links.type) { + links.type = instantiateType(contextualType, mapper); + } + else if (isInferentialContext(mapper)) { + // Even if the parameter already has a type, it might be because it was given a type while + // processing the function as an argument to a prior signature during overload resolution. + // If this was the case, it may have caused some type parameters to be fixed. So here, + // we need to ensure that type parameters at the same positions get fixed again. This is + // done by calling instantiateType to attach the mapper to the contextualType, and then + // calling inferTypes to force a walk of contextualType so that all the correct fixing + // happens. The choice to pass in links.type may seem kind of arbitrary, but it serves + // to make sure that all the correct positions in contextualType are reached by the walk. + // Here is an example: + // + // interface Base { + // baseProp; + // } + // interface Derived extends Base { + // toBase(): Base; + // } + // + // var derived: Derived; + // + // declare function foo(x: T, func: (p: T) => T): T; + // declare function foo(x: T, func: (p: T) => T): T; + // + // var result = foo(derived, d => d.toBase()); + // + // We are typing d while checking the second overload. But we've already given d + // a type (Derived) from the first overload. However, we still want to fix the + // T in the second overload so that we do not infer Base as a candidate for T + // (inferring Base would make type argument inference inconsistent between the two + // overloads). + inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function createPromiseType(promisedType) { @@ -20791,7 +21207,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 189 /* Block */) { + if (func.body.kind !== 190 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -20910,7 +21326,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 205 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 206 /* ThrowStatement */); } // TypeScript Specification 1.0 (6.3) - July 2014 // An explicitly typed function whose return type isn't the Void or the Any type @@ -20925,7 +21341,7 @@ var ts; return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (ts.nodeIsMissing(func.body) || func.body.kind !== 189 /* Block */) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 190 /* Block */) { return; } var bodyBlock = func.body; @@ -20943,10 +21359,10 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 140 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 170 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 171 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -20959,37 +21375,44 @@ var ts; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); - // Check if function expression is contextually typed and assign parameter types if so - if (!(links.flags & 1024 /* ContextChecked */)) { + var contextSensitive = isContextSensitive(node); + var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + // Check if function expression is contextually typed and assign parameter types if so. + // See the comment in assignTypeToParameterAndFixTypeParameters to understand why we need to + // check mightFixTypeParameters. + if (mightFixTypeParameters || !(links.flags & 1024 /* ContextChecked */)) { var contextualSignature = getContextualSignature(node); // If a type check is started at a function expression that is an argument of a function call, obtaining the // contextual type may recursively get back to here during overload resolution of the call. If so, we will have // already assigned contextual types. - if (!(links.flags & 1024 /* ContextChecked */)) { + var contextChecked = !!(links.flags & 1024 /* ContextChecked */); + if (mightFixTypeParameters || !contextChecked) { links.flags |= 1024 /* ContextChecked */; if (contextualSignature) { var signature = getSignaturesOfType(type, 0 /* Call */)[0]; - if (isContextSensitive(node)) { + if (contextSensitive) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type && !signature.resolvedReturnType) { + if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } } - checkSignatureDeclaration(node); + if (!contextChecked) { + checkSignatureDeclaration(node); + } } } - if (produceDiagnostics && node.kind !== 140 /* MethodDeclaration */ && node.kind !== 139 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 140 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -21011,7 +21434,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 189 /* Block */) { + if (node.body.kind === 190 /* Block */) { checkSourceElement(node.body); } else { @@ -21057,24 +21480,24 @@ var ts; // and property accesses(section 4.10). // All other expression constructs described in this chapter are classified as values. switch (n.kind) { - case 66 /* Identifier */: { + case 67 /* Identifier */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.3 // An identifier expression that references a variable or parameter is classified as a reference. // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; } - case 163 /* PropertyAccessExpression */: { + case 164 /* PropertyAccessExpression */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.10 // A property access expression is always classified as a reference. // NOTE (not in spec): assignment to enum members should not be allowed return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; } - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: // old compiler doesn't check indexed assess return true; - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -21082,22 +21505,22 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 66 /* Identifier */: - case 163 /* PropertyAccessExpression */: { + case 67 /* Identifier */: + case 164 /* PropertyAccessExpression */: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768 /* Const */) !== 0; } - case 164 /* ElementAccessExpression */: { + case 165 /* ElementAccessExpression */: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8 /* StringLiteral */) { + if (symbol && index && index.kind === 9 /* StringLiteral */) { var name_12 = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 32768 /* Const */) !== 0; } return false; } - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return isConstVariableReference(n.expression); default: return false; @@ -21141,17 +21564,17 @@ var ts; function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); switch (node.operator) { - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 48 /* TildeToken */: - if (someConstituentTypeHasKind(operandType, 4194304 /* ESSymbol */)) { + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 49 /* TildeToken */: + if (someConstituentTypeHasKind(operandType, 16777216 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 47 /* ExclamationToken */: + case 48 /* ExclamationToken */: return booleanType; - case 39 /* PlusPlusToken */: - case 40 /* MinusMinusToken */: + case 40 /* PlusPlusToken */: + case 41 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors @@ -21217,7 +21640,7 @@ var 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 (allConstituentTypesHaveKind(leftType, 4194814 /* Primitive */)) { + if (allConstituentTypesHaveKind(leftType, 16777726 /* Primitive */)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -21231,7 +21654,7 @@ var 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 (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */ | 132 /* NumberLike */ | 4194304 /* ESSymbol */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */ | 132 /* NumberLike */ | 16777216 /* ESSymbol */)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 /* ObjectType */ | 512 /* TypeParameter */)) { @@ -21243,7 +21666,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 242 /* PropertyAssignment */ || p.kind === 243 /* ShorthandPropertyAssignment */) { + if (p.kind === 243 /* PropertyAssignment */ || p.kind === 244 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var name_13 = p.name; var type = isTypeAny(sourceType) @@ -21268,12 +21691,12 @@ var ts; // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType; + var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 184 /* OmittedExpression */) { - if (e.kind !== 182 /* SpreadElementExpression */) { + if (e.kind !== 185 /* OmittedExpression */) { + if (e.kind !== 183 /* SpreadElementExpression */) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -21298,7 +21721,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 178 /* BinaryExpression */ && restExpression.operatorToken.kind === 54 /* EqualsToken */) { + if (restExpression.kind === 179 /* BinaryExpression */ && restExpression.operatorToken.kind === 55 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -21311,14 +21734,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 178 /* BinaryExpression */ && target.operatorToken.kind === 54 /* EqualsToken */) { + if (target.kind === 179 /* BinaryExpression */ && target.operatorToken.kind === 55 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 162 /* ObjectLiteralExpression */) { + if (target.kind === 163 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 161 /* ArrayLiteralExpression */) { + if (target.kind === 162 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -21326,38 +21749,38 @@ var ts; 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); + checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); } return sourceType; } function checkBinaryExpression(node, contextualMapper) { var operator = node.operatorToken.kind; - if (operator === 54 /* EqualsToken */ && (node.left.kind === 162 /* ObjectLiteralExpression */ || node.left.kind === 161 /* ArrayLiteralExpression */)) { + if (operator === 55 /* EqualsToken */ && (node.left.kind === 163 /* ObjectLiteralExpression */ || node.left.kind === 162 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 36 /* AsteriskToken */: - case 57 /* AsteriskEqualsToken */: - case 37 /* SlashToken */: - case 58 /* SlashEqualsToken */: - case 38 /* PercentToken */: - case 59 /* PercentEqualsToken */: - case 35 /* MinusToken */: - case 56 /* MinusEqualsToken */: - case 41 /* LessThanLessThanToken */: - case 60 /* LessThanLessThanEqualsToken */: - case 42 /* GreaterThanGreaterThanToken */: - case 61 /* GreaterThanGreaterThanEqualsToken */: - case 43 /* GreaterThanGreaterThanGreaterThanToken */: - case 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 45 /* BarToken */: - case 64 /* BarEqualsToken */: - case 46 /* CaretToken */: - case 65 /* CaretEqualsToken */: - case 44 /* AmpersandToken */: - case 63 /* AmpersandEqualsToken */: + case 37 /* AsteriskToken */: + case 58 /* AsteriskEqualsToken */: + case 38 /* SlashToken */: + case 59 /* SlashEqualsToken */: + case 39 /* PercentToken */: + case 60 /* PercentEqualsToken */: + case 36 /* MinusToken */: + case 57 /* MinusEqualsToken */: + case 42 /* LessThanLessThanToken */: + case 61 /* LessThanLessThanEqualsToken */: + case 43 /* GreaterThanGreaterThanToken */: + case 62 /* GreaterThanGreaterThanEqualsToken */: + case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 46 /* BarToken */: + case 65 /* BarEqualsToken */: + case 47 /* CaretToken */: + case 66 /* CaretEqualsToken */: + case 45 /* AmpersandToken */: + case 64 /* AmpersandEqualsToken */: // TypeScript 1.0 spec (April 2014): 4.15.1 // These operators require their operands to be of type Any, the Number primitive type, // or an enum type. Operands of an enum type are treated @@ -21385,8 +21808,8 @@ var ts; } } return numberType; - case 34 /* PlusToken */: - case 55 /* PlusEqualsToken */: + case 35 /* PlusToken */: + case 56 /* PlusEqualsToken */: // TypeScript 1.0 spec (April 2014): 4.15.2 // The binary + operator requires both operands to be of the Number primitive type or an enum type, // or at least one of the operands to be of type Any or the String primitive type. @@ -21420,44 +21843,44 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 55 /* PlusEqualsToken */) { + if (operator === 56 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; - case 24 /* LessThanToken */: - case 26 /* GreaterThanToken */: - case 27 /* LessThanEqualsToken */: - case 28 /* GreaterThanEqualsToken */: + case 25 /* LessThanToken */: + case 27 /* GreaterThanToken */: + case 28 /* LessThanEqualsToken */: + case 29 /* GreaterThanEqualsToken */: if (!checkForDisallowedESSymbolOperand(operator)) { return booleanType; } // Fall through - case 29 /* EqualsEqualsToken */: - case 30 /* ExclamationEqualsToken */: - case 31 /* EqualsEqualsEqualsToken */: - case 32 /* ExclamationEqualsEqualsToken */: + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 88 /* InstanceOfKeyword */: + case 89 /* InstanceOfKeyword */: return checkInstanceOfExpression(node, leftType, rightType); - case 87 /* InKeyword */: + case 88 /* InKeyword */: return checkInExpression(node, leftType, rightType); - case 49 /* AmpersandAmpersandToken */: + case 50 /* AmpersandAmpersandToken */: return rightType; - case 50 /* BarBarToken */: + case 51 /* BarBarToken */: return getUnionType([leftType, rightType]); - case 54 /* EqualsToken */: + case 55 /* EqualsToken */: checkAssignmentOperator(rightType); - return rightType; - case 23 /* CommaToken */: + return getRegularTypeOfObjectLiteral(rightType); + case 24 /* CommaToken */: return rightType; } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 4194304 /* ESSymbol */) ? node.left : - someConstituentTypeHasKind(rightType, 4194304 /* ESSymbol */) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216 /* ESSymbol */) ? node.left : + someConstituentTypeHasKind(rightType, 16777216 /* ESSymbol */) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -21467,21 +21890,21 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 45 /* BarToken */: - case 64 /* BarEqualsToken */: - return 50 /* BarBarToken */; - case 46 /* CaretToken */: - case 65 /* CaretEqualsToken */: - return 32 /* ExclamationEqualsEqualsToken */; - case 44 /* AmpersandToken */: - case 63 /* AmpersandEqualsToken */: - return 49 /* AmpersandAmpersandToken */; + case 46 /* BarToken */: + case 65 /* BarEqualsToken */: + return 51 /* BarBarToken */; + case 47 /* CaretToken */: + case 66 /* CaretEqualsToken */: + return 33 /* ExclamationEqualsEqualsToken */; + case 45 /* AmpersandToken */: + case 64 /* AmpersandEqualsToken */: + return 50 /* AmpersandAmpersandToken */; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 54 /* FirstAssignment */ && operator <= 65 /* LastAssignment */) { + if (produceDiagnostics && operator >= 55 /* FirstAssignment */ && operator <= 66 /* LastAssignment */) { // TypeScript 1.0 spec (April 2014): 4.17 // An assignment of the form // VarExpr = ValueExpr @@ -21492,7 +21915,7 @@ var ts; // Use default messages if (ok) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported - checkTypeAssignableTo(valueType, leftType, node.left, undefined); + checkTypeAssignableTo(valueType, leftType, node.left, /*headMessage*/ undefined); } } } @@ -21530,7 +21953,7 @@ var ts; // If the user's code is syntactically correct, the func should always have a star. After all, // we are in a yield context. if (func && func.asteriskToken) { - var expressionType = checkExpressionCached(node.expression, undefined); + var expressionType = checkExpressionCached(node.expression, /*contextualMapper*/ undefined); var expressionElementType; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { @@ -21542,10 +21965,10 @@ var ts; if (func.type) { var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; if (nodeIsYieldStar) { - checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, /*headMessage*/ undefined); } else { - checkTypeAssignableTo(expressionType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(expressionType, signatureElementType, node.expression, /*headMessage*/ undefined); } } } @@ -21588,7 +22011,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -21599,14 +22022,14 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (contextualMapper && contextualMapper !== identityMapper) { + if (isInferentialContext(contextualMapper)) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getContextualType(node); @@ -21629,7 +22052,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 132 /* QualifiedName */) { + if (node.kind === 133 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -21641,9 +22064,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 163 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 164 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 66 /* Identifier */ || node.kind === 132 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); 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); } @@ -21657,78 +22080,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return checkIdentifier(node); - case 94 /* ThisKeyword */: + case 95 /* ThisKeyword */: return checkThisExpression(node); - case 92 /* SuperKeyword */: + case 93 /* SuperKeyword */: return checkSuperExpression(node); - case 90 /* NullKeyword */: + case 91 /* NullKeyword */: return nullType; - case 96 /* TrueKeyword */: - case 81 /* FalseKeyword */: + case 97 /* TrueKeyword */: + case 82 /* FalseKeyword */: return booleanType; - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: return checkNumericLiteral(node); - case 180 /* TemplateExpression */: + case 181 /* TemplateExpression */: return checkTemplateExpression(node); - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: + case 9 /* StringLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: return stringType; - case 9 /* RegularExpressionLiteral */: + case 10 /* RegularExpressionLiteral */: return globalRegExpType; - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 163 /* PropertyAccessExpression */: + case 164 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return checkCallExpression(node); - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: return checkClassExpression(node); - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 173 /* TypeOfExpression */: + case 174 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: return checkAssertion(node); - case 172 /* DeleteExpression */: + case 173 /* DeleteExpression */: return checkDeleteExpression(node); - case 174 /* VoidExpression */: + case 175 /* VoidExpression */: return checkVoidExpression(node); - case 175 /* AwaitExpression */: + case 176 /* AwaitExpression */: return checkAwaitExpression(node); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 177 /* PostfixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 182 /* SpreadElementExpression */: + case 183 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 184 /* OmittedExpression */: + case 185 /* OmittedExpression */: return undefinedType; - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: return checkYieldExpression(node); - case 237 /* JsxExpression */: + case 238 /* JsxExpression */: return checkJsxExpression(node); - case 230 /* JsxElement */: + case 231 /* JsxElement */: return checkJsxElement(node); - case 231 /* JsxSelfClosingElement */: + case 232 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 232 /* JsxOpeningElement */: + case 233 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -21757,7 +22180,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 141 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 142 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -21774,15 +22197,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 140 /* MethodDeclaration */ || - node.kind === 210 /* FunctionDeclaration */ || - node.kind === 170 /* FunctionExpression */; + return node.kind === 141 /* MethodDeclaration */ || + node.kind === 211 /* FunctionDeclaration */ || + node.kind === 171 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 66 /* Identifier */ && + if (param.name.kind === 67 /* Identifier */ && param.name.text === parameter.text) { return i; } @@ -21792,31 +22215,31 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { - case 171 /* ArrowFunction */: - case 144 /* CallSignature */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 149 /* FunctionType */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 172 /* ArrowFunction */: + case 145 /* CallSignature */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 150 /* FunctionType */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 146 /* IndexSignature */) { + if (node.kind === 147 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 149 /* FunctionType */ || node.kind === 210 /* FunctionDeclaration */ || node.kind === 150 /* ConstructorType */ || - node.kind === 144 /* CallSignature */ || node.kind === 141 /* Constructor */ || - node.kind === 145 /* ConstructSignature */) { + else if (node.kind === 150 /* FunctionType */ || node.kind === 211 /* FunctionDeclaration */ || node.kind === 151 /* ConstructorType */ || + node.kind === 145 /* CallSignature */ || node.kind === 142 /* Constructor */ || + node.kind === 146 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 147 /* TypePredicate */) { + if (node.type.kind === 148 /* TypePredicate */) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -21825,7 +22248,7 @@ var ts; error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - checkTypeAssignableTo(typePredicate.type, getTypeAtLocation(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); } } else if (typePredicateNode.parameterName) { @@ -21835,19 +22258,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 158 /* ObjectBindingPattern */ || - param.name.kind === 159 /* ArrayBindingPattern */) { + if (param.name.kind === 159 /* ObjectBindingPattern */ || + param.name.kind === 160 /* ArrayBindingPattern */) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 66 /* Identifier */ && + if (element.name.kind === 67 /* Identifier */ && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 159 /* ArrayBindingPattern */ || - element.name.kind === 158 /* ObjectBindingPattern */) { + else if (element.name.kind === 160 /* ArrayBindingPattern */ || + element.name.kind === 159 /* ObjectBindingPattern */) { checkBindingPattern(element.name); } } @@ -21871,10 +22294,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 144 /* CallSignature */: + case 145 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -21902,7 +22325,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 212 /* InterfaceDeclaration */) { + if (node.kind === 213 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -21922,7 +22345,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 127 /* StringKeyword */: + case 128 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -21930,7 +22353,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 125 /* NumberKeyword */: + case 126 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -21979,56 +22402,80 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 165 /* CallExpression */ && n.expression.kind === 92 /* SuperKeyword */; + return n.kind === 166 /* CallExpression */ && n.expression.kind === 93 /* SuperKeyword */; + } + function containsSuperCallAsComputedPropertyName(n) { + return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } - switch (n.kind) { - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: - case 162 /* ObjectLiteralExpression */: return false; - default: return ts.forEachChild(n, containsSuperCall); + else if (ts.isFunctionLike(n)) { + return false; + } + else if (ts.isClassLike(n)) { + return ts.forEach(n.members, containsSuperCallAsComputedPropertyName); } + return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 94 /* ThisKeyword */) { + if (n.kind === 95 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 170 /* FunctionExpression */ && n.kind !== 210 /* FunctionDeclaration */) { + else if (n.kind !== 171 /* FunctionExpression */ && n.kind !== 211 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 138 /* PropertyDeclaration */ && + return n.kind === 139 /* PropertyDeclaration */ && !(n.flags & 128 /* Static */) && !!n.initializer; } // TS 1.0 spec (April 2014): 8.3.2 // Constructors of classes with no extends clause may not contain super calls, whereas // constructors of derived classes must contain at least one super call somewhere in their function body. - if (ts.getClassExtendsHeritageClauseElement(node.parent)) { + var containingClassDecl = node.parent; + if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { + var containingClassSymbol = getSymbolOfNode(containingClassDecl); + var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); if (containsSuperCall(node.body)) { - // The first statement in the body of a constructor must be a super call if both of the following are true: + if (baseConstructorType === nullType) { + error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + } + // The first statement in the body of a constructor (excluding prologue directives) must be a super call + // if both of the following are true: // - The containing class is a derived class. // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); + // Skip past any prologue directives to find the first statement + // to ensure that it was a super call. if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 192 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + var superCallStatement; + for (var _i = 0; _i < statements.length; _i++) { + var statement = statements[_i]; + if (statement.kind === 193 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { + superCallStatement = statement; + break; + } + if (!ts.isPrologueDirective(statement)) { + break; + } + } + if (!superCallStatement) { 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 { // In such a required super call, it is a compile-time error for argument expressions to reference this. - markThisReferencesAsErrors(statements[0].expression); + markThisReferencesAsErrors(superCallStatement.expression); } } } - else { + else if (baseConstructorType !== nullType) { error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -22037,7 +22484,7 @@ var ts; if (produceDiagnostics) { // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 142 /* GetAccessor */) { + if (node.kind === 143 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } @@ -22045,7 +22492,7 @@ var ts; if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 142 /* GetAccessor */ ? 143 /* SetAccessor */ : 142 /* GetAccessor */; + var otherKind = node.kind === 143 /* GetAccessor */ ? 144 /* SetAccessor */ : 143 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { @@ -22141,9 +22588,9 @@ var ts; var signaturesToCheck; // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 212 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 144 /* CallSignature */ || signatureDeclarationNode.kind === 145 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 144 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 145 /* CallSignature */ || signatureDeclarationNode.kind === 146 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 145 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -22161,7 +22608,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 212 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 213 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported flags |= 1 /* Export */; @@ -22247,7 +22694,7 @@ var ts; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 140 /* MethodDeclaration */ || node.kind === 139 /* MethodSignature */); + ts.Debug.assert(node.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */); ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -22283,7 +22730,7 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 212 /* InterfaceDeclaration */ || node.parent.kind === 152 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 213 /* InterfaceDeclaration */ || node.parent.kind === 153 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -22294,7 +22741,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 210 /* FunctionDeclaration */ || node.kind === 140 /* MethodDeclaration */ || node.kind === 139 /* MethodSignature */ || node.kind === 141 /* Constructor */) { + if (node.kind === 211 /* FunctionDeclaration */ || node.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */ || node.kind === 142 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -22378,8 +22825,6 @@ var ts; if (!produceDiagnostics) { return; } - // Exports should be checked only if enclosing module contains both exported and non exported declarations. - // In case if all declarations are non-exported check is unnecessary. // if localSymbol is defined on node then node itself is exported - check is required var symbol = node.localSymbol; if (!symbol) { @@ -22397,38 +22842,55 @@ var ts; } // we use SymbolFlags.ExportValue, SymbolFlags.ExportType and SymbolFlags.ExportNamespace // to denote disjoint declarationSpaces (without making new enum type). - var exportedDeclarationSpaces = 0; - var nonExportedDeclarationSpaces = 0; - ts.forEach(symbol.declarations, function (d) { + var exportedDeclarationSpaces = 0 /* None */; + var nonExportedDeclarationSpaces = 0 /* None */; + var defaultExportedDeclarationSpaces = 0 /* None */; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - if (getEffectiveDeclarationFlags(d, 1 /* Export */)) { - exportedDeclarationSpaces |= declarationSpaces; + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* Export */ | 1024 /* Default */); + if (effectiveDeclarationFlags & 1 /* Export */) { + if (effectiveDeclarationFlags & 1024 /* Default */) { + defaultExportedDeclarationSpaces |= declarationSpaces; + } + else { + exportedDeclarationSpaces |= declarationSpaces; + } } else { nonExportedDeclarationSpaces |= declarationSpaces; } - }); - var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; - if (commonDeclarationSpace) { + } + // Spaces for anyting not declared a 'default export'. + var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; + var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; + if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) { // declaration spaces for exported and non-exported declarations intersect - ts.forEach(symbol.declarations, function (d) { - if (getDeclarationSpaces(d) & commonDeclarationSpace) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var d = _c[_b]; + var declarationSpaces = getDeclarationSpaces(d); + // Only error on the declarations that conributed to the intersecting spaces. + if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { + error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name)); + } + else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) { 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 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 215 /* ModuleDeclaration */: - return d.name.kind === 8 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ + case 216 /* ModuleDeclaration */: + return d.name.kind === 9 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -22505,7 +22967,7 @@ var ts; * The runtime behavior of the `await` keyword. */ function getAwaitedType(type) { - return checkAwaitedType(type, undefined, undefined); + return checkAwaitedType(type, /*location*/ undefined, /*message*/ undefined); } function checkAwaitedType(type, location, message) { return checkAwaitedTypeWorker(type); @@ -22672,22 +23134,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 135 /* Parameter */: + case 136 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -22700,9 +23162,9 @@ var ts; // When we are emitting type metadata for decorators, we need to try to check the type // as if it were an expression so that we can emit the type in a value position when we // serialize the type metadata. - if (node && node.kind === 148 /* TypeReference */) { + if (node && node.kind === 149 /* TypeReference */) { var root = getFirstIdentifier(node.typeName); - var rootSymbol = resolveName(root, root.text, 107455 /* Value */, undefined, undefined); + var rootSymbol = resolveName(root, root.text, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); if (rootSymbol && rootSymbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { markAliasSymbolAsReferenced(rootSymbol); } @@ -22714,19 +23176,19 @@ var ts; */ function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 135 /* Parameter */: + case 136 /* Parameter */: checkTypeNodeAsExpression(node.type); break; - case 140 /* MethodDeclaration */: + case 141 /* MethodDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 142 /* GetAccessor */: + case 143 /* GetAccessor */: checkTypeNodeAsExpression(node.type); break; - case 143 /* SetAccessor */: + case 144 /* SetAccessor */: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -22755,25 +23217,25 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 140 /* MethodDeclaration */: + case 141 /* MethodDeclaration */: checkParameterTypeAnnotationsAsExpressions(node); // fall-through - case 143 /* SetAccessor */: - case 142 /* GetAccessor */: - case 138 /* PropertyDeclaration */: - case 135 /* Parameter */: + case 144 /* SetAccessor */: + case 143 /* GetAccessor */: + case 139 /* PropertyDeclaration */: + case 136 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 135 /* Parameter */) { + if (node.kind === 136 /* Parameter */) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -22799,7 +23261,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 134 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -22848,11 +23310,11 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 189 /* Block */) { + if (node.kind === 190 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 216 /* ModuleBlock */) { + if (ts.isFunctionBlock(node) || node.kind === 217 /* ModuleBlock */) { checkFunctionAndClassExpressionBodies(node); } } @@ -22871,12 +23333,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 138 /* PropertyDeclaration */ || - node.kind === 137 /* PropertySignature */ || - node.kind === 140 /* MethodDeclaration */ || - node.kind === 139 /* MethodSignature */ || - node.kind === 142 /* GetAccessor */ || - node.kind === 143 /* SetAccessor */) { + if (node.kind === 139 /* PropertyDeclaration */ || + node.kind === 138 /* PropertySignature */ || + node.kind === 141 /* MethodDeclaration */ || + node.kind === 140 /* MethodSignature */ || + node.kind === 143 /* GetAccessor */ || + node.kind === 144 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -22885,7 +23347,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 135 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 136 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -22901,7 +23363,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration_1 = node.kind !== 66 /* Identifier */; + var isDeclaration_1 = node.kind !== 67 /* Identifier */; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -22924,7 +23386,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 66 /* Identifier */; + var isDeclaration_2 = node.kind !== 67 /* Identifier */; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -22938,12 +23400,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 215 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 216 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 245 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 246 /* SourceFile */ && ts.isExternalModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -22978,27 +23440,27 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 208 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 209 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); if (symbol.flags & 1 /* FunctionScopedVariable */) { - var localDeclarationSymbol = resolveName(node, node.name.text, 3 /* Variable */, undefined, undefined); + var localDeclarationSymbol = resolveName(node, node.name.text, 3 /* Variable */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 209 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 190 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 191 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 189 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 216 /* ModuleBlock */ || - container.kind === 215 /* ModuleDeclaration */ || - container.kind === 245 /* SourceFile */); + (container.kind === 190 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 217 /* ModuleBlock */ || + container.kind === 216 /* ModuleDeclaration */ || + container.kind === 246 /* 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 @@ -23013,18 +23475,18 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 135 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 136 /* Parameter */) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 66 /* Identifier */) { + if (n.kind === 67 /* Identifier */) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 135 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 136 /* Parameter */) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -23050,7 +23512,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -23061,14 +23523,14 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 135 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 136 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { if (node.initializer) { - checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); + checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } return; @@ -23078,7 +23540,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer if (node.initializer) { - checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); + checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } } @@ -23090,13 +23552,13 @@ var ts; 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); + checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } } - if (node.kind !== 138 /* PropertyDeclaration */ && node.kind !== 137 /* PropertySignature */) { + if (node.kind !== 139 /* PropertyDeclaration */ && node.kind !== 138 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 208 /* VariableDeclaration */ || node.kind === 160 /* BindingElement */) { + if (node.kind === 209 /* VariableDeclaration */ || node.kind === 161 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -23119,7 +23581,7 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 162 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 163 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -23157,12 +23619,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 210 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer.kind === 210 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -23182,14 +23644,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer.kind === 210 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 161 /* ArrayLiteralExpression */ || varExpr.kind === 162 /* ObjectLiteralExpression */) { + if (varExpr.kind === 162 /* ArrayLiteralExpression */ || varExpr.kind === 163 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -23197,14 +23659,14 @@ var ts; } else { var leftType = checkExpression(varExpr); - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, + checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); // iteratedType will be undefined if the rightType was missing properties/signatures // required to get its iteratedType (like [Symbol.iterator] or next). This may be // because we accessed properties from anyType, or it may have led to an error inside // getElementTypeOfIterable. if (iteratedType) { - checkTypeAssignableTo(iteratedType, leftType, varExpr, undefined); + checkTypeAssignableTo(iteratedType, leftType, varExpr, /*headMessage*/ undefined); } } } @@ -23218,7 +23680,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer.kind === 210 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -23232,7 +23694,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 161 /* ArrayLiteralExpression */ || varExpr.kind === 162 /* ObjectLiteralExpression */) { + if (varExpr.kind === 162 /* ArrayLiteralExpression */ || varExpr.kind === 163 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */)) { @@ -23261,7 +23723,7 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { if (isTypeAny(inputType)) { @@ -23404,8 +23866,8 @@ var ts; if ((type.flags & 4096 /* Reference */) && type.target === globalIterableIteratorType) { return type.typeArguments[0]; } - return getElementTypeOfIterable(type, undefined) || - getElementTypeOfIterator(type, undefined); + return getElementTypeOfIterable(type, /*errorNode*/ undefined) || + getElementTypeOfIterator(type, /*errorNode*/ undefined); } /** * This function does the following steps: @@ -23428,7 +23890,7 @@ var ts; ts.Debug.assert(languageVersion < 2 /* ES6 */); // After we remove all types that are StringLike, we will know if there was a string constituent // based on whether the remaining type is the same as the initial type. - var arrayType = removeTypesFromUnionType(arrayOrStringType, 258 /* StringLike */, true, true); + var arrayType = removeTypesFromUnionType(arrayOrStringType, 258 /* StringLike */, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); var hasStringConstituent = arrayOrStringType !== arrayType; var reportedError = false; if (hasStringConstituent) { @@ -23471,7 +23933,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 142 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 143 /* SetAccessor */))); + return !!(node.kind === 143 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144 /* SetAccessor */))); } function checkReturnStatement(node) { // Grammar checking @@ -23494,10 +23956,10 @@ var ts; // for generators. return; } - if (func.kind === 143 /* SetAccessor */) { + if (func.kind === 144 /* SetAccessor */) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 141 /* Constructor */) { + else if (func.kind === 142 /* Constructor */) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -23533,7 +23995,7 @@ var ts; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 239 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 240 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -23545,14 +24007,14 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 238 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 239 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { // check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -23566,7 +24028,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 204 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 205 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -23596,7 +24058,7 @@ var ts; if (catchClause) { // Grammar checking if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 66 /* Identifier */) { + if (catchClause.variableDeclaration.name.kind !== 67 /* Identifier */) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -23671,7 +24133,7 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 133 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 134 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -23842,7 +24304,7 @@ var ts; // type declaration, derived and base resolve to the same symbol even in the case of generic classes. if (derived === base) { // derived class inherits base without override/redeclaration - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 211 /* ClassDeclaration */); + var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212 /* ClassDeclaration */); // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. @@ -23890,7 +24352,7 @@ var ts; } } function isAccessor(kind) { - return kind === 142 /* GetAccessor */ || kind === 143 /* SetAccessor */; + return kind === 143 /* GetAccessor */ || kind === 144 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -23960,7 +24422,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 212 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -23981,7 +24443,7 @@ var ts; if (symbol && symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 211 /* ClassDeclaration */ && !ts.isInAmbientContext(declaration)) { + if (declaration.kind === 212 /* ClassDeclaration */ && !ts.isInAmbientContext(declaration)) { error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); break; } @@ -24014,32 +24476,12 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 133 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 134 /* ComputedPropertyName */ && 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); - if (autoValue === undefined) { - if (enumIsConst) { - error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); - } - else if (!ambient) { - // Only here do we need to check that the initializer is assignable to the enum type. - // If it is a constant value (not undefined), it is syntactically constrained to be a number. - // Also, we do not need to check this for ambients because there is already - // a syntax error if it is not a constant. - checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, 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); - } - } + autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); } else if (ambient && !enumIsConst) { autoValue = undefined; @@ -24050,22 +24492,48 @@ var ts; }); nodeLinks.flags |= 8192 /* EnumValuesComputed */; } - function getConstantValueForEnumMemberInitializer(initializer) { - return evalConstant(initializer); + function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { + // Controls if error should be reported after evaluation of constant value is completed + // Can be false if another more precise error was already reported during evaluation. + var reportError = true; + var value = evalConstant(initializer); + if (reportError) { + if (value === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (!ambient) { + // Only here do we need to check that the initializer is assignable to the enum type. + // If it is a constant value (not undefined), it is syntactically constrained to be a number. + // Also, we do not need to check this for ambients because there is already + // a syntax error if it is not a constant. + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined); + } + } + else if (enumIsConst) { + if (isNaN(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } + } + return value; function evalConstant(e) { switch (e.kind) { - case 176 /* PrefixUnaryExpression */: - var value = evalConstant(e.operand); - if (value === undefined) { + case 177 /* PrefixUnaryExpression */: + var value_1 = evalConstant(e.operand); + if (value_1 === undefined) { return undefined; } switch (e.operator) { - case 34 /* PlusToken */: return value; - case 35 /* MinusToken */: return -value; - case 48 /* TildeToken */: return ~value; + case 35 /* PlusToken */: return value_1; + case 36 /* MinusToken */: return -value_1; + case 49 /* TildeToken */: return ~value_1; } return undefined; - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -24075,41 +24543,41 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 45 /* BarToken */: return left | right; - case 44 /* AmpersandToken */: return left & right; - case 42 /* GreaterThanGreaterThanToken */: return left >> right; - case 43 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; - case 41 /* LessThanLessThanToken */: return left << right; - case 46 /* CaretToken */: return left ^ right; - case 36 /* AsteriskToken */: return left * right; - case 37 /* SlashToken */: return left / right; - case 34 /* PlusToken */: return left + right; - case 35 /* MinusToken */: return left - right; - case 38 /* PercentToken */: return left % right; + case 46 /* BarToken */: return left | right; + case 45 /* AmpersandToken */: return left & right; + case 43 /* GreaterThanGreaterThanToken */: return left >> right; + case 44 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; + case 42 /* LessThanLessThanToken */: return left << right; + case 47 /* CaretToken */: return left ^ right; + case 37 /* AsteriskToken */: return left * right; + case 38 /* SlashToken */: return left / right; + case 35 /* PlusToken */: return left + right; + case 36 /* MinusToken */: return left - right; + case 39 /* PercentToken */: return left % right; } return undefined; - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: return +e.text; - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return evalConstant(e.expression); - case 66 /* Identifier */: - case 164 /* ElementAccessExpression */: - case 163 /* PropertyAccessExpression */: + case 67 /* Identifier */: + case 165 /* ElementAccessExpression */: + case 164 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType; + var enumType_1; var propertyName; - if (e.kind === 66 /* Identifier */) { + if (e.kind === 67 /* Identifier */) { // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work. // instead pick current enum type and later try to fetch member from the type - enumType = currentType; + enumType_1 = currentType; propertyName = e.text; } else { var expression; - if (e.kind === 164 /* ElementAccessExpression */) { + if (e.kind === 165 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8 /* StringLiteral */) { + e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; } expression = e.expression; @@ -24122,26 +24590,26 @@ var ts; // expression part in ElementAccess\PropertyAccess should be either identifier or dottedName var current = expression; while (current) { - if (current.kind === 66 /* Identifier */) { + if (current.kind === 67 /* Identifier */) { break; } - else if (current.kind === 163 /* PropertyAccessExpression */) { + else if (current.kind === 164 /* PropertyAccessExpression */) { current = current.expression; } else { return undefined; } } - enumType = checkExpression(expression); + enumType_1 = checkExpression(expression); // allow references to constant members of other enums - if (!(enumType.symbol && (enumType.symbol.flags & 384 /* Enum */))) { + if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384 /* Enum */))) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + var property = getPropertyOfObjectType(enumType_1, propertyName); if (!property || !(property.flags & 8 /* EnumMember */)) { return undefined; } @@ -24152,6 +24620,8 @@ var ts; } // illegal case: forward reference if (!isDefinedBefore(propertyDecl, member)) { + reportError = false; + error(e, ts.Diagnostics.A_member_initializer_in_a_const_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_const_enums); return undefined; } return getNodeLinks(propertyDecl).enumMemberValue; @@ -24194,7 +24664,7 @@ var ts; var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 214 /* EnumDeclaration */) { + if (declaration.kind !== 215 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -24217,8 +24687,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 211 /* ClassDeclaration */ || - (declaration.kind === 210 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 212 /* ClassDeclaration */ || + (declaration.kind === 211 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -24241,7 +24711,7 @@ var ts; function checkModuleDeclaration(node) { if (produceDiagnostics) { // Grammar checking - var isAmbientExternalModule = node.name.kind === 8 /* StringLiteral */; + var isAmbientExternalModule = node.name.kind === 9 /* StringLiteral */; var contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -24250,7 +24720,7 @@ var ts; return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 8 /* StringLiteral */) { + if (!ts.isInAmbientContext(node) && node.name.kind === 9 /* StringLiteral */) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } @@ -24274,7 +24744,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 211 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 212 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -24294,28 +24764,28 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 132 /* QualifiedName */) { + if (node.kind === 133 /* QualifiedName */) { node = node.left; } - else if (node.kind === 163 /* PropertyAccessExpression */) { + else if (node.kind === 164 /* PropertyAccessExpression */) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 66 /* Identifier */); + ts.Debug.assert(node.kind === 67 /* Identifier */); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8 /* StringLiteral */) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 9 /* StringLiteral */) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 216 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; - if (node.parent.kind !== 245 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 225 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 217 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; + if (node.parent.kind !== 246 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 226 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -24338,7 +24808,7 @@ var ts; (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 227 /* ExportSpecifier */ ? + var message = node.kind === 228 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -24365,7 +24835,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -24402,7 +24872,7 @@ var ts; } } else { - if (languageVersion >= 2 /* ES6 */) { + if (languageVersion >= 2 /* ES6 */ && !ts.isInAmbientContext(node)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); } @@ -24422,8 +24892,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 216 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; - if (node.parent.kind !== 245 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 217 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; + if (node.parent.kind !== 246 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -24437,7 +24907,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 245 /* SourceFile */ && node.parent.kind !== 216 /* ModuleBlock */ && node.parent.kind !== 215 /* ModuleDeclaration */) { + if (node.parent.kind !== 246 /* SourceFile */ && node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 216 /* ModuleDeclaration */) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -24452,8 +24922,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 245 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 215 /* ModuleDeclaration */ && container.name.kind === 66 /* Identifier */) { + var container = node.parent.kind === 246 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 216 /* ModuleDeclaration */ && container.name.kind === 67 /* Identifier */) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -24461,7 +24931,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 66 /* Identifier */) { + if (node.expression.kind === 67 /* Identifier */) { markExportAsReferenced(node); } else { @@ -24480,10 +24950,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 245 /* SourceFile */) { + if (node.kind === 246 /* SourceFile */) { return node.statements; } - if (node.kind === 215 /* ModuleDeclaration */ && node.body.kind === 216 /* ModuleBlock */) { + if (node.kind === 216 /* ModuleDeclaration */ && node.body.kind === 217 /* ModuleBlock */) { return node.body.statements; } return emptyArray; @@ -24522,118 +24992,118 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessivly // hitting the cancellation token on every node we check. switch (kind) { - case 215 /* ModuleDeclaration */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: + case 216 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: return checkTypeParameter(node); - case 135 /* Parameter */: + case 136 /* Parameter */: return checkParameter(node); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return checkPropertyDeclaration(node); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 146 /* IndexSignature */: + case 147 /* IndexSignature */: return checkSignatureDeclaration(node); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return checkMethodDeclaration(node); - case 141 /* Constructor */: + case 142 /* Constructor */: return checkConstructorDeclaration(node); - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return checkAccessorDeclaration(node); - case 148 /* TypeReference */: + case 149 /* TypeReference */: return checkTypeReferenceNode(node); - case 147 /* TypePredicate */: + case 148 /* TypePredicate */: return checkTypePredicate(node); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return checkTypeQuery(node); - case 152 /* TypeLiteral */: + case 153 /* TypeLiteral */: return checkTypeLiteral(node); - case 153 /* ArrayType */: + case 154 /* ArrayType */: return checkArrayType(node); - case 154 /* TupleType */: + case 155 /* TupleType */: return checkTupleType(node); - case 155 /* UnionType */: - case 156 /* IntersectionType */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: return checkSourceElement(node.type); - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 189 /* Block */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return checkBlock(node); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return checkVariableStatement(node); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: return checkExpressionStatement(node); - case 193 /* IfStatement */: + case 194 /* IfStatement */: return checkIfStatement(node); - case 194 /* DoStatement */: + case 195 /* DoStatement */: return checkDoStatement(node); - case 195 /* WhileStatement */: + case 196 /* WhileStatement */: return checkWhileStatement(node); - case 196 /* ForStatement */: + case 197 /* ForStatement */: return checkForStatement(node); - case 197 /* ForInStatement */: + case 198 /* ForInStatement */: return checkForInStatement(node); - case 198 /* ForOfStatement */: + case 199 /* ForOfStatement */: return checkForOfStatement(node); - case 199 /* ContinueStatement */: - case 200 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 201 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: return checkReturnStatement(node); - case 202 /* WithStatement */: + case 203 /* WithStatement */: return checkWithStatement(node); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: return checkSwitchStatement(node); - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return checkLabeledStatement(node); - case 205 /* ThrowStatement */: + case 206 /* ThrowStatement */: return checkThrowStatement(node); - case 206 /* TryStatement */: + case 207 /* TryStatement */: return checkTryStatement(node); - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 160 /* BindingElement */: + case 161 /* BindingElement */: return checkBindingElement(node); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return checkClassDeclaration(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: return checkImportDeclaration(node); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return checkExportDeclaration(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return checkExportAssignment(node); - case 191 /* EmptyStatement */: + case 192 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 207 /* DebuggerStatement */: + case 208 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 228 /* MissingDeclaration */: + case 229 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -24648,95 +25118,95 @@ var ts; // Delaying the type check of the body ensures foo has been assigned a type. function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: ts.forEach(node.members, checkSourceElement); break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 202 /* WithStatement */: + case 203 /* WithStatement */: checkFunctionAndClassExpressionBodies(node.expression); break; - case 136 /* Decorator */: - case 135 /* Parameter */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: - case 160 /* BindingElement */: - case 161 /* ArrayLiteralExpression */: - case 162 /* ObjectLiteralExpression */: - case 242 /* PropertyAssignment */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 167 /* TaggedTemplateExpression */: - case 180 /* TemplateExpression */: - case 187 /* TemplateSpan */: - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: - case 169 /* ParenthesizedExpression */: - case 173 /* TypeOfExpression */: - case 174 /* VoidExpression */: - case 175 /* AwaitExpression */: - case 172 /* DeleteExpression */: - case 176 /* PrefixUnaryExpression */: - case 177 /* PostfixUnaryExpression */: - case 178 /* BinaryExpression */: - case 179 /* ConditionalExpression */: - case 182 /* SpreadElementExpression */: - case 181 /* YieldExpression */: - case 189 /* Block */: - case 216 /* ModuleBlock */: - case 190 /* VariableStatement */: - case 192 /* ExpressionStatement */: - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 199 /* ContinueStatement */: - case 200 /* BreakStatement */: - case 201 /* ReturnStatement */: - case 203 /* SwitchStatement */: - case 217 /* CaseBlock */: - case 238 /* CaseClause */: - case 239 /* DefaultClause */: - case 204 /* LabeledStatement */: - case 205 /* ThrowStatement */: - case 206 /* TryStatement */: - case 241 /* CatchClause */: - case 208 /* VariableDeclaration */: - case 209 /* VariableDeclarationList */: - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 244 /* EnumMember */: - case 224 /* ExportAssignment */: - case 245 /* SourceFile */: - case 237 /* JsxExpression */: - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: - case 235 /* JsxAttribute */: - case 236 /* JsxSpreadAttribute */: - case 232 /* JsxOpeningElement */: + case 137 /* Decorator */: + case 136 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: + case 161 /* BindingElement */: + case 162 /* ArrayLiteralExpression */: + case 163 /* ObjectLiteralExpression */: + case 243 /* PropertyAssignment */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 168 /* TaggedTemplateExpression */: + case 181 /* TemplateExpression */: + case 188 /* TemplateSpan */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: + case 170 /* ParenthesizedExpression */: + case 174 /* TypeOfExpression */: + case 175 /* VoidExpression */: + case 176 /* AwaitExpression */: + case 173 /* DeleteExpression */: + case 177 /* PrefixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: + case 179 /* BinaryExpression */: + case 180 /* ConditionalExpression */: + case 183 /* SpreadElementExpression */: + case 182 /* YieldExpression */: + case 190 /* Block */: + case 217 /* ModuleBlock */: + case 191 /* VariableStatement */: + case 193 /* ExpressionStatement */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 200 /* ContinueStatement */: + case 201 /* BreakStatement */: + case 202 /* ReturnStatement */: + case 204 /* SwitchStatement */: + case 218 /* CaseBlock */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: + case 205 /* LabeledStatement */: + case 206 /* ThrowStatement */: + case 207 /* TryStatement */: + case 242 /* CatchClause */: + case 209 /* VariableDeclaration */: + case 210 /* VariableDeclarationList */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 245 /* EnumMember */: + case 225 /* ExportAssignment */: + case 246 /* SourceFile */: + case 238 /* JsxExpression */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: + case 236 /* JsxAttribute */: + case 237 /* JsxSpreadAttribute */: + case 233 /* JsxOpeningElement */: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -24822,7 +25292,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 202 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 203 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -24845,25 +25315,25 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -24872,13 +25342,16 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 170 /* FunctionExpression */: + case 171 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); } break; } + if (ts.introducesArgumentsExoticObject(location)) { + copySymbol(argumentsSymbol, meaning); + } memberFlags = location.flags; location = location.parent; } @@ -24912,43 +25385,43 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 66 /* Identifier */ && + return name.kind === 67 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 134 /* TypeParameter */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 214 /* EnumDeclaration */: + case 135 /* TypeParameter */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 215 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 132 /* QualifiedName */) { + while (node.parent && node.parent.kind === 133 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 148 /* TypeReference */; + return node.parent && node.parent.kind === 149 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 163 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 164 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 185 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 186 /* ExpressionWithTypeArguments */; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 132 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 133 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 218 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 219 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 224 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 225 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -24960,11 +25433,11 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 224 /* ExportAssignment */) { + if (entityName.parent.kind === 225 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 163 /* PropertyAccessExpression */) { + if (entityName.kind !== 164 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -24974,11 +25447,13 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 185 /* ExpressionWithTypeArguments */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 186 /* ExpressionWithTypeArguments */ ? 793056 /* Type */ : 1536 /* Namespace */; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 232 /* JsxOpeningElement */) || (entityName.parent.kind === 231 /* JsxSelfClosingElement */)) { + else if ((entityName.parent.kind === 233 /* JsxOpeningElement */) || + (entityName.parent.kind === 232 /* JsxSelfClosingElement */) || + (entityName.parent.kind === 235 /* JsxClosingElement */)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { @@ -24986,20 +25461,20 @@ var ts; // Missing entity name. return undefined; } - if (entityName.kind === 66 /* Identifier */) { + if (entityName.kind === 67 /* Identifier */) { // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 163 /* PropertyAccessExpression */) { + else if (entityName.kind === 164 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 132 /* QualifiedName */) { + else if (entityName.kind === 133 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -25008,22 +25483,22 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 148 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 149 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 235 /* JsxAttribute */) { + else if (entityName.parent.kind === 236 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 147 /* TypePredicate */) { - return resolveEntityName(entityName, 1 /* FunctionScopedVariable */); + if (entityName.parent.kind === 148 /* TypePredicate */) { + return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } - function getSymbolInfo(node) { + function getSymbolAtLocation(node) { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -25032,39 +25507,50 @@ var ts; // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } - if (node.kind === 66 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 224 /* ExportAssignment */ - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + if (node.kind === 67 /* Identifier */) { + if (isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 225 /* ExportAssignment */ + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); + } + else if (node.parent.kind === 161 /* BindingElement */ && + node.parent.parent.kind === 159 /* ObjectBindingPattern */ && + node === node.parent.propertyName) { + var typeOfPattern = getTypeOfNode(node.parent.parent); + var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); + if (propertyDeclaration) { + return propertyDeclaration; + } + } } switch (node.kind) { - case 66 /* Identifier */: - case 163 /* PropertyAccessExpression */: - case 132 /* QualifiedName */: + case 67 /* Identifier */: + case 164 /* PropertyAccessExpression */: + case 133 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: var type = checkExpression(node); return type.symbol; - case 118 /* ConstructorKeyword */: + case 119 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 141 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 142 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 219 /* ImportDeclaration */ || node.parent.kind === 225 /* ExportDeclaration */) && + ((node.parent.kind === 220 /* ImportDeclaration */ || node.parent.kind === 226 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Fall through - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 164 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -25081,7 +25567,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 243 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 244 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */); } return undefined; @@ -25103,28 +25589,28 @@ var ts; return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; } if (isTypeDeclaration(node)) { - // In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration + // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); } if (ts.isDeclaration(node)) { - // In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration + // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getTypeOfSymbol(symbol); } if (ts.isDeclarationName(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); return symbol && getTypeOfSymbol(symbol); } if (ts.isBindingPattern(node)) { return getTypeForVariableLikeDeclaration(node.parent); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } @@ -25195,11 +25681,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 245 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 246 /* SourceFile */) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 215 /* ModuleDeclaration */ || n.kind === 214 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 216 /* ModuleDeclaration */ || n.kind === 215 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -25214,11 +25700,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 189 /* Block */: - case 217 /* CaseBlock */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 190 /* Block */: + case 218 /* CaseBlock */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: return true; } return false; @@ -25229,7 +25715,7 @@ var ts; if (links.isNestedRedeclaration === undefined) { var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); links.isNestedRedeclaration = isStatementWithLocals(container) && - !!resolveName(container.parent, symbol.name, 107455 /* Value */, undefined, undefined); + !!resolveName(container.parent, symbol.name, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); } return links.isNestedRedeclaration; } @@ -25248,22 +25734,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 218 /* ImportEqualsDeclaration */: - case 220 /* ImportClause */: - case 221 /* NamespaceImport */: - case 223 /* ImportSpecifier */: - case 227 /* ExportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportClause */: + case 222 /* NamespaceImport */: + case 224 /* ImportSpecifier */: + case 228 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 224 /* ExportAssignment */: - return node.expression && node.expression.kind === 66 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 225 /* ExportAssignment */: + return node.expression && node.expression.kind === 67 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 245 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 246 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -25276,7 +25762,11 @@ var ts; return true; } // const enums and modules that contain only const enums are not considered values from the emit perespective - return target !== unknownSymbol && target && target.flags & 107455 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target); + // unless 'preserveConstEnums' option is set to true + return target !== unknownSymbol && + target && + target.flags & 107455 /* Value */ && + (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -25321,7 +25811,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 244 /* EnumMember */) { + if (node.kind === 245 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -25336,14 +25826,16 @@ var ts; function isFunctionType(type) { return type.flags & 80896 /* ObjectType */ && getSignaturesOfType(type, 0 /* Call */).length > 0; } - function getTypeReferenceSerializationKind(node) { + function getTypeReferenceSerializationKind(typeName) { // Resolve the symbol as a value to ensure the type can be reached at runtime during emit. - var symbol = resolveEntityName(node.typeName, 107455 /* Value */, true); - var constructorType = symbol ? getTypeOfSymbol(symbol) : undefined; + var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true); + var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; if (constructorType && isConstructorType(constructorType)) { return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; } - var type = getTypeFromTypeNode(node); + // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. + var typeSymbol = resolveEntityName(typeName, 793056 /* Type */, /*ignoreErrors*/ true); + var type = getDeclaredTypeOfSymbol(typeSymbol); if (type === unknownType) { return ts.TypeReferenceSerializationKind.Unknown; } @@ -25365,7 +25857,7 @@ var ts; else if (allConstituentTypesHaveKind(type, 8192 /* Tuple */)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, 4194304 /* ESSymbol */)) { + else if (allConstituentTypesHaveKind(type, 16777216 /* ESSymbol */)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -25400,7 +25892,7 @@ var ts; function getReferencedValueSymbol(reference) { return getNodeLinks(reference).resolvedSymbol || resolveName(reference, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, - /*nodeNotFoundMessage*/ undefined, undefined); + /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); } function getReferencedValueDeclaration(reference) { ts.Debug.assert(!ts.nodeIsSynthesized(reference)); @@ -25409,13 +25901,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 160 /* BindingElement */ || (n.parent.kind === 208 /* VariableDeclaration */ && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 161 /* BindingElement */ || (n.parent.kind === 209 /* VariableDeclaration */ && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, undefined, undefined); + resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); var isLetOrConst = symbol && (symbol.flags & 2 /* BlockScopedVariable */) && - symbol.valueDeclaration.parent.kind !== 241 /* CatchClause */; + symbol.valueDeclaration.parent.kind !== 242 /* CatchClause */; if (isLetOrConst) { // side-effect of calling this method: // assign id to symbol if it was not yet set @@ -25457,7 +25949,8 @@ var ts; collectLinkedAliases: collectLinkedAliases, getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, - getTypeReferenceSerializationKind: getTypeReferenceSerializationKind + getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, + isOptionalParameter: isOptionalParameter }; } function initializeTypeChecker() { @@ -25477,7 +25970,7 @@ var ts; getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types - globalArrayType = getGlobalType("Array", 1); + globalArrayType = getGlobalType("Array", /*arity*/ 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); globalStringType = getGlobalType("String"); @@ -25489,10 +25982,10 @@ var ts; getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); }); getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); - getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); - getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); - tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056 /* Type */, undefined) && getGlobalPromiseType(); }); - getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); + getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", /*arity*/ 1); }); + getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", /*arity*/ 1); }); + tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); }); + getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); @@ -25503,9 +25996,9 @@ var ts; globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); globalESSymbolType = getGlobalType("Symbol"); globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", 1); - globalIteratorType = getGlobalType("Iterator", 1); - globalIterableIteratorType = getGlobalType("IterableIterator", 1); + globalIterableType = getGlobalType("Iterable", /*arity*/ 1); + globalIteratorType = getGlobalType("Iterator", /*arity*/ 1); + globalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1); } else { globalTemplateStringsArrayType = unknownType; @@ -25549,7 +26042,7 @@ var ts; else if (languageVersion < 1 /* ES5 */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } - else if (node.kind === 142 /* GetAccessor */ || node.kind === 143 /* SetAccessor */) { + else if (node.kind === 143 /* GetAccessor */ || node.kind === 144 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -25559,38 +26052,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 141 /* Constructor */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 146 /* IndexSignature */: - case 215 /* ModuleDeclaration */: - case 219 /* ImportDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 225 /* ExportDeclaration */: - case 224 /* ExportAssignment */: - case 135 /* Parameter */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 142 /* Constructor */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 147 /* IndexSignature */: + case 216 /* ModuleDeclaration */: + case 220 /* ImportDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 226 /* ExportDeclaration */: + case 225 /* ExportAssignment */: + case 136 /* Parameter */: break; - case 210 /* FunctionDeclaration */: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 115 /* AsyncKeyword */) && - node.parent.kind !== 216 /* ModuleBlock */ && node.parent.kind !== 245 /* SourceFile */) { + case 211 /* FunctionDeclaration */: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116 /* AsyncKeyword */) && + node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 190 /* VariableStatement */: - case 213 /* TypeAliasDeclaration */: - if (node.modifiers && node.parent.kind !== 216 /* ModuleBlock */ && node.parent.kind !== 245 /* SourceFile */) { + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 191 /* VariableStatement */: + case 214 /* TypeAliasDeclaration */: + if (node.modifiers && node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 214 /* EnumDeclaration */: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 71 /* ConstKeyword */) && - node.parent.kind !== 216 /* ModuleBlock */ && node.parent.kind !== 245 /* SourceFile */) { + case 215 /* EnumDeclaration */: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72 /* ConstKeyword */) && + node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -25605,14 +26098,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { - case 109 /* PublicKeyword */: - case 108 /* ProtectedKeyword */: - case 107 /* PrivateKeyword */: + case 110 /* PublicKeyword */: + case 109 /* ProtectedKeyword */: + case 108 /* PrivateKeyword */: var text = void 0; - if (modifier.kind === 109 /* PublicKeyword */) { + if (modifier.kind === 110 /* PublicKeyword */) { text = "public"; } - else if (modifier.kind === 108 /* ProtectedKeyword */) { + else if (modifier.kind === 109 /* ProtectedKeyword */) { text = "protected"; lastProtected = modifier; } @@ -25629,11 +26122,11 @@ var ts; else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 216 /* ModuleBlock */ || node.parent.kind === 245 /* SourceFile */) { + else if (node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256 /* Abstract */) { - if (modifier.kind === 107 /* PrivateKeyword */) { + if (modifier.kind === 108 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -25642,17 +26135,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 110 /* StaticKeyword */: + case 111 /* StaticKeyword */: if (flags & 128 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 216 /* ModuleBlock */ || node.parent.kind === 245 /* SourceFile */) { + else if (node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 135 /* Parameter */) { + else if (node.kind === 136 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256 /* Abstract */) { @@ -25661,7 +26154,7 @@ var ts; flags |= 128 /* Static */; lastStatic = modifier; break; - case 79 /* ExportKeyword */: + case 80 /* ExportKeyword */: if (flags & 1 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -25674,42 +26167,42 @@ var ts; else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.kind === 212 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 135 /* Parameter */) { + else if (node.kind === 136 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; break; - case 119 /* DeclareKeyword */: + case 120 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.kind === 212 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 135 /* Parameter */) { + else if (node.kind === 136 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 216 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; lastDeclare = modifier; break; - case 112 /* AbstractKeyword */: + case 113 /* AbstractKeyword */: if (flags & 256 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 211 /* ClassDeclaration */) { - if (node.kind !== 140 /* MethodDeclaration */) { + if (node.kind !== 212 /* ClassDeclaration */) { + if (node.kind !== 141 /* MethodDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 211 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { + if (!(node.parent.kind === 212 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128 /* Static */) { @@ -25721,14 +26214,14 @@ var ts; } flags |= 256 /* Abstract */; break; - case 115 /* AsyncKeyword */: + case 116 /* AsyncKeyword */: if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 135 /* Parameter */) { + else if (node.kind === 136 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512 /* Async */; @@ -25736,7 +26229,7 @@ var ts; break; } } - if (node.kind === 141 /* Constructor */) { + if (node.kind === 142 /* Constructor */) { if (flags & 128 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -25754,10 +26247,10 @@ var ts; } return; } - else if ((node.kind === 219 /* ImportDeclaration */ || node.kind === 218 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 220 /* ImportDeclaration */ || node.kind === 219 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 135 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 136 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512 /* Async */) { @@ -25769,10 +26262,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 140 /* MethodDeclaration */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -25820,16 +26313,14 @@ var ts; return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); } } - else if (parameter.questionToken || parameter.initializer) { + else if (parameter.questionToken) { seenOptionalParameter = true; - if (parameter.questionToken && parameter.initializer) { + if (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); - } + else if (seenOptionalParameter && !parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); } } } @@ -25840,7 +26331,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 171 /* ArrowFunction */) { + if (node.kind === 172 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -25875,7 +26366,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 127 /* StringKeyword */ && parameter.type.kind !== 125 /* NumberKeyword */) { + if (parameter.type.kind !== 128 /* StringKeyword */ && parameter.type.kind !== 126 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -25908,7 +26399,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 184 /* OmittedExpression */) { + if (arg.kind === 185 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -25935,7 +26426,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 80 /* ExtendsKeyword */) { + if (heritageClause.token === 81 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -25948,7 +26439,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 103 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 104 /* ImplementsKeyword */); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -25964,14 +26455,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 80 /* ExtendsKeyword */) { + if (heritageClause.token === 81 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 103 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 104 /* ImplementsKeyword */); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } // Grammar checking heritageClause inside class declaration @@ -25982,19 +26473,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 133 /* ComputedPropertyName */) { + if (node.kind !== 134 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 178 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 23 /* CommaToken */) { + if (computedPropertyName.expression.kind === 179 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 210 /* FunctionDeclaration */ || - node.kind === 170 /* FunctionExpression */ || - node.kind === 140 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 211 /* FunctionDeclaration */ || + node.kind === 171 /* FunctionExpression */ || + node.kind === 141 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -26020,8 +26511,8 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_16 = prop.name; - if (prop.kind === 184 /* OmittedExpression */ || - name_16.kind === 133 /* ComputedPropertyName */) { + if (prop.kind === 185 /* OmittedExpression */ || + name_16.kind === 134 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name_16); continue; @@ -26035,21 +26526,21 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 242 /* PropertyAssignment */ || prop.kind === 243 /* ShorthandPropertyAssignment */) { + if (prop.kind === 243 /* PropertyAssignment */ || prop.kind === 244 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_16.kind === 7 /* NumericLiteral */) { + if (name_16.kind === 8 /* NumericLiteral */) { checkGrammarNumericLiteral(name_16); } currentKind = Property; } - else if (prop.kind === 140 /* MethodDeclaration */) { + else if (prop.kind === 141 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 142 /* GetAccessor */) { + else if (prop.kind === 143 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 143 /* SetAccessor */) { + else if (prop.kind === 144 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -26081,7 +26572,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 236 /* JsxSpreadAttribute */) { + if (attr.kind === 237 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -26093,7 +26584,7 @@ var ts; return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 237 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 238 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -26102,24 +26593,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 209 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 210 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 197 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 197 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 197 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -26142,10 +26633,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 142 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 143 /* GetAccessor */ && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 143 /* SetAccessor */) { + else if (kind === 144 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -26170,7 +26661,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 133 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 134 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -26180,7 +26671,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 162 /* ObjectLiteralExpression */) { + if (node.parent.kind === 163 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -26204,22 +26695,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 212 /* InterfaceDeclaration */) { + else if (node.parent.kind === 213 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 152 /* TypeLiteral */) { + else if (node.parent.kind === 153 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: return true; - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -26231,26 +26722,26 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 199 /* ContinueStatement */ - && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 200 /* ContinueStatement */ + && !isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } return false; } break; - case 203 /* SwitchStatement */: - if (node.kind === 200 /* BreakStatement */ && !node.label) { + case 204 /* SwitchStatement */: + if (node.kind === 201 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } break; default: - if (isIterationStatement(current, false) && !node.label) { + if (isIterationStatement(current, /*lookInLabeledStatement*/ false) && !node.label) { // unlabeled break or continue within iteration statement - ok return false; } @@ -26259,13 +26750,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 200 /* BreakStatement */ + var message = node.kind === 201 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 200 /* BreakStatement */ + var message = node.kind === 201 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -26277,7 +26768,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 159 /* ArrayBindingPattern */ || node.name.kind === 158 /* ObjectBindingPattern */) { + if (node.name.kind === 160 /* ArrayBindingPattern */ || node.name.kind === 159 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -26287,7 +26778,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 197 /* ForInStatement */ && node.parent.parent.kind !== 198 /* ForOfStatement */) { + if (node.parent.parent.kind !== 198 /* ForInStatement */ && node.parent.parent.kind !== 199 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -26314,7 +26805,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 66 /* Identifier */) { + if (name.kind === 67 /* Identifier */) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -26323,7 +26814,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 184 /* OmittedExpression */) { + if (element.kind !== 185 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -26340,15 +26831,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 202 /* WithStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 203 /* WithStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: return false; - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -26364,13 +26855,13 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 176 /* PrefixUnaryExpression */) { + if (expression.kind === 177 /* PrefixUnaryExpression */) { var unaryExpression = expression; - if (unaryExpression.operator === 34 /* PlusToken */ || unaryExpression.operator === 35 /* MinusToken */) { + if (unaryExpression.operator === 35 /* PlusToken */ || unaryExpression.operator === 36 /* MinusToken */) { expression = unaryExpression.operand; } } - if (expression.kind === 7 /* NumericLiteral */) { + if (expression.kind === 8 /* NumericLiteral */) { // Allows for scientific notation since literalExpression.text was formed by // coercing a number to a string. Sometimes this coercion can yield a string // in scientific notation. @@ -26393,7 +26884,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -26436,7 +26927,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 66 /* Identifier */ && + return node.kind === 67 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -26456,12 +26947,12 @@ var ts; return true; } } - else if (node.parent.kind === 212 /* InterfaceDeclaration */) { + else if (node.parent.kind === 213 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 152 /* TypeLiteral */) { + else if (node.parent.kind === 153 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -26481,11 +26972,11 @@ var ts; // export_opt ExternalImportDeclaration // export_opt AmbientDeclaration // - if (node.kind === 212 /* InterfaceDeclaration */ || - node.kind === 219 /* ImportDeclaration */ || - node.kind === 218 /* ImportEqualsDeclaration */ || - node.kind === 225 /* ExportDeclaration */ || - node.kind === 224 /* ExportAssignment */ || + if (node.kind === 213 /* InterfaceDeclaration */ || + node.kind === 220 /* ImportDeclaration */ || + node.kind === 219 /* ImportEqualsDeclaration */ || + node.kind === 226 /* ExportDeclaration */ || + node.kind === 225 /* ExportAssignment */ || (node.flags & 2 /* Ambient */) || (node.flags & (1 /* Export */ | 1024 /* Default */))) { return false; @@ -26495,7 +26986,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 190 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 191 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -26521,7 +27012,7 @@ var ts; // to prevent noisyness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 189 /* Block */ || node.parent.kind === 216 /* ModuleBlock */ || node.parent.kind === 245 /* SourceFile */) { + if (node.parent.kind === 190 /* Block */ || node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -26542,7 +27033,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); - diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span), 0, message, arg0, arg1, arg2)); + diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span), /*length*/ 0, message, arg0, arg1, arg2)); return true; } } @@ -26603,7 +27094,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 219 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 220 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -26679,10 +27170,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 208 /* VariableDeclaration */) { + if (declaration.kind === 209 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 222 /* NamedImports */ || declaration.kind === 223 /* ImportSpecifier */ || declaration.kind === 220 /* ImportClause */) { + else if (declaration.kind === 223 /* NamedImports */ || declaration.kind === 224 /* ImportSpecifier */ || declaration.kind === 221 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -26700,7 +27191,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 219 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 220 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -26710,12 +27201,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 215 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 216 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 215 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 216 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -26798,7 +27289,7 @@ var ts; var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, jsDocComments, true, newLine, ts.writeCommentRange); + ts.emitComments(currentSourceFile, writer, jsDocComments, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); } } function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { @@ -26807,49 +27298,49 @@ var ts; } function emitType(type) { switch (type.kind) { - case 114 /* AnyKeyword */: - case 127 /* StringKeyword */: - case 125 /* NumberKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: - case 100 /* VoidKeyword */: - case 8 /* StringLiteral */: + case 115 /* AnyKeyword */: + case 128 /* StringKeyword */: + case 126 /* NumberKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: + case 101 /* VoidKeyword */: + case 9 /* StringLiteral */: return writeTextOfNode(currentSourceFile, type); - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 148 /* TypeReference */: + case 149 /* TypeReference */: return emitTypeReference(type); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return emitTypeQuery(type); - case 153 /* ArrayType */: + case 154 /* ArrayType */: return emitArrayType(type); - case 154 /* TupleType */: + case 155 /* TupleType */: return emitTupleType(type); - case 155 /* UnionType */: + case 156 /* UnionType */: return emitUnionType(type); - case 156 /* IntersectionType */: + case 157 /* IntersectionType */: return emitIntersectionType(type); - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: return emitParenType(type); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 152 /* TypeLiteral */: + case 153 /* TypeLiteral */: return emitTypeLiteral(type); - case 66 /* Identifier */: + case 67 /* Identifier */: return emitEntityName(type); - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: return emitEntityName(type); - case 147 /* TypePredicate */: + case 148 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 66 /* Identifier */) { + if (entityName.kind === 67 /* Identifier */) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 132 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 132 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 133 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 133 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); @@ -26858,13 +27349,13 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 218 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 219 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 66 /* Identifier */ || node.expression.kind === 163 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 67 /* Identifier */ || node.expression.kind === 164 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -26945,7 +27436,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 66 /* Identifier */) { + if (node.expression.kind === 67 /* Identifier */) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -26965,7 +27456,7 @@ var ts; write(";"); writeLine(); // Make all the declarations visible for the export name - if (node.expression.kind === 66 /* Identifier */) { + if (node.expression.kind === 67 /* Identifier */) { var nodes = resolver.collectLinkedAliases(node.expression); // write each of these declarations asynchronously writeAsynchronousModuleElements(nodes); @@ -26984,10 +27475,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 218 /* ImportEqualsDeclaration */ || - (node.parent.kind === 245 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 219 /* ImportEqualsDeclaration */ || + (node.parent.kind === 246 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 245 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -26997,7 +27488,7 @@ var ts; }); } else { - if (node.kind === 219 /* ImportDeclaration */) { + if (node.kind === 220 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -27015,23 +27506,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return writeVariableStatement(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return writeClassDeclaration(node); - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -27047,7 +27538,7 @@ var ts; if (node.flags & 1024 /* Default */) { write("default "); } - else if (node.kind !== 212 /* InterfaceDeclaration */) { + else if (node.kind !== 213 /* InterfaceDeclaration */) { write("declare "); } } @@ -27096,7 +27587,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 221 /* NamespaceImport */) { + if (namedBindings.kind === 222 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -27124,7 +27615,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 222 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -27182,7 +27673,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 216 /* ModuleBlock */) { + while (node.body.kind !== 217 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -27199,14 +27690,18 @@ var ts; enclosingDeclaration = prevEnclosingDeclaration; } function writeTypeAliasDeclaration(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); writeTextOfNode(currentSourceFile, node.name); + emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); write(";"); writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, @@ -27243,7 +27738,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 140 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 141 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -27254,15 +27749,15 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 149 /* FunctionType */ || - node.parent.kind === 150 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 152 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 140 /* MethodDeclaration */ || - node.parent.kind === 139 /* MethodSignature */ || - node.parent.kind === 149 /* FunctionType */ || - node.parent.kind === 150 /* ConstructorType */ || - node.parent.kind === 144 /* CallSignature */ || - node.parent.kind === 145 /* ConstructSignature */); + if (node.parent.kind === 150 /* FunctionType */ || + node.parent.kind === 151 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 153 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 141 /* MethodDeclaration */ || + node.parent.kind === 140 /* MethodSignature */ || + node.parent.kind === 150 /* FunctionType */ || + node.parent.kind === 151 /* ConstructorType */ || + node.parent.kind === 145 /* CallSignature */ || + node.parent.kind === 146 /* ConstructSignature */); emitType(node.constraint); } else { @@ -27273,31 +27768,31 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 144 /* CallSignature */: + case 145 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 212 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -27328,7 +27823,7 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 211 /* ClassDeclaration */) { + if (node.parent.parent.kind === 212 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -27368,9 +27863,9 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); } - emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); write(" {"); writeLine(); increaseIndent(); @@ -27389,7 +27884,7 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false); write(" {"); writeLine(); increaseIndent(); @@ -27412,7 +27907,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 208 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 209 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -27422,10 +27917,10 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentSourceFile, node.name); // If optional property emit ? - if ((node.kind === 138 /* PropertyDeclaration */ || node.kind === 137 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 138 /* PropertyDeclaration */ || node.kind === 137 /* PropertySignature */) && node.parent.kind === 152 /* TypeLiteral */) { + if ((node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) && node.parent.kind === 153 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32 /* Private */)) { @@ -27434,14 +27929,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 208 /* VariableDeclaration */) { + if (node.kind === 209 /* VariableDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 138 /* PropertyDeclaration */ || node.kind === 137 /* PropertySignature */) { + else if (node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? @@ -27450,7 +27945,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.kind === 212 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -27482,7 +27977,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 184 /* OmittedExpression */) { + if (element.kind !== 185 /* OmittedExpression */) { elements.push(element); } } @@ -27503,7 +27998,7 @@ var ts; } else { writeTextOfNode(currentSourceFile, bindingElement.name); - writeTypeOfDeclaration(bindingElement, undefined, getBindingElementTypeVisibilityError); + writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError); } } } @@ -27552,7 +28047,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 142 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 143 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -27565,7 +28060,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 142 /* GetAccessor */ + return accessor.kind === 143 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -27574,7 +28069,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 143 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 144 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? @@ -27624,17 +28119,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 210 /* FunctionDeclaration */) { + if (node.kind === 211 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 140 /* MethodDeclaration */) { + else if (node.kind === 141 /* MethodDeclaration */) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 210 /* FunctionDeclaration */) { + if (node.kind === 211 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 141 /* Constructor */) { + else if (node.kind === 142 /* Constructor */) { write("constructor"); } else { @@ -27652,11 +28147,11 @@ var ts; } function emitSignatureDeclaration(node) { // Construct signature or constructor type write new Signature - if (node.kind === 145 /* ConstructSignature */ || node.kind === 150 /* ConstructorType */) { + if (node.kind === 146 /* ConstructSignature */ || node.kind === 151 /* ConstructorType */) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 146 /* IndexSignature */) { + if (node.kind === 147 /* IndexSignature */) { write("["); } else { @@ -27666,22 +28161,22 @@ var ts; enclosingDeclaration = node; // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 146 /* IndexSignature */) { + if (node.kind === 147 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 149 /* FunctionType */ || node.kind === 150 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 152 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 150 /* FunctionType */ || node.kind === 151 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 153 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 141 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 142 /* Constructor */ && !(node.flags & 32 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -27692,26 +28187,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 144 /* CallSignature */: + case 145 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 146 /* IndexSignature */: + case 147 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -27719,7 +28214,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.kind === 212 /* 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 : @@ -27733,7 +28228,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 210 /* FunctionDeclaration */: + case 211 /* 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 : @@ -27764,13 +28259,13 @@ var ts; else { writeTextOfNode(currentSourceFile, node.name); } - if (node.initializer || ts.hasQuestionToken(node)) { + if (resolver.isOptionalParameter(node)) { write("?"); } decreaseIndent(); - if (node.parent.kind === 149 /* FunctionType */ || - node.parent.kind === 150 /* ConstructorType */ || - node.parent.parent.kind === 152 /* TypeLiteral */) { + if (node.parent.kind === 150 /* FunctionType */ || + node.parent.kind === 151 /* ConstructorType */ || + node.parent.parent.kind === 153 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32 /* Private */)) { @@ -27786,24 +28281,24 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 141 /* Constructor */: + case 142 /* Constructor */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 144 /* CallSignature */: + case 145 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -27811,7 +28306,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 212 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -27824,7 +28319,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -27836,12 +28331,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 158 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 159 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 159 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 160 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -27860,7 +28355,7 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 184 /* OmittedExpression */) { + if (bindingElement.kind === 185 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -27869,7 +28364,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 160 /* BindingElement */) { + else if (bindingElement.kind === 161 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -27879,10 +28374,8 @@ var ts; // emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void; writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); - // If bindingElement has propertyName property, then its name must be another bindingPattern of SyntaxKind.ObjectBindingPattern - emitBindingPattern(bindingElement.name); } - else if (bindingElement.name) { + if (bindingElement.name) { if (ts.isBindingPattern(bindingElement.name)) { // If it is a nested binding pattern, we will recursively descend into each element and emit each one separately. // In the case of rest element, we will omit rest element. @@ -27894,7 +28387,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 66 /* Identifier */); + ts.Debug.assert(bindingElement.name.kind === 67 /* Identifier */); // If the node is just an identifier, we will simply emit the text associated with the node's name // Example: // original: function foo({y = 10, x}) {} @@ -27910,40 +28403,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 210 /* FunctionDeclaration */: - case 215 /* ModuleDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 212 /* InterfaceDeclaration */: - case 211 /* ClassDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 214 /* EnumDeclaration */: + case 211 /* FunctionDeclaration */: + case 216 /* ModuleDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 213 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 215 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible - return emitModuleElement(node, !node.importClause); - case 225 /* ExportDeclaration */: + return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); + case 226 /* ExportDeclaration */: return emitExportDeclaration(node); - case 141 /* Constructor */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 142 /* Constructor */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return writeFunctionDeclaration(node); - case 145 /* ConstructSignature */: - case 144 /* CallSignature */: - case 146 /* IndexSignature */: + case 146 /* ConstructSignature */: + case 145 /* CallSignature */: + case 147 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return emitAccessorDeclaration(node); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return emitPropertyDeclaration(node); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return emitExportAssignment(node); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return emitSourceFile(node); } } @@ -27952,7 +28445,7 @@ var ts; ? referencedFile.fileName // Declaration file, use declaration file name : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; // Global out file + : ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; // Global out file declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); referencePathsOutput += "/// " + newLine; @@ -28026,18 +28519,18 @@ var ts; emitFile(jsFilePath, sourceFile); } }); - if (compilerOptions.out) { - emitFile(compilerOptions.out); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } else { // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, ts.forEach(host.getSourceFiles(), shouldEmitJsx) ? ".jsx" : ".js"); + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!ts.isDeclarationFile(targetSourceFile) && compilerOptions.out) { - emitFile(compilerOptions.out); + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } // Sort and make the unique list of diagnostics @@ -28100,7 +28593,7 @@ var ts; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; /** Emit a node */ - var emit = emitNodeWithoutSourceMap; + var emit = emitNodeWithCommentsAndWithoutSourcemap; /** Called just before starting emit of a node */ var emitStart = function (node) { }; /** Called once the emit of the node is done */ @@ -28135,7 +28628,7 @@ var ts; }); } writeLine(); - writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; @@ -28195,7 +28688,7 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 /* StringLiteral */ ? + var baseName = expr.kind === 9 /* StringLiteral */ ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; return makeUniqueName(baseName); } @@ -28207,19 +28700,19 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return makeUniqueName(node.text); - case 215 /* ModuleDeclaration */: - case 214 /* EnumDeclaration */: + case 216 /* ModuleDeclaration */: + case 215 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 219 /* ImportDeclaration */: - case 225 /* ExportDeclaration */: + case 220 /* ImportDeclaration */: + case 226 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 210 /* FunctionDeclaration */: - case 211 /* ClassDeclaration */: - case 224 /* ExportAssignment */: + case 211 /* FunctionDeclaration */: + case 212 /* ClassDeclaration */: + case 225 /* ExportAssignment */: return generateNameForExportDefault(); - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: return generateNameForClassExpression(); } } @@ -28285,7 +28778,7 @@ var ts; function base64VLQFormatEncode(inValue) { function base64FormatEncode(inValue) { if (inValue < 64) { - return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(inValue); + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); } throw TypeError(inValue + ": not a 64 based value"); } @@ -28391,7 +28884,7 @@ var ts; // unless it is a computed property. Then it is shown with brackets, // but the brackets are included in the name. var name_21 = node.name; - if (!name_21 || name_21.kind !== 133 /* ComputedPropertyName */) { + if (!name_21 || name_21.kind !== 134 /* ComputedPropertyName */) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -28409,20 +28902,20 @@ var ts; // The scope was already given a name use it recordScopeNameStart(scopeName); } - else if (node.kind === 210 /* FunctionDeclaration */ || - node.kind === 170 /* FunctionExpression */ || - node.kind === 140 /* MethodDeclaration */ || - node.kind === 139 /* MethodSignature */ || - node.kind === 142 /* GetAccessor */ || - node.kind === 143 /* SetAccessor */ || - node.kind === 215 /* ModuleDeclaration */ || - node.kind === 211 /* ClassDeclaration */ || - node.kind === 214 /* EnumDeclaration */) { + else if (node.kind === 211 /* FunctionDeclaration */ || + node.kind === 171 /* FunctionExpression */ || + node.kind === 141 /* MethodDeclaration */ || + node.kind === 140 /* MethodSignature */ || + node.kind === 143 /* GetAccessor */ || + node.kind === 144 /* SetAccessor */ || + node.kind === 216 /* ModuleDeclaration */ || + node.kind === 212 /* ClassDeclaration */ || + node.kind === 215 /* EnumDeclaration */) { // Declaration and has associated name use it if (node.name) { var name_22 = node.name; // For computed property names, the text will include the brackets - scopeName = name_22.kind === 133 /* ComputedPropertyName */ + scopeName = name_22.kind === 134 /* ComputedPropertyName */ ? ts.getTextOfNode(name_22) : node.name.text; } @@ -28481,7 +28974,7 @@ var ts; } else { // Write source map file - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; } // Write sourcemap url to the js file and write the js file @@ -28517,7 +29010,9 @@ var ts; if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { // The relative paths are relative to the common directory sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath + ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap + host.getCurrentDirectory(), host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ true); } else { @@ -28532,7 +29027,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node); } - if (node.kind !== 245 /* SourceFile */) { + if (node.kind !== 246 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node); recordEmitNodeEndSpan(node); @@ -28543,8 +29038,11 @@ var ts; } } } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithSourceMap; + emit = emitNodeWithCommentsAndWithSourcemap; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -28557,7 +29055,7 @@ var ts; } // Create a temporary variable with a unique unused name. function createTempVariable(flags) { - var result = ts.createSynthesizedNode(66 /* Identifier */); + var result = ts.createSynthesizedNode(67 /* Identifier */); result.text = makeTempVariableName(flags); return result; } @@ -28667,7 +29165,14 @@ var ts; write(", "); } } - emitNode(nodes[start + i]); + var node = nodes[start + i]; + // This emitting is to make sure we emit following comment properly + // ...(x, /*comment1*/ y)... + // ^ => node.pos + // "comment1" is not considered leading comment for "y" but rather + // considered as trailing comment of the previous node. + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); leadingComma = true; } if (trailingComma) { @@ -28680,11 +29185,11 @@ var ts; } function emitCommaList(nodes) { if (nodes) { - emitList(nodes, 0, nodes.length, false, false); + emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); } } function emitLines(nodes) { - emitLinesStartingAt(nodes, 0); + emitLinesStartingAt(nodes, /*startIndex*/ 0); } function emitLinesStartingAt(nodes, startIndex) { for (var i = startIndex; i < nodes.length; i++) { @@ -28693,7 +29198,7 @@ var ts; } } function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 7 /* NumericLiteral */ && text.length > 1) { + if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { switch (text.charCodeAt(1)) { case 98 /* b */: case 66 /* B */: @@ -28706,7 +29211,7 @@ var ts; } function emitLiteral(node) { var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { @@ -28720,7 +29225,7 @@ var ts; // Any template literal or string literal with an extended escape // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); + return getQuotedEscapedLiteralText("\"", node.text, "\""); } // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. @@ -28730,17 +29235,17 @@ var ts; // If we can't reach the original source text, use the canonical form if it's a number, // or an escaped quoted form of the original text if it's string-like. switch (node.kind) { - case 8 /* StringLiteral */: - return getQuotedEscapedLiteralText('"', node.text, '"'); - case 10 /* NoSubstitutionTemplateLiteral */: - return getQuotedEscapedLiteralText('`', node.text, '`'); - case 11 /* TemplateHead */: - return getQuotedEscapedLiteralText('`', node.text, '${'); - case 12 /* TemplateMiddle */: - return getQuotedEscapedLiteralText('}', node.text, '${'); - case 13 /* TemplateTail */: - return getQuotedEscapedLiteralText('}', node.text, '`'); - case 7 /* NumericLiteral */: + case 9 /* StringLiteral */: + return getQuotedEscapedLiteralText("\"", node.text, "\""); + case 11 /* NoSubstitutionTemplateLiteral */: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 12 /* TemplateHead */: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 13 /* TemplateMiddle */: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14 /* TemplateTail */: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8 /* NumericLiteral */: return node.text; } ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); @@ -28757,18 +29262,18 @@ var ts; // thus we need to remove those characters. // First template piece starts with "`", others with "}" // Last template piece ends with "`", others with "${" - var isLast = node.kind === 10 /* NoSubstitutionTemplateLiteral */ || node.kind === 13 /* TemplateTail */; + var isLast = node.kind === 11 /* NoSubstitutionTemplateLiteral */ || node.kind === 14 /* TemplateTail */; text = text.substring(1, text.length - (isLast ? 1 : 2)); // Newline normalization: // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's // and LineTerminatorSequences are normalized to for both TV and TRV. text = text.replace(/\r\n?/g, "\n"); text = ts.escapeString(text); - write('"' + text + '"'); + write("\"" + text + "\""); } function emitDownlevelTaggedTemplateArray(node, literalEmitter) { write("["); - if (node.template.kind === 10 /* NoSubstitutionTemplateLiteral */) { + if (node.template.kind === 11 /* NoSubstitutionTemplateLiteral */) { literalEmitter(node.template); } else { @@ -28795,11 +29300,11 @@ var ts; write("("); emit(tempVariable); // Now we emit the expressions - if (node.template.kind === 180 /* TemplateExpression */) { + if (node.template.kind === 181 /* TemplateExpression */) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 178 /* BinaryExpression */ - && templateSpan.expression.operatorToken.kind === 23 /* CommaToken */; + var needsParens = templateSpan.expression.kind === 179 /* BinaryExpression */ + && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -28833,7 +29338,7 @@ var ts; // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 169 /* ParenthesizedExpression */ + var needsParens = templateSpan.expression.kind !== 170 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; if (i > 0 || headEmitted) { // If this is the first span and the head was not emitted, then this templateSpan's @@ -28875,11 +29380,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return parent.expression === template; - case 167 /* TaggedTemplateExpression */: - case 169 /* ParenthesizedExpression */: + case 168 /* TaggedTemplateExpression */: + case 170 /* ParenthesizedExpression */: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; @@ -28900,20 +29405,20 @@ var ts; // 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 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: switch (expression.operatorToken.kind) { - case 36 /* AsteriskToken */: - case 37 /* SlashToken */: - case 38 /* PercentToken */: + case 37 /* AsteriskToken */: + case 38 /* SlashToken */: + case 39 /* PercentToken */: return 1 /* GreaterThan */; - case 34 /* PlusToken */: - case 35 /* MinusToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: return 0 /* EqualTo */; default: return -1 /* LessThan */; } - case 181 /* YieldExpression */: - case 179 /* ConditionalExpression */: + case 182 /* YieldExpression */: + case 180 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -28928,10 +29433,10 @@ var ts; /// Emit a tag name, which is either '"div"' for lower-cased names, or /// 'Div' for upper-cased or dotted names function emitTagName(name) { - if (name.kind === 66 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write('"'); + if (name.kind === 67 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { + write("\""); emit(name); - write('"'); + write("\""); } else { emit(name); @@ -28942,9 +29447,9 @@ var ts; /// about keywords, just non-identifier characters function emitAttributeName(name) { if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write('"'); + write("\""); emit(name); - write('"'); + write("\""); } else { emit(name); @@ -28976,37 +29481,37 @@ var ts; // Either emit one big object literal (no spread attribs), or // a call to React.__spread var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 236 /* JsxSpreadAttribute */; })) { + if (ts.forEach(attrs, function (attr) { return attr.kind === 237 /* JsxSpreadAttribute */; })) { write("React.__spread("); var haveOpenedObjectLiteral = false; - for (var i_2 = 0; i_2 < attrs.length; i_2++) { - if (attrs[i_2].kind === 236 /* JsxSpreadAttribute */) { + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 237 /* JsxSpreadAttribute */) { // If this is the first argument, we need to emit a {} as the first argument - if (i_2 === 0) { + if (i_1 === 0) { write("{}, "); } if (haveOpenedObjectLiteral) { write("}"); haveOpenedObjectLiteral = false; } - if (i_2 > 0) { + if (i_1 > 0) { write(", "); } - emit(attrs[i_2].expression); + emit(attrs[i_1].expression); } else { - ts.Debug.assert(attrs[i_2].kind === 235 /* JsxAttribute */); + ts.Debug.assert(attrs[i_1].kind === 236 /* JsxAttribute */); if (haveOpenedObjectLiteral) { write(", "); } else { haveOpenedObjectLiteral = true; - if (i_2 > 0) { + if (i_1 > 0) { write(", "); } write("{"); } - emitJsxAttribute(attrs[i_2]); + emitJsxAttribute(attrs[i_1]); } } if (haveOpenedObjectLiteral) @@ -29029,16 +29534,16 @@ var ts; if (children) { for (var i = 0; i < children.length; i++) { // Don't emit empty expressions - if (children[i].kind === 237 /* JsxExpression */ && !(children[i].expression)) { + if (children[i].kind === 238 /* JsxExpression */ && !(children[i].expression)) { continue; } // Don't emit empty strings - if (children[i].kind === 233 /* JsxText */) { + if (children[i].kind === 234 /* JsxText */) { var text = getTextToEmit(children[i]); if (text !== undefined) { - write(', "'); + write(", \""); write(text); - write('"'); + write("\""); } } else { @@ -29051,11 +29556,11 @@ var ts; write(")"); // closes "React.createElement(" emitTrailingComments(openingNode); } - if (node.kind === 230 /* JsxElement */) { + if (node.kind === 231 /* JsxElement */) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 231 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 232 /* JsxSelfClosingElement */); emitJsxElement(node); } } @@ -29075,11 +29580,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 236 /* JsxSpreadAttribute */) { + if (attribs[i].kind === 237 /* JsxSpreadAttribute */) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 235 /* JsxAttribute */); + ts.Debug.assert(attribs[i].kind === 236 /* JsxAttribute */); emitJsxAttribute(attribs[i]); } } @@ -29087,11 +29592,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 231 /* JsxSelfClosingElement */)) { + if (node.attributes.length > 0 || (node.kind === 232 /* JsxSelfClosingElement */)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 231 /* JsxSelfClosingElement */) { + if (node.kind === 232 /* JsxSelfClosingElement */) { write("/>"); } else { @@ -29110,11 +29615,11 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 230 /* JsxElement */) { + if (node.kind === 231 /* JsxElement */) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 231 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 232 /* JsxSelfClosingElement */); emitJsxOpeningOrSelfClosingElement(node); } } @@ -29122,11 +29627,11 @@ var ts; // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. // For example, this is utilized when feeding in a result to Object.defineProperty. function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 160 /* BindingElement */); - if (node.kind === 8 /* StringLiteral */) { + ts.Debug.assert(node.kind !== 161 /* BindingElement */); + if (node.kind === 9 /* StringLiteral */) { emitLiteral(node); } - else if (node.kind === 133 /* ComputedPropertyName */) { + else if (node.kind === 134 /* ComputedPropertyName */) { // if this is a decorated computed property, we will need to capture the result // of the property expression so that we can apply decorators later. This is to ensure // we don't introduce unintended side effects: @@ -29158,7 +29663,7 @@ var ts; } else { write("\""); - if (node.kind === 7 /* NumericLiteral */) { + if (node.kind === 8 /* NumericLiteral */) { write(node.text); } else { @@ -29170,58 +29675,60 @@ var ts; function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 161 /* ArrayLiteralExpression */: - case 178 /* BinaryExpression */: - case 165 /* CallExpression */: - case 238 /* CaseClause */: - case 133 /* ComputedPropertyName */: - case 179 /* ConditionalExpression */: - case 136 /* Decorator */: - case 172 /* DeleteExpression */: - case 194 /* DoStatement */: - case 164 /* ElementAccessExpression */: - case 224 /* ExportAssignment */: - case 192 /* ExpressionStatement */: - case 185 /* ExpressionWithTypeArguments */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 193 /* IfStatement */: - case 231 /* JsxSelfClosingElement */: - case 232 /* JsxOpeningElement */: - case 166 /* NewExpression */: - case 169 /* ParenthesizedExpression */: - case 177 /* PostfixUnaryExpression */: - case 176 /* PrefixUnaryExpression */: - case 201 /* ReturnStatement */: - case 243 /* ShorthandPropertyAssignment */: - case 182 /* SpreadElementExpression */: - case 203 /* SwitchStatement */: - case 167 /* TaggedTemplateExpression */: - case 187 /* TemplateSpan */: - case 205 /* ThrowStatement */: - case 168 /* TypeAssertionExpression */: - case 173 /* TypeOfExpression */: - case 174 /* VoidExpression */: - case 195 /* WhileStatement */: - case 202 /* WithStatement */: - case 181 /* YieldExpression */: + case 162 /* ArrayLiteralExpression */: + case 179 /* BinaryExpression */: + case 166 /* CallExpression */: + case 239 /* CaseClause */: + case 134 /* ComputedPropertyName */: + case 180 /* ConditionalExpression */: + case 137 /* Decorator */: + case 173 /* DeleteExpression */: + case 195 /* DoStatement */: + case 165 /* ElementAccessExpression */: + case 225 /* ExportAssignment */: + case 193 /* ExpressionStatement */: + case 186 /* ExpressionWithTypeArguments */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 194 /* IfStatement */: + case 232 /* JsxSelfClosingElement */: + case 233 /* JsxOpeningElement */: + case 237 /* JsxSpreadAttribute */: + case 238 /* JsxExpression */: + case 167 /* NewExpression */: + case 170 /* ParenthesizedExpression */: + case 178 /* PostfixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: + case 202 /* ReturnStatement */: + case 244 /* ShorthandPropertyAssignment */: + case 183 /* SpreadElementExpression */: + case 204 /* SwitchStatement */: + case 168 /* TaggedTemplateExpression */: + case 188 /* TemplateSpan */: + case 206 /* ThrowStatement */: + case 169 /* TypeAssertionExpression */: + case 174 /* TypeOfExpression */: + case 175 /* VoidExpression */: + case 196 /* WhileStatement */: + case 203 /* WithStatement */: + case 182 /* YieldExpression */: return true; - case 160 /* BindingElement */: - case 244 /* EnumMember */: - case 135 /* Parameter */: - case 242 /* PropertyAssignment */: - case 138 /* PropertyDeclaration */: - case 208 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 245 /* EnumMember */: + case 136 /* Parameter */: + case 243 /* PropertyAssignment */: + case 139 /* PropertyDeclaration */: + case 209 /* VariableDeclaration */: return parent.initializer === node; - case 163 /* PropertyAccessExpression */: + case 164 /* PropertyAccessExpression */: return parent.expression === node; - case 171 /* ArrowFunction */: - case 170 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 171 /* FunctionExpression */: return parent.body === node; - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return parent.moduleReference === node; - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: return parent.left === node; } return false; @@ -29233,7 +29740,7 @@ var ts; } var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 245 /* SourceFile */) { + if (container.kind === 246 /* SourceFile */) { // Identifier references module export if (languageVersion < 2 /* ES6 */ && compilerOptions.module !== 4 /* System */) { write("exports."); @@ -29248,13 +29755,13 @@ var ts; else if (languageVersion < 2 /* ES6 */) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 220 /* ImportClause */) { + if (declaration.kind === 221 /* ImportClause */) { // Identifier references default import write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? '["default"]' : ".default"); + write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); return; } - else if (declaration.kind === 223 /* ImportSpecifier */) { + else if (declaration.kind === 224 /* ImportSpecifier */) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); write("."); @@ -29272,13 +29779,13 @@ var ts; } function isNameOfNestedRedeclaration(node) { if (languageVersion < 2 /* ES6 */) { - var parent_7 = node.parent; - switch (parent_7.kind) { - case 160 /* BindingElement */: - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 208 /* VariableDeclaration */: - return parent_7.name === node && resolver.isNestedRedeclaration(parent_7); + var parent_6 = node.parent; + switch (parent_6.kind) { + case 161 /* BindingElement */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 209 /* VariableDeclaration */: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); } } return false; @@ -29322,13 +29829,13 @@ var ts; function emitObjectBindingPattern(node) { write("{ "); var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); write(" }"); } function emitArrayBindingPattern(node) { write("["); var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); write("]"); } function emitBindingElement(node) { @@ -29352,7 +29859,7 @@ var ts; emit(node.expression); } function emitYieldExpression(node) { - write(ts.tokenToString(111 /* YieldKeyword */)); + write(ts.tokenToString(112 /* YieldKeyword */)); if (node.asteriskToken) { write("*"); } @@ -29366,7 +29873,7 @@ var ts; if (needsParenthesis) { write("("); } - write(ts.tokenToString(111 /* YieldKeyword */)); + write(ts.tokenToString(112 /* YieldKeyword */)); write(" "); emit(node.expression); if (needsParenthesis) { @@ -29374,22 +29881,22 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 178 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 179 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 179 /* ConditionalExpression */ && node.parent.condition === node) { + else if (node.parent.kind === 180 /* ConditionalExpression */ && node.parent.condition === node) { return true; } return false; } function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { - case 66 /* Identifier */: - case 161 /* ArrayLiteralExpression */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 165 /* CallExpression */: - case 169 /* ParenthesizedExpression */: + case 67 /* Identifier */: + case 162 /* ArrayLiteralExpression */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 170 /* ParenthesizedExpression */: // This list is not exhaustive and only includes those cases that are relevant // to the check in emitArrayLiteral. More cases can be added as needed. return false; @@ -29409,17 +29916,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 182 /* SpreadElementExpression */) { + if (e.kind === 183 /* SpreadElementExpression */) { e = e.expression; - emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); + emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 161 /* ArrayLiteralExpression */) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162 /* ArrayLiteralExpression */) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 182 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 183 /* SpreadElementExpression */) { i++; } write("["); @@ -29442,7 +29949,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 182 /* SpreadElementExpression */; + return node.kind === 183 /* SpreadElementExpression */; } function emitArrayLiteral(node) { var elements = node.elements; @@ -29451,12 +29958,12 @@ var ts; } else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); write("]"); } else { - emitListWithSpread(elements, true, (node.flags & 2048 /* MultiLine */) !== 0, - /*trailingComma*/ elements.hasTrailingComma, true); + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 2048 /* MultiLine */) !== 0, + /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); } } function emitObjectLiteralBody(node, numElements) { @@ -29471,7 +29978,7 @@ var ts; // then try to preserve the original shape of the object literal. // Otherwise just try to preserve the formatting. if (numElements === properties.length) { - emitLinePreservingList(node, properties, languageVersion >= 1 /* ES5 */, true); + emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); } else { var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; @@ -29481,7 +29988,7 @@ var ts; else { increaseIndent(); } - emitList(properties, 0, numElements, multiLine, false); + emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ false); if (!multiLine) { write(" "); } @@ -29512,7 +30019,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 142 /* GetAccessor */ || property.kind === 143 /* SetAccessor */) { + if (property.kind === 143 /* GetAccessor */ || property.kind === 144 /* SetAccessor */) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { @@ -29564,13 +30071,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 242 /* PropertyAssignment */) { + if (property.kind === 243 /* PropertyAssignment */) { emit(property.initializer); } - else if (property.kind === 243 /* ShorthandPropertyAssignment */) { + else if (property.kind === 244 /* ShorthandPropertyAssignment */) { emitExpressionIdentifier(property.name); } - else if (property.kind === 140 /* MethodDeclaration */) { + else if (property.kind === 141 /* MethodDeclaration */) { emitFunctionDeclaration(property); } else { @@ -29604,7 +30111,7 @@ var ts; // 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 === 133 /* ComputedPropertyName */) { + if (properties[i].name.kind === 134 /* ComputedPropertyName */) { numInitialNonComputedProperties = i; break; } @@ -29620,21 +30127,21 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(178 /* BinaryExpression */, startsOnNewLine); + var result = ts.createSynthesizedNode(179 /* BinaryExpression */, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(163 /* PropertyAccessExpression */); + var result = ts.createSynthesizedNode(164 /* PropertyAccessExpression */); result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(20 /* DotToken */); + result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(164 /* ElementAccessExpression */); + var result = ts.createSynthesizedNode(165 /* ElementAccessExpression */); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; @@ -29642,7 +30149,7 @@ var ts; function parenthesizeForAccess(expr) { // When diagnosing whether the expression needs parentheses, the decision should be based // on the innermost expression in a chain of nested type assertions. - while (expr.kind === 168 /* TypeAssertionExpression */ || expr.kind === 186 /* AsExpression */) { + while (expr.kind === 169 /* TypeAssertionExpression */ || expr.kind === 187 /* AsExpression */) { expr = expr.expression; } // isLeftHandSideExpression is almost the correct criterion for when it is not necessary @@ -29654,11 +30161,11 @@ var ts; // 1.x -> not the same as (1).x // if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 166 /* NewExpression */ && - expr.kind !== 7 /* NumericLiteral */) { + expr.kind !== 167 /* NewExpression */ && + expr.kind !== 8 /* NumericLiteral */) { return expr; } - var node = ts.createSynthesizedNode(169 /* ParenthesizedExpression */); + var node = ts.createSynthesizedNode(170 /* ParenthesizedExpression */); node.expression = expr; return node; } @@ -29680,12 +30187,20 @@ var ts; function emitPropertyAssignment(node) { emit(node.name); write(": "); + // This is to ensure that we emit comment in the following case: + // For example: + // obj = { + // id: /*comment1*/ ()=>void + // } + // "comment1" is not considered to be leading comment for node.initializer + // but rather a trailing comment on the previous node. + emitTrailingCommentsOfPosition(node.initializer.pos); emit(node.initializer); } // Return true if identifier resolves to an exported member of a namespace function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 245 /* SourceFile */; + return container && container.kind !== 246 /* SourceFile */; } function emitShorthandPropertyAssignment(node) { // The name property of a short-hand property assignment is considered an expression position, so here @@ -29707,21 +30222,25 @@ var ts; } } function tryEmitConstantValue(node) { - if (compilerOptions.isolatedModules) { - // do not inline enum values in separate compilation mode - return false; - } - var constantValue = resolver.getConstantValue(node); + var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 163 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 164 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; } return false; } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 164 /* PropertyAccessExpression */ || node.kind === 165 /* ElementAccessExpression */ + ? resolver.getConstantValue(node) + : undefined; + } // Returns 'true' if the code was actually indented, false otherwise. // If the code is not indented, an optional valueToWriteWhenNotIndenting will be // emitted instead. @@ -29748,10 +30267,20 @@ var ts; emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); // 1 .toString is a valid property access, emit a space after the literal + // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal var shouldEmitSpace; - if (!indentedBeforeDot && node.expression.kind === 7 /* NumericLiteral */) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(20 /* DotToken */)) < 0; + if (!indentedBeforeDot) { + if (node.expression.kind === 8 /* NumericLiteral */) { + // check if numeric literal was originally written with a dot + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; + } + else { + // check if constant enum value is integer + var constantValue = tryGetConstEnumValue(node.expression); + // isFinite handles cases when constantValue is undefined + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } } if (shouldEmitSpace) { write(" ."); @@ -29769,7 +30298,7 @@ var ts; emit(node.right); } function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 66 /* Identifier */) { + if (node.left.kind === 67 /* Identifier */) { emitEntityNameAsExpression(node.left, useFallback); } else if (useFallback) { @@ -29777,19 +30306,19 @@ var ts; write("("); emitNodeWithoutSourceMap(temp); write(" = "); - emitEntityNameAsExpression(node.left, true); + emitEntityNameAsExpression(node.left, /*useFallback*/ true); write(") && "); emitNodeWithoutSourceMap(temp); } else { - emitEntityNameAsExpression(node.left, false); + emitEntityNameAsExpression(node.left, /*useFallback*/ false); } write("."); - emitNodeWithoutSourceMap(node.right); + emit(node.right); } function emitEntityNameAsExpression(node, useFallback) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: if (useFallback) { write("typeof "); emitExpressionIdentifier(node); @@ -29797,7 +30326,7 @@ var ts; } emitExpressionIdentifier(node); break; - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: emitQualifiedNameAsExpression(node, useFallback); break; } @@ -29812,16 +30341,16 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 182 /* SpreadElementExpression */; }); + return ts.forEach(elements, function (e) { return e.kind === 183 /* SpreadElementExpression */; }); } function skipParentheses(node) { - while (node.kind === 169 /* ParenthesizedExpression */ || node.kind === 168 /* TypeAssertionExpression */ || node.kind === 186 /* AsExpression */) { + while (node.kind === 170 /* ParenthesizedExpression */ || node.kind === 169 /* TypeAssertionExpression */ || node.kind === 187 /* AsExpression */) { node = node.expression; } return node; } function emitCallTarget(node) { - if (node.kind === 66 /* Identifier */ || node.kind === 94 /* ThisKeyword */ || node.kind === 92 /* SuperKeyword */) { + if (node.kind === 67 /* Identifier */ || node.kind === 95 /* ThisKeyword */ || node.kind === 93 /* SuperKeyword */) { emit(node); return node; } @@ -29836,20 +30365,20 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 163 /* PropertyAccessExpression */) { + if (expr.kind === 164 /* PropertyAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 164 /* ElementAccessExpression */) { + else if (expr.kind === 165 /* ElementAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); write("]"); } - else if (expr.kind === 92 /* SuperKeyword */) { + else if (expr.kind === 93 /* SuperKeyword */) { target = expr; write("_super"); } @@ -29858,7 +30387,7 @@ var ts; } write(".apply("); if (target) { - if (target.kind === 92 /* SuperKeyword */) { + if (target.kind === 93 /* SuperKeyword */) { // Calls of form super(...) and super.foo(...) emitThis(target); } @@ -29872,7 +30401,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false, false, true); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); write(")"); } function emitCallExpression(node) { @@ -29881,13 +30410,13 @@ var ts; return; } var superCall = false; - if (node.expression.kind === 92 /* SuperKeyword */) { + if (node.expression.kind === 93 /* SuperKeyword */) { emitSuper(node.expression); superCall = true; } else { emit(node.expression); - superCall = node.expression.kind === 163 /* PropertyAccessExpression */ && node.expression.expression.kind === 92 /* SuperKeyword */; + superCall = node.expression.kind === 164 /* PropertyAccessExpression */ && node.expression.expression.kind === 93 /* SuperKeyword */; } if (superCall && languageVersion < 2 /* ES6 */) { write(".call("); @@ -29929,7 +30458,7 @@ var ts; write(".bind.apply("); emit(target); write(", [void 0].concat("); - emitListWithSpread(node.arguments, false, false, false, false); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); write(")))"); write("()"); } @@ -29956,12 +30485,12 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 171 /* ArrowFunction */) { - if (node.expression.kind === 168 /* TypeAssertionExpression */ || node.expression.kind === 186 /* AsExpression */) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172 /* ArrowFunction */) { + if (node.expression.kind === 169 /* TypeAssertionExpression */ || node.expression.kind === 187 /* AsExpression */) { var operand = node.expression.expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; - while (operand.kind === 168 /* TypeAssertionExpression */ || operand.kind === 186 /* AsExpression */) { + while (operand.kind === 169 /* TypeAssertionExpression */ || operand.kind === 187 /* AsExpression */) { operand = operand.expression; } // We have an expression of the form: (SubExpr) @@ -29972,14 +30501,14 @@ var ts; // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() // new (A()) should be emitted as new (A()) and not new A() // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 176 /* PrefixUnaryExpression */ && - operand.kind !== 174 /* VoidExpression */ && - operand.kind !== 173 /* TypeOfExpression */ && - operand.kind !== 172 /* DeleteExpression */ && - operand.kind !== 177 /* PostfixUnaryExpression */ && - operand.kind !== 166 /* NewExpression */ && - !(operand.kind === 165 /* CallExpression */ && node.parent.kind === 166 /* NewExpression */) && - !(operand.kind === 170 /* FunctionExpression */ && node.parent.kind === 165 /* CallExpression */)) { + if (operand.kind !== 177 /* PrefixUnaryExpression */ && + operand.kind !== 175 /* VoidExpression */ && + operand.kind !== 174 /* TypeOfExpression */ && + operand.kind !== 173 /* DeleteExpression */ && + operand.kind !== 178 /* PostfixUnaryExpression */ && + operand.kind !== 167 /* NewExpression */ && + !(operand.kind === 166 /* CallExpression */ && node.parent.kind === 167 /* NewExpression */) && + !(operand.kind === 171 /* FunctionExpression */ && node.parent.kind === 166 /* CallExpression */)) { emit(operand); return; } @@ -29990,29 +30519,29 @@ var ts; write(")"); } function emitDeleteExpression(node) { - write(ts.tokenToString(75 /* DeleteKeyword */)); + write(ts.tokenToString(76 /* DeleteKeyword */)); write(" "); emit(node.expression); } function emitVoidExpression(node) { - write(ts.tokenToString(100 /* VoidKeyword */)); + write(ts.tokenToString(101 /* VoidKeyword */)); write(" "); emit(node.expression); } function emitTypeOfExpression(node) { - write(ts.tokenToString(98 /* TypeOfKeyword */)); + write(ts.tokenToString(99 /* TypeOfKeyword */)); write(" "); emit(node.expression); } function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 66 /* Identifier */ || ts.nodeIsSynthesized(node)) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 67 /* Identifier */ || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 208 /* VariableDeclaration */ || node.parent.kind === 160 /* BindingElement */); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 /* VariableDeclaration */ || node.parent.kind === 161 /* BindingElement */); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); - return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); } function emitPrefixUnaryExpression(node) { var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); @@ -30038,12 +30567,12 @@ var ts; // the resulting expression a prefix increment operation. And in the second, it will make the resulting // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. - if (node.operand.kind === 176 /* PrefixUnaryExpression */) { + if (node.operand.kind === 177 /* PrefixUnaryExpression */) { var operand = node.operand; - if (node.operator === 34 /* PlusToken */ && (operand.operator === 34 /* PlusToken */ || operand.operator === 39 /* PlusPlusToken */)) { + if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 40 /* PlusPlusToken */)) { write(" "); } - else if (node.operator === 35 /* MinusToken */ && (operand.operator === 35 /* MinusToken */ || operand.operator === 40 /* MinusMinusToken */)) { + else if (node.operator === 36 /* MinusToken */ && (operand.operator === 36 /* MinusToken */ || operand.operator === 41 /* MinusMinusToken */)) { write(" "); } } @@ -30063,7 +30592,7 @@ var ts; write("\", "); write(ts.tokenToString(node.operator)); emit(node.operand); - if (node.operator === 39 /* PlusPlusToken */) { + if (node.operator === 40 /* PlusPlusToken */) { write(") - 1)"); } else { @@ -30076,7 +30605,7 @@ var ts; } } function shouldHoistDeclarationInSystemJsModule(node) { - return isSourceFileLevelDeclarationInSystemJsModule(node, false); + return isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ false); } /* * Checks if given node is a source file level declaration (not nested in module/function). @@ -30094,10 +30623,10 @@ var ts; } var current = node; while (current) { - if (current.kind === 245 /* SourceFile */) { + if (current.kind === 246 /* SourceFile */) { return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); } - else if (ts.isFunctionLike(current) || current.kind === 216 /* ModuleBlock */) { + else if (ts.isFunctionLike(current) || current.kind === 217 /* ModuleBlock */) { return false; } else { @@ -30106,13 +30635,13 @@ var ts; } } function emitBinaryExpression(node) { - if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 54 /* EqualsToken */ && - (node.left.kind === 162 /* ObjectLiteralExpression */ || node.left.kind === 161 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 192 /* ExpressionStatement */); + if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 55 /* EqualsToken */ && + (node.left.kind === 163 /* ObjectLiteralExpression */ || node.left.kind === 162 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 193 /* ExpressionStatement */); } else { - var exportChanged = node.operatorToken.kind >= 54 /* FirstAssignment */ && - node.operatorToken.kind <= 65 /* LastAssignment */ && + var exportChanged = node.operatorToken.kind >= 55 /* FirstAssignment */ && + node.operatorToken.kind <= 66 /* LastAssignment */ && isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); if (exportChanged) { // emit assignment 'x y' as 'exports("x", x y)' @@ -30121,7 +30650,7 @@ var ts; write("\", "); } emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 /* CommaToken */ ? " " : undefined); + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 /* CommaToken */ ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); @@ -30160,36 +30689,36 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 189 /* Block */) { + if (node && node.kind === 190 /* Block */) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { if (isSingleLineEmptyBlock(node)) { - emitToken(14 /* OpenBraceToken */, node.pos); + emitToken(15 /* OpenBraceToken */, node.pos); write(" "); - emitToken(15 /* CloseBraceToken */, node.statements.end); + emitToken(16 /* CloseBraceToken */, node.statements.end); return; } - emitToken(14 /* OpenBraceToken */, node.pos); + emitToken(15 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 216 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 215 /* ModuleDeclaration */); + if (node.kind === 217 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 216 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 216 /* ModuleBlock */) { - emitTempDeclarations(true); + if (node.kind === 217 /* ModuleBlock */) { + emitTempDeclarations(/*newLine*/ true); } decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.statements.end); + emitToken(16 /* CloseBraceToken */, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 189 /* Block */) { + if (node.kind === 190 /* Block */) { write(" "); emit(node); } @@ -30201,20 +30730,20 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 171 /* ArrowFunction */); + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 172 /* ArrowFunction */); write(";"); } function emitIfStatement(node) { - var endPos = emitToken(85 /* IfKeyword */, node.pos); + var endPos = emitToken(86 /* IfKeyword */, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); + endPos = emitToken(17 /* OpenParenToken */, endPos); emit(node.expression); - emitToken(17 /* CloseParenToken */, node.expression.end); + emitToken(18 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(77 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 193 /* IfStatement */) { + emitToken(78 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 194 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -30226,7 +30755,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 189 /* Block */) { + if (node.statement.kind === 190 /* Block */) { write(" "); } else { @@ -30248,17 +30777,17 @@ var ts; * in system modules where such variable declarations are hoisted. */ function tryEmitStartOfVariableDeclarationList(decl, startPos) { - if (shouldHoistVariable(decl, true)) { + if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { // variables in variable declaration list were already hoisted return false; } - var tokenKind = 99 /* VarKeyword */; + var tokenKind = 100 /* VarKeyword */; if (decl && languageVersion >= 2 /* ES6 */) { if (ts.isLet(decl)) { - tokenKind = 105 /* LetKeyword */; + tokenKind = 106 /* LetKeyword */; } else if (ts.isConst(decl)) { - tokenKind = 71 /* ConstKeyword */; + tokenKind = 72 /* ConstKeyword */; } } if (startPos !== undefined) { @@ -30267,13 +30796,13 @@ var ts; } else { switch (tokenKind) { - case 99 /* VarKeyword */: + case 100 /* VarKeyword */: write("var "); break; - case 105 /* LetKeyword */: + case 106 /* LetKeyword */: write("let "); break; - case 71 /* ConstKeyword */: + case 72 /* ConstKeyword */: write("const "); break; } @@ -30298,10 +30827,10 @@ var ts; return started; } function emitForStatement(node) { - var endPos = emitToken(83 /* ForKeyword */, node.pos); + var endPos = emitToken(84 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 209 /* VariableDeclarationList */) { + endPos = emitToken(17 /* OpenParenToken */, endPos); + if (node.initializer && node.initializer.kind === 210 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); if (startIsEmitted) { @@ -30322,13 +30851,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 198 /* ForOfStatement */) { + if (languageVersion < 2 /* ES6 */ && node.kind === 199 /* ForOfStatement */) { return emitDownLevelForOfStatement(node); } - var endPos = emitToken(83 /* ForKeyword */, node.pos); + var endPos = emitToken(84 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + endPos = emitToken(17 /* OpenParenToken */, endPos); + if (node.initializer.kind === 210 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); @@ -30338,14 +30867,14 @@ var ts; else { emit(node.initializer); } - if (node.kind === 197 /* ForInStatement */) { + if (node.kind === 198 /* ForInStatement */) { write(" in "); } else { write(" of "); } emit(node.expression); - emitToken(17 /* CloseParenToken */, node.expression.end); + emitToken(18 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.statement); } function emitDownLevelForOfStatement(node) { @@ -30369,9 +30898,9 @@ var ts; // all destructuring. // Note also that because an extra statement is needed to assign to the LHS, // for-of bodies are always emitted as blocks. - var endPos = emitToken(83 /* ForKeyword */, node.pos); + var endPos = emitToken(84 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); + endPos = emitToken(17 /* OpenParenToken */, endPos); // Do not emit the LHS let declaration yet, because it might contain destructuring. // Do not call recordTempDeclaration because we are declaring the temps // right here. Recording means they will be declared later. @@ -30380,7 +30909,7 @@ var ts; // for (let v of arr) { } // // we don't want to emit a temporary variable for the RHS, just use it directly. - var rhsIsIdentifier = node.expression.kind === 66 /* Identifier */; + var rhsIsIdentifier = node.expression.kind === 67 /* Identifier */; var counter = createTempVariable(268435456 /* _i */); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0 /* Auto */); // This is the let keyword for the counter and rhsReference. The let keyword for @@ -30405,7 +30934,7 @@ var ts; emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); emitEnd(node.initializer); write("; "); @@ -30414,7 +30943,7 @@ var ts; emitNodeWithoutSourceMap(counter); write("++"); emitEnd(node.initializer); - emitToken(17 /* CloseParenToken */, node.expression.end); + emitToken(18 /* CloseParenToken */, node.expression.end); // Body write(" {"); writeLine(); @@ -30423,7 +30952,7 @@ var ts; // let v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer.kind === 210 /* VariableDeclarationList */) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -30431,12 +30960,12 @@ var ts; if (ts.isBindingPattern(declaration.name)) { // This works whether the declaration is a var, let, or const. // It will use rhsIterationValue _a[_i] as the initializer. - emitDestructuring(declaration, false, rhsIterationValue); + emitDestructuring(declaration, /*isAssignmentExpressionStatement*/ false, rhsIterationValue); } else { // The following call does not include the initializer, so we have // to emit it separately. - emitNodeWithoutSourceMap(declaration); + emitNodeWithCommentsAndWithoutSourcemap(declaration); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -30452,19 +30981,19 @@ var ts; else { // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. - var assignmentExpression = createBinaryExpression(node.initializer, 54 /* EqualsToken */, rhsIterationValue, false); - if (node.initializer.kind === 161 /* ArrayLiteralExpression */ || node.initializer.kind === 162 /* ObjectLiteralExpression */) { + var assignmentExpression = createBinaryExpression(node.initializer, 55 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); + if (node.initializer.kind === 162 /* ArrayLiteralExpression */ || node.initializer.kind === 163 /* ObjectLiteralExpression */) { // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. - emitDestructuring(assignmentExpression, true, undefined); + emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); } else { - emitNodeWithoutSourceMap(assignmentExpression); + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); } } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 189 /* Block */) { + if (node.statement.kind === 190 /* Block */) { emitLines(node.statement.statements); } else { @@ -30476,12 +31005,12 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 200 /* BreakStatement */ ? 67 /* BreakKeyword */ : 72 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 201 /* BreakStatement */ ? 68 /* BreakKeyword */ : 73 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { - emitToken(91 /* ReturnKeyword */, node.pos); + emitToken(92 /* ReturnKeyword */, node.pos); emitOptional(" ", node.expression); write(";"); } @@ -30492,21 +31021,21 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(93 /* SwitchKeyword */, node.pos); + var endPos = emitToken(94 /* SwitchKeyword */, node.pos); write(" "); - emitToken(16 /* OpenParenToken */, endPos); + emitToken(17 /* OpenParenToken */, endPos); emit(node.expression); - endPos = emitToken(17 /* CloseParenToken */, node.expression.end); + endPos = emitToken(18 /* CloseParenToken */, node.expression.end); write(" "); emitCaseBlock(node.caseBlock, endPos); } function emitCaseBlock(node, startPos) { - emitToken(14 /* OpenBraceToken */, startPos); + emitToken(15 /* OpenBraceToken */, startPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.clauses.end); + emitToken(16 /* CloseBraceToken */, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === @@ -30521,7 +31050,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 238 /* CaseClause */) { + if (node.kind === 239 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -30556,16 +31085,16 @@ var ts; } function emitCatchClause(node) { writeLine(); - var endPos = emitToken(69 /* CatchKeyword */, node.pos); + var endPos = emitToken(70 /* CatchKeyword */, node.pos); write(" "); - emitToken(16 /* OpenParenToken */, endPos); + emitToken(17 /* OpenParenToken */, endPos); emit(node.variableDeclaration); - emitToken(17 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); + emitToken(18 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); write(" "); emitBlock(node.block); } function emitDebuggerStatement(node) { - emitToken(73 /* DebuggerKeyword */, node.pos); + emitToken(74 /* DebuggerKeyword */, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -30576,7 +31105,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 215 /* ModuleDeclaration */); + } while (node && node.kind !== 216 /* ModuleDeclaration */); return node; } function emitContainingModuleName(node) { @@ -30595,16 +31124,35 @@ var ts; write("exports."); } } - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); emitEnd(node.name); } function createVoidZero() { - var zero = ts.createSynthesizedNode(7 /* NumericLiteral */); + var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); zero.text = "0"; - var result = ts.createSynthesizedNode(174 /* VoidExpression */); + var result = ts.createSynthesizedNode(175 /* VoidExpression */); result.expression = zero; return result; } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 246 /* SourceFile */) { + ts.Debug.assert(!!(node.flags & 1024 /* Default */) || node.kind === 225 /* ExportAssignment */); + // only allow export default at a source file level + if (compilerOptions.module === 1 /* CommonJS */ || compilerOptions.module === 2 /* AMD */ || compilerOptions.module === 3 /* UMD */) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1 /* ES5 */) { + // default value of configurable, enumerable, writable are `false`. + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0 /* ES3 */) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } function emitExportMemberAssignment(node) { if (node.flags & 1 /* Export */) { writeLine(); @@ -30618,7 +31166,7 @@ var ts; write("default"); } else { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } write("\", "); emitDeclarationName(node); @@ -30626,6 +31174,7 @@ var ts; } else { if (node.flags & 1024 /* Default */) { + emitEs6ExportDefaultCompat(node); if (languageVersion === 0 /* ES3 */) { write("exports[\"default\"]"); } @@ -30644,32 +31193,36 @@ var ts; } } function emitExportMemberAssignments(name) { + if (compilerOptions.module === 4 /* System */) { + return; + } if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); - if (compilerOptions.module === 4 /* System */) { - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(specifier.name); - write("\", "); - emitExpressionIdentifier(name); - write(")"); - emitEnd(specifier.name); - } - else { - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - } + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); write(";"); } } } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(compilerOptions.module === 4 /* System */); + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so @@ -30677,15 +31230,15 @@ var ts; // Also temporary variables should be explicitly allocated for source level declarations when module target is system // because actual variable declarations are hoisted var canDefineTempVariablesInPlace = false; - if (root.kind === 208 /* VariableDeclaration */) { + if (root.kind === 209 /* VariableDeclaration */) { var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 135 /* Parameter */) { + else if (root.kind === 136 /* Parameter */) { canDefineTempVariablesInPlace = true; } - if (root.kind === 178 /* BinaryExpression */) { + if (root.kind === 179 /* BinaryExpression */) { emitAssignmentExpression(root); } else { @@ -30696,11 +31249,11 @@ var ts; if (emitCount++) { write(", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 208 /* VariableDeclaration */ || name.parent.kind === 160 /* BindingElement */); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 /* VariableDeclaration */ || name.parent.kind === 161 /* BindingElement */); var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); if (exportChanged) { write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(name); + emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } if (isVariableDeclarationOrBindingElement) { @@ -30716,7 +31269,7 @@ var ts; } } function ensureIdentifier(expr) { - if (expr.kind !== 66 /* Identifier */) { + if (expr.kind !== 67 /* Identifier */) { var identifier = createTempVariable(0 /* Auto */); if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); @@ -30731,23 +31284,23 @@ var ts; // we need to generate a temporary variable value = ensureIdentifier(value); // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(178 /* BinaryExpression */); + var equals = ts.createSynthesizedNode(179 /* BinaryExpression */); equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(31 /* EqualsEqualsEqualsToken */); + equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(179 /* ConditionalExpression */); + var cond = ts.createSynthesizedNode(180 /* ConditionalExpression */); cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(51 /* QuestionToken */); + cond.questionToken = ts.createSynthesizedNode(52 /* QuestionToken */); cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(52 /* ColonToken */); + cond.colonToken = ts.createSynthesizedNode(53 /* ColonToken */); cond.whenFalse = whenFalse; return cond; } function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(7 /* NumericLiteral */); + var node = ts.createSynthesizedNode(8 /* NumericLiteral */); node.text = "" + value; return node; } @@ -30756,14 +31309,14 @@ var ts; // otherwise occur when the identifier is emitted. var syntheticName = ts.createSynthesizedNode(propName.kind); syntheticName.text = propName.text; - if (syntheticName.kind !== 66 /* Identifier */) { + if (syntheticName.kind !== 67 /* Identifier */) { return createElementAccessExpression(object, syntheticName); } return createPropertyAccessExpression(object, syntheticName); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(165 /* CallExpression */); - var sliceIdentifier = ts.createSynthesizedNode(66 /* Identifier */); + var call = ts.createSynthesizedNode(166 /* CallExpression */); + var sliceIdentifier = ts.createSynthesizedNode(67 /* Identifier */); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); call.arguments = ts.createSynthesizedNodeArray(); @@ -30779,7 +31332,7 @@ var ts; } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 242 /* PropertyAssignment */ || p.kind === 243 /* ShorthandPropertyAssignment */) { + if (p.kind === 243 /* PropertyAssignment */ || p.kind === 244 /* ShorthandPropertyAssignment */) { var propName = p.name; emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); } @@ -30794,8 +31347,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 184 /* OmittedExpression */) { - if (e.kind !== 182 /* SpreadElementExpression */) { + if (e.kind !== 185 /* OmittedExpression */) { + if (e.kind !== 183 /* SpreadElementExpression */) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); } else if (i === elements.length - 1) { @@ -30805,14 +31358,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 178 /* BinaryExpression */ && target.operatorToken.kind === 54 /* EqualsToken */) { + if (target.kind === 179 /* BinaryExpression */ && target.operatorToken.kind === 55 /* EqualsToken */) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 162 /* ObjectLiteralExpression */) { + if (target.kind === 163 /* ObjectLiteralExpression */) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 161 /* ArrayLiteralExpression */) { + else if (target.kind === 162 /* ArrayLiteralExpression */) { emitArrayLiteralAssignment(target, value); } else { @@ -30822,18 +31375,21 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (isAssignmentExpressionStatement) { + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 169 /* ParenthesizedExpression */) { + if (root.parent.kind !== 170 /* ParenthesizedExpression */) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 169 /* ParenthesizedExpression */) { + if (root.parent.kind !== 170 /* ParenthesizedExpression */) { write(")"); } } @@ -30857,12 +31413,12 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 158 /* ObjectBindingPattern */) { + if (pattern.kind === 159 /* ObjectBindingPattern */) { // Rewrite element to a declaration with an initializer that fetches property var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 184 /* OmittedExpression */) { + else if (element.kind !== 185 /* OmittedExpression */) { if (!element.dotDotDotToken) { // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); @@ -30881,7 +31437,7 @@ var ts; function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { if (languageVersion < 2 /* ES6 */) { - emitDestructuring(node, false); + emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); } else { emit(node.name); @@ -30901,15 +31457,15 @@ var ts; (getCombinedFlagsForIdentifier(node.name) & 16384 /* Let */); // NOTE: default initialization should not be added to let bindings in for-in\for-of statements if (isUninitializedLet && - node.parent.parent.kind !== 197 /* ForInStatement */ && - node.parent.parent.kind !== 198 /* ForOfStatement */) { + node.parent.parent.kind !== 198 /* ForInStatement */ && + node.parent.parent.kind !== 199 /* ForOfStatement */) { initializer = createVoidZero(); } } var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); if (exportChanged) { write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); write("\", "); } emitModuleMemberName(node); @@ -30920,11 +31476,11 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 184 /* OmittedExpression */) { + if (node.kind === 185 /* OmittedExpression */) { return; } var name = node.name; - if (name.kind === 66 /* Identifier */) { + if (name.kind === 67 /* Identifier */) { emitExportMemberAssignments(name); } else if (ts.isBindingPattern(name)) { @@ -30932,7 +31488,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 208 /* VariableDeclaration */ && node.parent.kind !== 160 /* BindingElement */)) { + if (!node.parent || (node.parent.kind !== 209 /* VariableDeclaration */ && node.parent.kind !== 161 /* BindingElement */)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -30940,7 +31496,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1 /* Export */) && languageVersion >= 2 /* ES6 */ && - node.parent.kind === 245 /* SourceFile */; + node.parent.kind === 246 /* SourceFile */; } function emitVariableStatement(node) { var startIsEmitted = false; @@ -31029,7 +31585,7 @@ var ts; writeLine(); write("var "); if (hasBindingElements) { - emitDestructuring(parameter, false, tempParameters[tempIndex]); + emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); } else { emit(tempParameters[tempIndex]); @@ -31049,9 +31605,9 @@ var ts; emitEnd(parameter); write(" { "); emitStart(parameter); - emitNodeWithoutSourceMap(paramName); + emitNodeWithCommentsAndWithoutSourcemap(paramName); write(" = "); - emitNodeWithoutSourceMap(initializer); + emitNodeWithCommentsAndWithoutSourcemap(initializer); emitEnd(parameter); write("; }"); } @@ -31071,7 +31627,7 @@ var ts; emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -31092,7 +31648,7 @@ var ts; increaseIndent(); writeLine(); emitStart(restParam); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -31101,27 +31657,27 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 142 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 143 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 171 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 172 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; } function emitDeclarationName(node) { if (node.name) { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } else { write(getGeneratedNameForNode(node)); } } function shouldEmitFunctionName(node) { - if (node.kind === 170 /* FunctionExpression */) { + if (node.kind === 171 /* FunctionExpression */) { // Emit name if one is present return !!node.name; } - if (node.kind === 210 /* FunctionDeclaration */) { + if (node.kind === 211 /* FunctionDeclaration */) { // Emit name if one is present, or emit generated name in down-level case (for export default case) return !!node.name || languageVersion < 2 /* ES6 */; } @@ -31130,10 +31686,25 @@ var ts; if (ts.nodeIsMissing(node.body)) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== 140 /* MethodDeclaration */ && node.kind !== 139 /* MethodSignature */) { - // Methods will emit the comments as part of emitting method declaration + // TODO (yuisu) : we should not have special cases to condition emitting comments + // but have one place to fix check for these conditions. + if (node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */ && + node.parent && node.parent.kind !== 243 /* PropertyAssignment */ && + node.parent.kind !== 166 /* CallExpression */) { + // 1. Methods will emit the comments as part of emitting method declaration + // 2. If the function is a property of object literal, emitting leading-comments + // is done by emitNodeWithoutSourceMap which then call this function. + // In particular, we would like to avoid emit comments twice in following case: + // For example: + // var obj = { + // id: + // /*comment*/ () => void + // } + // 3. If the function is an argument in call expression, emitting of comments will be + // taken care of in emit list of arguments inside of emitCallexpression emitLeadingComments(node); } + emitStart(node); // For targeting below es6, emit functions-like declaration including arrow function using function keyword. // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead if (!shouldEmitAsArrowFunction(node)) { @@ -31153,10 +31724,11 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 /* ES6 */ && node.kind === 210 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 /* ES6 */ && node.kind === 211 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } - if (node.kind !== 140 /* MethodDeclaration */ && node.kind !== 139 /* MethodSignature */) { + emitEnd(node); + if (node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */) { emitTrailingComments(node); } } @@ -31174,7 +31746,7 @@ var ts; if (node) { var parameters = node.parameters; var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); + emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); } write(")"); decreaseIndent(); @@ -31189,7 +31761,7 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 171 /* ArrowFunction */; + var isArrowFunction = node.kind === 172 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; var args; // An async function is emit as an outer function that calls an inner @@ -31310,7 +31882,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 189 /* Block */) { + if (node.body.kind === 190 /* Block */) { emitBlockFunctionBody(node, node.body); } else { @@ -31365,10 +31937,10 @@ var ts; write(" "); // Unwrap all type assertions. var current = body; - while (current.kind === 168 /* TypeAssertionExpression */) { + while (current.kind === 169 /* TypeAssertionExpression */) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 162 /* ObjectLiteralExpression */); + emitParenthesizedIf(body, current.kind === 163 /* ObjectLiteralExpression */); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -31388,7 +31960,7 @@ var ts; emit(body); emitEnd(body); write(";"); - emitTempDeclarations(false); + emitTempDeclarations(/*newLine*/ false); write(" "); } else { @@ -31399,7 +31971,7 @@ var ts; emit(body); write(";"); emitTrailingComments(node.body); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); } @@ -31416,7 +31988,7 @@ var ts; emitDetachedComments(body.statements); // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). - var startIndex = emitDirectivePrologues(body.statements, true); + var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; @@ -31426,29 +31998,29 @@ var ts; write(" "); emit(statement); } - emitTempDeclarations(false); + emitTempDeclarations(/*newLine*/ false); write(" "); emitLeadingCommentsOfPosition(body.statements.end); } else { increaseIndent(); emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); writeLine(); emitLeadingCommentsOfPosition(body.statements.end); decreaseIndent(); } - emitToken(15 /* CloseBraceToken */, body.statements.end); + emitToken(16 /* CloseBraceToken */, body.statements.end); scopeEmitEnd(); } function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 192 /* ExpressionStatement */) { + if (statement && statement.kind === 193 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 165 /* CallExpression */) { + if (expr && expr.kind === 166 /* CallExpression */) { var func = expr.expression; - if (func && func.kind === 92 /* SuperKeyword */) { + if (func && func.kind === 93 /* SuperKeyword */) { return statement; } } @@ -31472,25 +32044,27 @@ var ts; }); } function emitMemberAccessForPropertyName(memberName) { - // TODO: (jfreeman,drosen): comment on why this is emitNodeWithoutSourceMap instead of emit here. - if (memberName.kind === 8 /* StringLiteral */ || memberName.kind === 7 /* NumericLiteral */) { + // This does not emit source map because it is emitted by caller as caller + // is aware how the property name changes to the property access + // eg. public x = 10; becomes this.x and static x = 10 becomes className.x + if (memberName.kind === 9 /* StringLiteral */ || memberName.kind === 8 /* NumericLiteral */) { write("["); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 133 /* ComputedPropertyName */) { + else if (memberName.kind === 134 /* ComputedPropertyName */) { emitComputedPropertyName(memberName); } else { write("."); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); } } function getInitializedProperties(node, isStatic) { var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 138 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { + if (member.kind === 139 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { properties.push(member); } } @@ -31530,11 +32104,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 188 /* SemicolonClassElement */) { + if (member.kind === 189 /* SemicolonClassElement */) { writeLine(); write(";"); } - else if (member.kind === 140 /* MethodDeclaration */ || node.kind === 139 /* MethodSignature */) { + else if (member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -31546,14 +32120,12 @@ var ts; emitMemberAccessForPropertyName(member.name); emitEnd(member.name); write(" = "); - emitStart(member); emitFunctionDeclaration(member); emitEnd(member); - emitEnd(member); write(";"); emitTrailingComments(member); } - else if (member.kind === 142 /* GetAccessor */ || member.kind === 143 /* SetAccessor */) { + else if (member.kind === 143 /* GetAccessor */ || member.kind === 144 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -31603,22 +32175,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 140 /* MethodDeclaration */ || node.kind === 139 /* MethodSignature */) && !member.body) { + if ((member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 140 /* MethodDeclaration */ || - member.kind === 142 /* GetAccessor */ || - member.kind === 143 /* SetAccessor */) { + else if (member.kind === 141 /* MethodDeclaration */ || + member.kind === 143 /* GetAccessor */ || + member.kind === 144 /* SetAccessor */) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 128 /* Static */) { write("static "); } - if (member.kind === 142 /* GetAccessor */) { + if (member.kind === 143 /* GetAccessor */) { write("get "); } - else if (member.kind === 143 /* SetAccessor */) { + else if (member.kind === 144 /* SetAccessor */) { write("set "); } if (member.asteriskToken) { @@ -31629,7 +32201,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 188 /* SemicolonClassElement */) { + else if (member.kind === 189 /* SemicolonClassElement */) { writeLine(); write(";"); } @@ -31654,11 +32226,11 @@ var ts; var hasInstancePropertyWithInitializer = false; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { - if (member.kind === 141 /* Constructor */ && !member.body) { + if (member.kind === 142 /* Constructor */ && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } // Check if there is any non-static property assignment - if (member.kind === 138 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { + if (member.kind === 139 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -31697,18 +32269,23 @@ var ts; } } } + var startIndex = 0; write(" {"); scopeEmitStart(node, "constructor"); increaseIndent(); if (ctor) { + // Emit all the directive prologues (like "use strict"). These have to come before + // any other preamble code we write (like parameter initializers). + startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); emitDetachedComments(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); + var superCall; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -31729,21 +32306,21 @@ var ts; emitEnd(baseTypeElement); } } - emitPropertyDeclarations(node, getInitializedProperties(node, false)); + emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); if (ctor) { var statements = ctor.body.statements; if (superCall) { statements = statements.slice(1); } - emitLines(statements); + emitLinesStartingAt(statements, startIndex); } - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); writeLine(); if (ctor) { emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(15 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -31766,7 +32343,7 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { if (thisNodeIsDecorated) { // To preserve the correct runtime semantics when decorators are applied to the class, // the emit needs to follow one of the following rules: @@ -31845,8 +32422,8 @@ var ts; // // This keeps the expression as an expression, while ensuring that the static parts // of it have been initialized by the time it is used. - var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 183 /* ClassExpression */; + var staticProperties = getInitializedProperties(node, /*static:*/ true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184 /* ClassExpression */; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0 /* Auto */); @@ -31874,7 +32451,7 @@ var ts; emitMemberFunctionsForES6AndHigher(node); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end); + emitToken(16 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. // For a decorated class, we need to assign its name (if it has one). This is because we emit @@ -31897,7 +32474,7 @@ var ts; var property = staticProperties[_a]; write(","); writeLine(); - emitPropertyDeclaration(node, property, tempVariable, true); + emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); } write(","); writeLine(); @@ -31930,7 +32507,7 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { // source file level classes in system modules are hoisted so 'var's for them are already defined if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); @@ -31965,23 +32542,23 @@ var ts; writeLine(); emitConstructor(node, baseTypeNode); emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, true)); + emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); writeLine(); emitDecoratorsOfClass(node); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end, function () { + emitToken(16 /* CloseBraceToken */, node.members.end, function () { write("return "); emitDeclarationName(node); }); write(";"); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); tempFlags = saveTempFlags; tempVariables = saveTempVariables; tempParameters = saveTempParameters; computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end); + emitToken(16 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -31989,11 +32566,11 @@ var ts; emit(baseTypeNode.expression); } write(")"); - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { write(";"); } emitEnd(node); - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { emitExportMemberAssignment(node); } if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile && node.name) { @@ -32007,7 +32584,7 @@ var ts; } } function emitDecoratorsOfClass(node) { - emitDecoratorsOfMembers(node, 0); + emitDecoratorsOfMembers(node, /*staticFlag*/ 0); emitDecoratorsOfMembers(node, 128 /* Static */); emitDecoratorsOfConstructor(node); } @@ -32036,13 +32613,13 @@ var ts; increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { emitStart(decorator); emit(decorator.expression); emitEnd(decorator); }); - argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); - emitSerializedTypeMetadata(node, argumentsWritten >= 0); + argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); decreaseIndent(); writeLine(); write("], "); @@ -32085,7 +32662,7 @@ var ts; else { decorators = member.decorators; // we only decorate the parameters here if this is a method - if (member.kind === 140 /* MethodDeclaration */) { + if (member.kind === 141 /* MethodDeclaration */) { functionLikeMember = member; } } @@ -32123,7 +32700,7 @@ var ts; // writeLine(); emitStart(member); - if (member.kind !== 138 /* PropertyDeclaration */) { + if (member.kind !== 139 /* PropertyDeclaration */) { write("Object.defineProperty("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -32138,7 +32715,7 @@ var ts; increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { emitStart(decorator); emit(decorator.expression); emitEnd(decorator); @@ -32153,7 +32730,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - if (member.kind !== 138 /* PropertyDeclaration */) { + if (member.kind !== 139 /* PropertyDeclaration */) { write(", Object.getOwnPropertyDescriptor("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -32176,7 +32753,7 @@ var ts; var parameter = _b[_a]; if (ts.nodeIsDecorated(parameter)) { var decorators = parameter.decorators; - argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { + argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { emitStart(decorator); write("__param(" + parameterIndex + ", "); emit(decorator.expression); @@ -32195,10 +32772,10 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 138 /* PropertyDeclaration */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 139 /* PropertyDeclaration */: return true; } return false; @@ -32208,7 +32785,7 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 140 /* MethodDeclaration */: + case 141 /* MethodDeclaration */: return true; } return false; @@ -32218,9 +32795,9 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 211 /* ClassDeclaration */: - case 140 /* MethodDeclaration */: - case 143 /* SetAccessor */: + case 212 /* ClassDeclaration */: + case 141 /* MethodDeclaration */: + case 144 /* SetAccessor */: return true; } return false; @@ -32238,19 +32815,19 @@ var ts; // // For rules on serializing type annotations, see `serializeTypeNode`. switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: write("Function"); return; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: emitSerializedTypeNode(node.type); return; - case 135 /* Parameter */: + case 136 /* Parameter */: emitSerializedTypeNode(node.type); return; - case 142 /* GetAccessor */: + case 143 /* GetAccessor */: emitSerializedTypeNode(node.type); return; - case 143 /* SetAccessor */: + case 144 /* SetAccessor */: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -32261,43 +32838,46 @@ var ts; write("void 0"); } function emitSerializedTypeNode(node) { + if (!node) { + return; + } switch (node.kind) { - case 100 /* VoidKeyword */: + case 101 /* VoidKeyword */: write("void 0"); return; - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: emitSerializedTypeNode(node.type); return; - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: write("Function"); return; - case 153 /* ArrayType */: - case 154 /* TupleType */: + case 154 /* ArrayType */: + case 155 /* TupleType */: write("Array"); return; - case 147 /* TypePredicate */: - case 117 /* BooleanKeyword */: + case 148 /* TypePredicate */: + case 118 /* BooleanKeyword */: write("Boolean"); return; - case 127 /* StringKeyword */: - case 8 /* StringLiteral */: + case 128 /* StringKeyword */: + case 9 /* StringLiteral */: write("String"); return; - case 125 /* NumberKeyword */: + case 126 /* NumberKeyword */: write("Number"); return; - case 128 /* SymbolKeyword */: + case 129 /* SymbolKeyword */: write("Symbol"); return; - case 148 /* TypeReference */: + case 149 /* TypeReference */: emitSerializedTypeReferenceNode(node); return; - case 151 /* TypeQuery */: - case 152 /* TypeLiteral */: - case 155 /* UnionType */: - case 156 /* IntersectionType */: - case 114 /* AnyKeyword */: + case 152 /* TypeQuery */: + case 153 /* TypeLiteral */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: + case 115 /* AnyKeyword */: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -32307,21 +32887,27 @@ var ts; } /** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */ function emitSerializedTypeReferenceNode(node) { - var typeName = node.typeName; - var result = resolver.getTypeReferenceSerializationKind(node); + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + // Clone the type name and parent it to a location outside of the current declaration. + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); switch (result) { case ts.TypeReferenceSerializationKind.Unknown: var temp = createAndRecordTempVariable(0 /* Auto */); write("(typeof ("); emitNodeWithoutSourceMap(temp); write(" = "); - emitEntityNameAsExpression(typeName, true); + emitEntityNameAsExpression(typeName, /*useFallback*/ true); write(") === 'function' && "); emitNodeWithoutSourceMap(temp); write(") || Object"); break; case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: - emitEntityNameAsExpression(typeName, false); + emitEntityNameAsExpression(typeName, /*useFallback*/ false); break; case ts.TypeReferenceSerializationKind.VoidType: write("void 0"); @@ -32364,7 +32950,7 @@ var ts; // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { var valueDeclaration; - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -32380,10 +32966,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 153 /* ArrayType */) { + if (parameterType.kind === 154 /* ArrayType */) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 148 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 149 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -32401,7 +32987,7 @@ var ts; } /** Serializes the return type of function. Used by the __metadata decorator for a method. */ function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node)) { + if (node && ts.isFunctionLike(node) && node.type) { emitSerializedTypeNode(node.type); return; } @@ -32482,7 +33068,7 @@ var ts; emitLines(node.members); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end); + emitToken(16 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -32543,7 +33129,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 215 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 216 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -32579,7 +33165,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 216 /* ModuleBlock */) { + if (node.body.kind === 217 /* ModuleBlock */) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -32598,7 +33184,7 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(15 /* CloseBraceToken */, moduleBlock.statements.end); + emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); @@ -32612,7 +33198,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 66 /* Identifier */ && node.parent === currentSourceFile) { + if (!isES6ExportedDeclaration(node) && node.name.kind === 67 /* Identifier */ && node.parent === currentSourceFile) { if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { writeLine(); write(exportFunctionForFile + "(\""); @@ -32624,29 +33210,45 @@ var ts; emitExportMemberAssignments(node.name); } } + /* + * Some bundlers (SystemJS builder) sometimes want to rename dependencies. + * Here we check if alternative name was provided for a given moduleName and return it if possible. + */ + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } function emitRequire(moduleName) { - if (moduleName.kind === 8 /* StringLiteral */) { + if (moduleName.kind === 9 /* StringLiteral */) { write("require("); - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - emitToken(17 /* CloseParenToken */, moduleName.end); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18 /* CloseParenToken */, moduleName.end); } else { write("require()"); } } function getNamespaceDeclarationNode(node) { - if (node.kind === 218 /* ImportEqualsDeclaration */) { + if (node.kind === 219 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222 /* NamespaceImport */) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 219 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 220 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -32661,7 +33263,7 @@ var ts; // ES6 import if (node.importClause) { var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); - var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); + var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, /* checkChildren */ true); if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { write("import "); emitStart(node.importClause); @@ -32674,7 +33276,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 222 /* NamespaceImport */) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -32700,7 +33302,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 218 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var isExportedImport = node.kind === 219 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2 /* AMD */) { emitLeadingComments(node); @@ -32719,7 +33321,7 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 219 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = 220 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -32770,16 +33372,33 @@ var ts; (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); + // variable declaration for import-equals declaration can be hoisted in system modules + // in this case 'var' should be omitted and emit should contain only initialization + var variableDeclarationIsHoisted = shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); + // is it top level export import v = a.b.c in system module? + // if yes - it needs to be rewritten as exporter('v', v = a.b.c) + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1 /* Export */)) { + write("var "); + } } - else if (!(node.flags & 1 /* Export */)) { - write("var "); + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); } emitModuleMemberName(node); write(" = "); emit(node.moduleReference); + if (isExported) { + write(")"); + } write(";"); emitEnd(node); emitExportImportAssignments(node); @@ -32808,11 +33427,11 @@ var ts; emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); write(" = "); write(generatedName); write("."); - emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); } @@ -32835,7 +33454,6 @@ var ts; } else { if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - emitStart(node); write("export "); if (node.exportClause) { // export { x, y, ... } @@ -32848,10 +33466,9 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - emitNodeWithoutSourceMap(node.moduleSpecifier); + emit(node.moduleSpecifier); } write(";"); - emitEnd(node); } } } @@ -32864,13 +33481,11 @@ var ts; if (needsComma) { write(", "); } - emitStart(specifier); if (specifier.propertyName) { - emitNodeWithoutSourceMap(specifier.propertyName); + emit(specifier.propertyName); write(" as "); } - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier); + emit(specifier.name); needsComma = true; } } @@ -32883,8 +33498,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 210 /* FunctionDeclaration */ && - expression.kind !== 211 /* ClassDeclaration */) { + if (expression.kind !== 211 /* FunctionDeclaration */ && + expression.kind !== 212 /* ClassDeclaration */) { write(";"); } emitEnd(node); @@ -32898,6 +33513,7 @@ var ts; write(")"); } else { + emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0 /* ES3 */) { write("[\"default\"] = "); @@ -32920,9 +33536,9 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, true)) { + resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { // import "mod" // import x from "mod" where x is referenced // import * as x from "mod" where x is referenced @@ -32930,13 +33546,13 @@ var ts; externalImports.push(node); } break; - case 218 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 229 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + case 219 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 230 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { // import x = require("mod") where x is referenced externalImports.push(node); } break; - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -32957,7 +33573,7 @@ var ts; } } break; - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; @@ -32983,17 +33599,17 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); } - if (node.kind === 219 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 220 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 225 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 226 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } function getExternalModuleNameText(importNode) { var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 8 /* StringLiteral */) { - return getLiteralText(moduleName); + if (moduleName.kind === 9 /* StringLiteral */) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); } return undefined; } @@ -33006,8 +33622,8 @@ var ts; for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; // do not create variable declaration for exports and imports that lack import clause - var skipNode = importNode.kind === 225 /* ExportDeclaration */ || - (importNode.kind === 219 /* ImportDeclaration */ && !importNode.importClause); + var skipNode = importNode.kind === 226 /* ExportDeclaration */ || + (importNode.kind === 220 /* ImportDeclaration */ && !importNode.importClause); if (skipNode) { continue; } @@ -33040,14 +33656,14 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0; _a < externalImports.length; _a++) { var externalImport = externalImports[_a]; - if (externalImport.kind === 225 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 226 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } } if (!hasExportDeclarationWithExportClause) { // we still need to emit exportStar helper - return emitExportStarFunction(undefined); + return emitExportStarFunction(/*localNames*/ undefined); } } var exportedNamesStorageRef = makeUniqueName("exportedNames"); @@ -33072,7 +33688,7 @@ var ts; } for (var _d = 0; _d < externalImports.length; _d++) { var externalImport = externalImports[_d]; - if (externalImport.kind !== 225 /* ExportDeclaration */) { + if (externalImport.kind !== 226 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -33097,6 +33713,8 @@ var ts; write("function " + exportStarFunction + "(m) {"); increaseIndent(); writeLine(); + write("var exports = {};"); + writeLine(); write("for(var n in m) {"); increaseIndent(); writeLine(); @@ -33104,10 +33722,12 @@ var ts; if (localNames) { write("&& !" + localNames + ".hasOwnProperty(n)"); } - write(") " + exportFunctionForFile + "(n, m[n]);"); + write(") exports[n] = m[n];"); decreaseIndent(); writeLine(); write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); decreaseIndent(); writeLine(); write("}"); @@ -33116,7 +33736,7 @@ var ts; function writeExportedName(node) { // do not record default exports // they are local to module and never overwritten (explicitly skipped) by star export - if (node.kind !== 66 /* Identifier */ && node.flags & 1024 /* Default */) { + if (node.kind !== 67 /* Identifier */ && node.flags & 1024 /* Default */) { return; } if (started) { @@ -33127,8 +33747,8 @@ var ts; } writeLine(); write("'"); - if (node.kind === 66 /* Identifier */) { - emitNodeWithoutSourceMap(node); + if (node.kind === 67 /* Identifier */) { + emitNodeWithCommentsAndWithoutSourcemap(node); } else { emitDeclarationName(node); @@ -33156,7 +33776,7 @@ var ts; var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; - var name_25 = local.kind === 66 /* Identifier */ + var name_25 = local.kind === 67 /* Identifier */ ? local : local.name; if (name_25) { @@ -33172,13 +33792,13 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 211 /* ClassDeclaration */ || local.kind === 215 /* ModuleDeclaration */ || local.kind === 214 /* EnumDeclaration */) { + if (local.kind === 212 /* ClassDeclaration */ || local.kind === 216 /* ModuleDeclaration */ || local.kind === 215 /* EnumDeclaration */) { emitDeclarationName(local); } else { emit(local); } - var flags = ts.getCombinedNodeFlags(local.kind === 66 /* Identifier */ ? local.parent : local); + var flags = ts.getCombinedNodeFlags(local.kind === 67 /* Identifier */ ? local.parent : local); if (flags & 1 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; @@ -33206,21 +33826,21 @@ var ts; if (node.flags & 2 /* Ambient */) { return; } - if (node.kind === 210 /* FunctionDeclaration */) { + if (node.kind === 211 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 214 /* EnumDeclaration */) { + if (node.kind === 215 /* EnumDeclaration */) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -33229,7 +33849,7 @@ var ts; } return; } - if (node.kind === 215 /* ModuleDeclaration */) { + if (node.kind === 216 /* ModuleDeclaration */) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -33238,10 +33858,10 @@ var ts; } return; } - if (node.kind === 208 /* VariableDeclaration */ || node.kind === 160 /* BindingElement */) { - if (shouldHoistVariable(node, false)) { + if (node.kind === 209 /* VariableDeclaration */ || node.kind === 161 /* BindingElement */) { + if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { var name_26 = node.name; - if (name_26.kind === 66 /* Identifier */) { + if (name_26.kind === 67 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } @@ -33253,6 +33873,13 @@ var ts; } return; } + if (ts.isInternalModuleImportEqualsDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } if (ts.isBindingPattern(node)) { ts.forEach(node.elements, visit); return; @@ -33272,12 +33899,12 @@ var ts; // if block scoped variables are nested in some another block then // no other functions can use them except ones that are defined at least in the same block return (ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 245 /* SourceFile */; + ts.getEnclosingBlockScopeContainer(node).kind === 246 /* SourceFile */; } function isCurrentFileSystemExternalModule() { return compilerOptions.module === 4 /* System */ && ts.isExternalModule(currentSourceFile); } - function emitSystemModuleBody(node, startIndex) { + function emitSystemModuleBody(node, dependencyGroups, startIndex) { // shape of the body in system modules: // function (exports) { // @@ -33322,105 +33949,86 @@ var ts; write("return {"); increaseIndent(); writeLine(); - emitSetters(exportStarFunction); + emitSetters(exportStarFunction, dependencyGroups); writeLine(); emitExecute(node, startIndex); decreaseIndent(); writeLine(); write("}"); // return - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); } - function emitSetters(exportStarFunction) { + function emitSetters(exportStarFunction, dependencyGroups) { write("setters:["); - for (var i = 0; i < externalImports.length; ++i) { + for (var i = 0; i < dependencyGroups.length; ++i) { if (i !== 0) { write(","); } writeLine(); increaseIndent(); - var importNode = externalImports[i]; - var importVariableName = getLocalNameForExternalImport(importNode) || ""; - var parameterName = "_" + importVariableName; + var group = dependencyGroups[i]; + // derive a unique name for parameter from the first named entry in the group + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); write("function (" + parameterName + ") {"); - switch (importNode.kind) { - case 219 /* ImportDeclaration */: - if (!importNode.importClause) { - // 'import "..."' case - // module is imported only for side-effects, setter body will be empty - break; - } - // fall-through - case 218 /* ImportEqualsDeclaration */: - ts.Debug.assert(importVariableName !== ""); - increaseIndent(); - writeLine(); - // save import into the local - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - var defaultName = importNode.kind === 219 /* ImportDeclaration */ - ? importNode.importClause.name - : importNode.name; - if (defaultName) { - // emit re-export for imported default name - // import n1 from 'foo1' - // import n2 = require('foo2') - // export {n1} - // export {n2} - emitExportMemberAssignments(defaultName); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 220 /* ImportDeclaration */: + if (!entry.importClause) { + // 'import "..."' case + // module is imported only for side-effects, no emit required + break; + } + // fall-through + case 219 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== ""); writeLine(); - } - if (importNode.kind === 219 /* ImportDeclaration */ && - importNode.importClause.namedBindings) { - var namedBindings = importNode.importClause.namedBindings; - if (namedBindings.kind === 221 /* NamespaceImport */) { - // emit re-export for namespace - // import * as n from 'foo' - // export {n} - emitExportMemberAssignments(namedBindings.name); + // save import into the local + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 226 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { + // export {a, b as c} from 'foo' + // emit as: + // exports_({ + // "a": _["a"], + // "c": _["b"] + // }); writeLine(); - } - else { - // emit re-exports for named imports - // import {a, b} from 'foo' - // export {a, b as c} - for (var _a = 0, _b = namedBindings.elements; _a < _b.length; _a++) { - var element = _b[_a]; - emitExportMemberAssignments(element.name || element.propertyName); - writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); } + decreaseIndent(); + writeLine(); + write("});"); } - } - decreaseIndent(); - break; - case 225 /* ExportDeclaration */: - ts.Debug.assert(importVariableName !== ""); - increaseIndent(); - if (importNode.exportClause) { - // export {a, b as c} from 'foo' - // emit as: - // exports('a', _foo["a"]) - // exports('c', _foo["b"]) - for (var _c = 0, _d = importNode.exportClause.elements; _c < _d.length; _c++) { - var e = _d[_c]; + else { writeLine(); - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(e.name); - write("\", " + parameterName + "[\""); - emitNodeWithoutSourceMap(e.propertyName || e.name); - write("\"]);"); + // export * from 'foo' + // emit as: + // exportStar(_foo); + write(exportStarFunction + "(" + parameterName + ");"); } - } - else { writeLine(); - // export * from 'foo' - // emit as: - // exportStar(_foo); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - decreaseIndent(); - break; + break; + } } + decreaseIndent(); write("}"); decreaseIndent(); } @@ -33432,17 +34040,33 @@ var ts; writeLine(); for (var i = startIndex; i < node.statements.length; ++i) { var statement = node.statements[i]; - // - imports/exports are not emitted for system modules - // - function declarations are not emitted because they were already hoisted switch (statement.kind) { - case 225 /* ExportDeclaration */: - case 219 /* ImportDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 210 /* FunctionDeclaration */: + // - function declarations are not emitted because they were already hoisted + // - import declarations are not emitted since they are already handled in setters + // - export declarations with module specifiers are not emitted since they were already written in setters + // - export declarations without module specifiers are emitted preserving the order + case 211 /* FunctionDeclaration */: + case 220 /* ImportDeclaration */: + continue; + case 226 /* ExportDeclaration */: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + // write call to exporter function for every export specifier in exports list + emitExportSpecifierInSystemModule(element); + } + } continue; + case 219 /* ImportEqualsDeclaration */: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + // - import equals declarations that import external modules are not emitted + continue; + } + // fall-though for import declarations that import internal modules + default: + writeLine(); + emit(statement); } - writeLine(); - emit(statement); } decreaseIndent(); writeLine(); @@ -33467,8 +34091,20 @@ var ts; write("\"" + node.moduleName + "\", "); } write("["); + var groupIndices = {}; + var dependencyGroups = []; for (var i = 0; i < externalImports.length; ++i) { var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + // deduplicate/group entries in dependency list by the dependency name + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } if (i !== 0) { write(", "); } @@ -33477,8 +34113,9 @@ var ts; write("], function(" + exportFunctionForFile + ") {"); writeLine(); increaseIndent(); + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, startIndex); + emitSystemModuleBody(node, dependencyGroups, startIndex); decreaseIndent(); writeLine(); write("});"); @@ -33543,33 +34180,36 @@ var ts; } } function emitAMDModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); if (node.moduleName) { write("\"" + node.moduleName + "\", "); } - emitAMDDependencies(node, true); + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); write(") {"); increaseIndent(); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); decreaseIndent(); writeLine(); write("});"); } function emitCommonJSModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(false); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ false); } function emitUMDModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); // Module is detected first to support Browserify users that load into a browser with an AMD loader writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); @@ -33579,8 +34219,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); decreaseIndent(); writeLine(); write("});"); @@ -33590,9 +34230,10 @@ var ts; exportSpecifiers = undefined; exportEquals = undefined; hasExportStars = false; + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); // Emit exportDefault if it exists will happen as part // or normal statement emit. } @@ -33618,7 +34259,7 @@ var ts; break; } } - function trimReactWhitespace(node) { + function trimReactWhitespaceAndApplyEntities(node) { var result = undefined; var text = ts.getTextOfNode(node); var firstNonWhitespace = 0; @@ -33631,7 +34272,7 @@ var ts; if (ts.isLineBreak(c)) { if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + '" + \' \' + "' : '') + part; + result = (result ? result + "\" + ' ' + \"" : "") + part; } firstNonWhitespace = -1; } @@ -33644,15 +34285,26 @@ var ts; } if (firstNonWhitespace !== -1) { var part = text.substr(firstNonWhitespace); - result = (result ? result + '" + \' \' + "' : '') + part; + result = (result ? result + "\" + ' ' + \"" : "") + part; + } + if (result) { + // Replace entities like   + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); } return result; } function getTextToEmit(node) { switch (compilerOptions.jsx) { case 2 /* React */: - var text = trimReactWhitespace(node); - if (text.length === 0) { + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { return undefined; } else { @@ -33666,13 +34318,13 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2 /* React */: - write('"'); - write(trimReactWhitespace(node)); - write('"'); + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); break; case 1 /* Preserve */: default: - write(ts.getTextOfNode(node, true)); + writer.writeLiteral(ts.getTextOfNode(node, true)); break; } } @@ -33681,9 +34333,9 @@ var ts; switch (compilerOptions.jsx) { case 1 /* Preserve */: default: - write('{'); + write("{"); emit(node.expression); - write('}'); + write("}"); break; case 2 /* React */: emit(node.expression); @@ -33716,12 +34368,7 @@ var ts; } } } - function emitSourceFileNode(node) { - // Start new file on new line - writeLine(); - emitDetachedComments(node); - // emit prologue directives prior to __extends - var startIndex = emitDirectivePrologues(node.statements, false); + function emitEmitHelpers(node) { // Only emit helpers if the user did not say otherwise. if (!compilerOptions.noEmitHelpers) { // Only Emit __extends function when target ES5. @@ -33746,6 +34393,14 @@ var ts; awaiterEmitted = true; } } + } + function emitSourceFileNode(node) { + // Start new file on new line + writeLine(); + emitShebang(); + emitDetachedComments(node); + // emit prologue directives prior to __extends + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { if (languageVersion >= 2 /* ES6 */) { emitES6Module(node, startIndex); @@ -33768,57 +34423,76 @@ var ts; exportSpecifiers = undefined; exportEquals = undefined; hasExportStars = false; + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); } emitLeadingComments(node.endOfFileToken); } - function emitNodeWithoutSourceMap(node) { - if (!node) { - return; - } - if (node.flags & 2 /* Ambient */) { - return emitOnlyPinnedOrTripleSlashComments(node); - } - var emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { - emitLeadingComments(node); + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2 /* Ambient */) { + return emitOnlyPinnedOrTripleSlashComments(node); + } + if (isSpecializedCommentHandling(node)) { + // This is the node that will handle its own comments and sourcemap + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } } - emitJavaScriptWorker(node); - if (emitComments) { - emitTrailingComments(node); + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); } } - function shouldEmitLeadingAndTrailingComments(node) { + function isSpecializedCommentHandling(node) { switch (node.kind) { // All of these entities are emitted in a specialized fashion. As such, we allow // the specialized methods for each to handle the comments on the nodes. - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: - case 219 /* ImportDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 224 /* ExportAssignment */: - return false; - case 190 /* VariableStatement */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: + case 220 /* ImportDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 225 /* ExportAssignment */: + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 191 /* VariableStatement */: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); } + // If the node is emitted in specialized fashion, dont emit comments as this node will handle + // emitting comments when emitting itself + ts.Debug.assert(!isSpecializedCommentHandling(node)); // If this is the expression body of an arrow function that we're down-leveling, // then we don't want to emit comments when we emit the body. It will have already // been taken care of when we emitted the 'return' statement for the function // expression body. - if (node.kind !== 189 /* Block */ && + if (node.kind !== 190 /* Block */ && node.parent && - node.parent.kind === 171 /* ArrowFunction */ && + node.parent.kind === 172 /* ArrowFunction */ && node.parent.body === node && compilerOptions.target <= 1 /* ES5 */) { return false; @@ -33829,170 +34503,170 @@ var ts; function emitJavaScriptWorker(node) { // Check if the node can be emitted regardless of the ScriptTarget switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return emitIdentifier(node); - case 135 /* Parameter */: + case 136 /* Parameter */: return emitParameter(node); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return emitMethod(node); - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return emitAccessor(node); - case 94 /* ThisKeyword */: + case 95 /* ThisKeyword */: return emitThis(node); - case 92 /* SuperKeyword */: + case 93 /* SuperKeyword */: return emitSuper(node); - case 90 /* NullKeyword */: + case 91 /* NullKeyword */: return write("null"); - case 96 /* TrueKeyword */: + case 97 /* TrueKeyword */: return write("true"); - case 81 /* FalseKeyword */: + case 82 /* FalseKeyword */: 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 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 10 /* RegularExpressionLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 12 /* TemplateHead */: + case 13 /* TemplateMiddle */: + case 14 /* TemplateTail */: return emitLiteral(node); - case 180 /* TemplateExpression */: + case 181 /* TemplateExpression */: return emitTemplateExpression(node); - case 187 /* TemplateSpan */: + case 188 /* TemplateSpan */: return emitTemplateSpan(node); - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: return emitJsxElement(node); - case 233 /* JsxText */: + case 234 /* JsxText */: return emitJsxText(node); - case 237 /* JsxExpression */: + case 238 /* JsxExpression */: return emitJsxExpression(node); - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: return emitQualifiedName(node); - case 158 /* ObjectBindingPattern */: + case 159 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 159 /* ArrayBindingPattern */: + case 160 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 160 /* BindingElement */: + case 161 /* BindingElement */: return emitBindingElement(node); - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return emitArrayLiteral(node); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return emitObjectLiteral(node); - case 242 /* PropertyAssignment */: + case 243 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 243 /* ShorthandPropertyAssignment */: + case 244 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 163 /* PropertyAccessExpression */: + case 164 /* PropertyAccessExpression */: return emitPropertyAccess(node); - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: return emitIndexedAccess(node); - case 165 /* CallExpression */: + case 166 /* CallExpression */: return emitCallExpression(node); - case 166 /* NewExpression */: + case 167 /* NewExpression */: return emitNewExpression(node); - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 168 /* TypeAssertionExpression */: + case 169 /* TypeAssertionExpression */: return emit(node.expression); - case 186 /* AsExpression */: + case 187 /* AsExpression */: return emit(node.expression); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return emitParenExpression(node); - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 172 /* DeleteExpression */: + case 173 /* DeleteExpression */: return emitDeleteExpression(node); - case 173 /* TypeOfExpression */: + case 174 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 174 /* VoidExpression */: + case 175 /* VoidExpression */: return emitVoidExpression(node); - case 175 /* AwaitExpression */: + case 176 /* AwaitExpression */: return emitAwaitExpression(node); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 177 /* PostfixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return emitBinaryExpression(node); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return emitConditionalExpression(node); - case 182 /* SpreadElementExpression */: + case 183 /* SpreadElementExpression */: return emitSpreadElementExpression(node); - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: return emitYieldExpression(node); - case 184 /* OmittedExpression */: + case 185 /* OmittedExpression */: return; - case 189 /* Block */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return emitBlock(node); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return emitVariableStatement(node); - case 191 /* EmptyStatement */: + case 192 /* EmptyStatement */: return write(";"); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: return emitExpressionStatement(node); - case 193 /* IfStatement */: + case 194 /* IfStatement */: return emitIfStatement(node); - case 194 /* DoStatement */: + case 195 /* DoStatement */: return emitDoStatement(node); - case 195 /* WhileStatement */: + case 196 /* WhileStatement */: return emitWhileStatement(node); - case 196 /* ForStatement */: + case 197 /* ForStatement */: return emitForStatement(node); - case 198 /* ForOfStatement */: - case 197 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 198 /* ForInStatement */: return emitForInOrForOfStatement(node); - case 199 /* ContinueStatement */: - case 200 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 201 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: return emitReturnStatement(node); - case 202 /* WithStatement */: + case 203 /* WithStatement */: return emitWithStatement(node); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: return emitSwitchStatement(node); - case 238 /* CaseClause */: - case 239 /* DefaultClause */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return emitLabelledStatement(node); - case 205 /* ThrowStatement */: + case 206 /* ThrowStatement */: return emitThrowStatement(node); - case 206 /* TryStatement */: + case 207 /* TryStatement */: return emitTryStatement(node); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return emitCatchClause(node); - case 207 /* DebuggerStatement */: + case 208 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: return emitClassExpression(node); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return emitClassDeclaration(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return emitEnumMember(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: return emitImportDeclaration(node); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return emitExportDeclaration(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return emitExportAssignment(node); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return emitSourceFileNode(node); } } @@ -34010,6 +34684,11 @@ var ts; } return leadingComments; } + /** + * Removes all but the pinned or triple slash comments. + * @param ranges The array to be filtered + * @param onlyPinnedOrTripleSlashComments whether the filtering should be performed. + */ function filterComments(ranges, onlyPinnedOrTripleSlashComments) { // If we're removing comments, then we want to strip out all but the pinned or // triple slash comments. @@ -34024,7 +34703,7 @@ var ts; function getLeadingCommentsToEmit(node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 245 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 246 /* SourceFile */ || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { // get comments without detached comments return getLeadingCommentsWithoutDetachedComments(); @@ -34039,16 +34718,16 @@ var ts; function getTrailingCommentsToEmit(node) { // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 245 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 246 /* SourceFile */ || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } } function emitOnlyPinnedOrTripleSlashComments(node) { - emitLeadingCommentsWorker(node, true); + emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ true); } function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, compilerOptions.removeComments); + return emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); } function emitLeadingCommentsWorker(node, onlyPinnedOrTripleSlashComments) { // If the caller only wants pinned or triple slash comments, then always filter @@ -34056,13 +34735,23 @@ var ts; var leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitTrailingComments(node) { // Emit the trailing comments only if the parent's end doesn't match - var trailingComments = filterComments(getTrailingCommentsToEmit(node), compilerOptions.removeComments); + var trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + } + /** + * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: + * x, /comment1/ y + * ^ => pos; the function will emit "comment1" in the emitJS + */ + function emitTrailingCommentsOfPosition(pos) { + var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitLeadingCommentsOfPosition(pos) { var leadingComments; @@ -34077,7 +34766,7 @@ var ts; leadingComments = filterComments(leadingComments, compilerOptions.removeComments); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedComments(node) { var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); @@ -34107,7 +34796,7 @@ var ts; if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); @@ -34119,6 +34808,12 @@ var ts; } } } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } function isPinnedOrTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; @@ -34139,6 +34834,261 @@ var ts; } } ts.emitFiles = emitFiles; + var entities = { + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }; })(ts || (ts = {})); /// /// @@ -34149,7 +35099,8 @@ var ts; /* @internal */ ts.ioReadTime = 0; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ - ts.version = "1.5.3"; + var emptyArray = []; + ts.version = "1.6.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -34166,6 +35117,53 @@ var ts; return undefined; } ts.findConfigFile = findConfigFile; + function resolveTripleslashReference(moduleName, containingFile) { + var basePath = ts.getDirectoryPath(containingFile); + var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName); + return ts.normalizePath(referencedFileName); + } + ts.resolveTripleslashReference = resolveTripleslashReference; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + // TODO: use different resolution strategy based on compiler options + return legacyNameResolver(moduleName, containingFile, compilerOptions, host); + } + ts.resolveModuleName = resolveModuleName; + function legacyNameResolver(moduleName, containingFile, compilerOptions, host) { + // module names that contain '!' are used to reference resources and are not resolved to actual files on disk + if (moduleName.indexOf('!') != -1) { + return { resolvedFileName: undefined, failedLookupLocations: [] }; + } + var searchPath = ts.getDirectoryPath(containingFile); + var searchName; + var failedLookupLocations = []; + var referencedSourceFile; + while (true) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + if (extension === ".tsx" && !compilerOptions.jsx) { + // resolve .tsx files only if jsx support is enabled + // 'logical not' handles both undefined and None cases + return undefined; + } + var candidate = searchName + extension; + if (host.fileExists(candidate)) { + return candidate; + } + else { + failedLookupLocations.push(candidate); + } + }); + if (referencedSourceFile) { + break; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations }; + } function createCompilerHost(options, setParentNodes) { var currentDirectory; var existingDirectories = {}; @@ -34231,7 +35229,9 @@ var ts; getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return newLine; } + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, + readFile: function (fileName) { return ts.sys.readFile(fileName); } }; } ts.createCompilerHost = createCompilerHost; @@ -34266,7 +35266,7 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; - function createProgram(rootNames, options, host) { + function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; var diagnostics = ts.createDiagnosticCollection(); @@ -34277,18 +35277,37 @@ var ts; var skipDefaultLib = options.noLib; var start = new Date().getTime(); host = host || createCompilerHost(options); + var resolveModuleNamesWorker = host.resolveModuleNames || + (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); }); var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); }); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); - // Do not process the default library if: - // - The '--noLib' flag is used. - // - A 'no-default-lib' reference comment is encountered in - // processing the root files. - if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (oldProgram) { + // check properties that can affect structure of the program or module resolution strategy + // if any of these properties has changed - structure cannot be reused + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx)) { + oldProgram = undefined; + } + } + if (!tryReuseStructureFromOldProgram()) { + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + // Do not process the default library if: + // - The '--noLib' flag is used. + // - A 'no-default-lib' reference comment is encountered in + // processing the root files. + if (!skipDefaultLib) { + processRootFile(host.getDefaultLibFileName(options), true); + } } verifyCompilerOptions(); + // unconditionally set oldProgram to undefined to prevent it from being captured in closure + oldProgram = undefined; ts.programTime += new Date().getTime() - start; program = { + getRootFileNames: function () { return rootNames; }, getSourceFile: getSourceFile, getSourceFiles: function () { return files; }, getCompilerOptions: function () { return options; }, @@ -34321,6 +35340,71 @@ var ts; } return classifiableNames; } + function tryReuseStructureFromOldProgram() { + if (!oldProgram) { + return false; + } + ts.Debug.assert(!oldProgram.structureIsReused); + // there is an old program, check if we can reuse its structure + var oldRootNames = oldProgram.getRootFileNames(); + if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { + return false; + } + // check if program source files has changed in the way that can affect structure of the program + var newSourceFiles = []; + for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { + var oldSourceFile = _a[_i]; + var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + if (!newSourceFile) { + return false; + } + if (oldSourceFile !== newSourceFile) { + if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { + // value of no-default-lib has changed + // this will affect if default library is injected into the list of files + return false; + } + // check tripleslash references + if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { + // tripleslash references has changed + return false; + } + // check imports + collectExternalModuleReferences(newSourceFile); + if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { + // imports has changed + return false; + } + if (resolveModuleNamesWorker) { + var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); + // ensure that module resolution results are still correct + for (var i = 0; i < moduleNames.length; ++i) { + var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]); + if (oldResolution !== resolutions[i]) { + return false; + } + } + } + // pass the cache of module resolutions from the old source file + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + } + else { + // file has no changes - use it as is + newSourceFile = oldSourceFile; + } + // if file has passed all checks it should be safe to reuse it + newSourceFiles.push(newSourceFile); + } + // update fileName -> file mapping + for (var _b = 0; _b < newSourceFiles.length; _b++) { + var file = newSourceFiles[_b]; + filesByName.set(file.fileName, file); + } + files = newSourceFiles; + oldProgram.structureIsReused = true; + return true; + } function getEmitHost(writeFileCallback) { return { getCanonicalFileName: function (fileName) { return host.getCanonicalFileName(fileName); }, @@ -34334,10 +35418,10 @@ var ts; }; } function getDiagnosticsProducingTypeChecker() { - return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); + return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true)); } function getTypeChecker() { - return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); + return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false)); } function emit(sourceFile, writeFileCallback, cancellationToken) { var _this = this; @@ -34347,7 +35431,7 @@ var ts; // If the noEmitOnError flag is set, then check if we have any errors so far. If so, // immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we // get any preEmit diagnostics, not just the ones - if (options.noEmitOnError && getPreEmitDiagnostics(program, undefined, cancellationToken).length > 0) { + if (options.noEmitOnError && getPreEmitDiagnostics(program, /*sourceFile:*/ undefined, cancellationToken).length > 0) { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } // Create the emit resolver outside of the "emitTime" tracking code below. That way @@ -34358,7 +35442,7 @@ var ts; // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; @@ -34449,14 +35533,59 @@ var ts; function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib); } + function fileReferenceIsEqualTo(a, b) { + return a.fileName === b.fileName; + } + function moduleNameIsEqualTo(a, b) { + return a.text === b.text; + } + function collectExternalModuleReferences(file) { + if (file.imports) { + return; + } + var imports; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 220 /* ImportDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 226 /* ExportDeclaration */: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { + break; + } + if (!moduleNameExpr.text) { + break; + } + (imports || (imports = [])).push(moduleNameExpr); + break; + case 216 /* ModuleDeclaration */: + if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An AmbientExternalModuleDeclaration declares an external module. + // This type of declaration is permitted only in the global module. + // The StringLiteral must specify a top - level external module name. + // Relative external module names are not permitted + ts.forEachChild(node.body, function (node) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && + ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9 /* StringLiteral */) { + var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + if (moduleName) { + (imports || (imports = [])).push(moduleName); + } + } + }); + } + break; + } + } + file.imports = imports || emptyArray; + } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var start; - var length; var diagnosticArgument; - if (refEnd !== undefined && refPos !== undefined) { - start = refPos; - length = refEnd - refPos; - } var diagnostic; if (hasExtension(fileName)) { if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { @@ -34487,8 +35616,8 @@ var ts; } } if (diagnostic) { - if (refFile) { - diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); + if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); @@ -34496,22 +35625,22 @@ var ts; } } // Get source file from normalized fileName - function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { + function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (filesByName.contains(canonicalName)) { // We've already looked for this file, use cached result - return getSourceFileFromCache(fileName, canonicalName, false); + return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false); } else { var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); if (filesByName.contains(canonicalAbsolutePath)) { - return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); + return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true); } // We haven't looked for this file, do so now and cache result var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { - if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, 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)); @@ -34522,11 +35651,12 @@ var ts; skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; // Set the source file for normalized absolute path filesByName.set(canonicalAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - var basePath = ts.getDirectoryPath(fileName); processReferencedFiles(file, basePath); - processImportedModules(file, basePath); } + // always process imported modules to record module name resolutions + processImportedModules(file, basePath); if (isDefaultLib) { file.isDefaultLib = true; files.unshift(file); @@ -34542,7 +35672,12 @@ var ts; 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)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } + else { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } } } return file; @@ -34550,57 +35685,31 @@ var ts; } 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); + var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); + processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end); }); } function processImportedModules(file, basePath) { - ts.forEach(file.statements, function (node) { - if (node.kind === 219 /* ImportDeclaration */ || node.kind === 218 /* ImportEqualsDeclaration */ || node.kind === 225 /* ExportDeclaration */) { - var moduleNameExpr = ts.getExternalModuleName(node); - if (moduleNameExpr && moduleNameExpr.kind === 8 /* StringLiteral */) { - var moduleNameText = moduleNameExpr.text; - if (moduleNameText) { - var searchPath = basePath; - var searchName; - while (true) { - searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { - break; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } - } + collectExternalModuleReferences(file); + if (file.imports.length) { + file.resolvedModules = {}; + var moduleNames = ts.map(file.imports, function (name) { return name.text; }); + var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); + for (var i = 0; i < file.imports.length; ++i) { + var resolution = resolutions[i]; + ts.setResolvedModuleName(file, moduleNames[i], resolution); + if (resolution && !options.noResolve) { + findModuleSourceFile(resolution, file.imports[i]); } } - else if (node.kind === 215 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An AmbientExternalModuleDeclaration declares an external module. - // This type of declaration is permitted only in the global module. - // The StringLiteral must specify a top - level external module name. - // Relative external module names are not permitted - ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8 /* StringLiteral */) { - var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); - var moduleName = nameLiteral.text; - if (moduleName) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); - } - } - }); - } - }); + } + else { + // no imports - drop cached module resolutions + file.resolvedModules = undefined; + } + return; function findModuleSourceFile(fileName, nameLiteral) { - return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end); } } function computeCommonSourceDirectory(sourceFiles) { @@ -34656,28 +35765,28 @@ var ts; } function verifyCompilerOptions() { if (options.isolatedModules) { - if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_isolatedModules)); - } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + } + if (options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { @@ -34685,17 +35794,21 @@ var ts; diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } + if (options.out && options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } var languageVersion = options.target || 0 /* ES3 */; + var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { if (!options.module && languageVersion < 2 /* ES6 */) { @@ -34721,7 +35834,7 @@ var ts; if (options.outDir || options.sourceRoot || (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + (!outFile || firstExternalModuleSourceFile !== undefined))) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); @@ -34738,16 +35851,22 @@ var ts; } } 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.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + } + if (options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + } + if (options.outDir) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== 2 /* ES6 */) { @@ -34879,6 +35998,13 @@ var ts; { name: "out", type: "string", + isFilePath: false, + // for correct behaviour, please use outFile + paramType: ts.Diagnostics.FILE + }, + { + name: "outFile", + type: "string", isFilePath: true, description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, paramType: ts.Diagnostics.FILE @@ -35088,7 +36214,7 @@ var ts; * @param fileName The path to the config file */ function readConfigFile(fileName) { - var text = ''; + var text = ""; try { text = ts.sys.readFile(fileName); } @@ -35172,6 +36298,9 @@ var ts; if (json["files"] instanceof Array) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); + } } else { var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; @@ -35250,7 +36379,7 @@ var ts; } else if (currentComment.kind === 3 /* MultiLineCommentTrivia */) { combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd); - addOutliningSpanComments(currentComment, false); + addOutliningSpanComments(currentComment, /*autoCollapse*/ false); singleLineCommentCount = 0; lastSingleLineCommentEnd = -1; isFirstSingleLineComment = true; @@ -35267,11 +36396,11 @@ var ts; end: end, kind: 2 /* SingleLineCommentTrivia */ }; - addOutliningSpanComments(multipleSingleLineComments, false); + addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false); } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 171 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 172 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -35283,34 +36412,34 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 189 /* Block */: + case 190 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_8 = n.parent; - var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); + var parent_7 = n.parent; + var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collaps the block, but consider its hint span // to be the entire span of the parent. - if (parent_8.kind === 194 /* DoStatement */ || - parent_8.kind === 197 /* ForInStatement */ || - parent_8.kind === 198 /* ForOfStatement */ || - parent_8.kind === 196 /* ForStatement */ || - parent_8.kind === 193 /* IfStatement */ || - parent_8.kind === 195 /* WhileStatement */ || - parent_8.kind === 202 /* WithStatement */ || - parent_8.kind === 241 /* CatchClause */) { - addOutliningSpan(parent_8, openBrace, closeBrace, autoCollapse(n)); + if (parent_7.kind === 195 /* DoStatement */ || + parent_7.kind === 198 /* ForInStatement */ || + parent_7.kind === 199 /* ForOfStatement */ || + parent_7.kind === 197 /* ForStatement */ || + parent_7.kind === 194 /* IfStatement */ || + parent_7.kind === 196 /* WhileStatement */ || + parent_7.kind === 203 /* WithStatement */ || + parent_7.kind === 242 /* CatchClause */) { + addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_8.kind === 206 /* TryStatement */) { + if (parent_7.kind === 207 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_8; + var tryStatement = parent_7; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_8, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 82 /* FinallyKeyword */, sourceFile); + var finallyKeyword = ts.findChildOfKind(tryStatement, 83 /* FinallyKeyword */, sourceFile); if (finallyKeyword) { addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); break; @@ -35329,25 +36458,25 @@ var ts; break; } // Fallthrough. - case 216 /* ModuleBlock */: { - var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); + case 217 /* ModuleBlock */: { + var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 162 /* ObjectLiteralExpression */: - case 217 /* CaseBlock */: { - var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 163 /* ObjectLiteralExpression */: + case 218 /* CaseBlock */: { + var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 161 /* ArrayLiteralExpression */: - var openBracket = ts.findChildOfKind(n, 18 /* OpenBracketToken */, sourceFile); - var closeBracket = ts.findChildOfKind(n, 19 /* CloseBracketToken */, sourceFile); + case 162 /* ArrayLiteralExpression */: + var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); + var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); break; } @@ -35422,9 +36551,9 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 66 /* Identifier */ || - node.kind === 8 /* StringLiteral */ || - node.kind === 7 /* NumericLiteral */) { + if (node.kind === 67 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + node.kind === 8 /* NumericLiteral */) { return node.text; } } @@ -35436,8 +36565,8 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 133 /* ComputedPropertyName */) { - return tryAddComputedPropertyName(declaration.name.expression, containers, true); + else if (declaration.name.kind === 134 /* ComputedPropertyName */) { + return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ true); } else { // Don't know how to add this. @@ -35457,12 +36586,12 @@ var ts; } return true; } - if (expression.kind === 163 /* PropertyAccessExpression */) { + if (expression.kind === 164 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); } - return tryAddComputedPropertyName(propertyAccess.expression, containers, true); + return tryAddComputedPropertyName(propertyAccess.expression, containers, /*includeLastPortion:*/ true); } return false; } @@ -35470,8 +36599,8 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 133 /* ComputedPropertyName */) { - if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { + if (declaration.name.kind === 134 /* ComputedPropertyName */) { + if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ false)) { return undefined; } } @@ -35546,17 +36675,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 215 /* ModuleDeclaration */); + } while (current.kind === 216 /* ModuleDeclaration */); // fall through - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -35567,21 +36696,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -35593,7 +36722,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -35602,21 +36731,21 @@ var ts; } } break; - case 160 /* BindingElement */: - case 208 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 209 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 212 /* InterfaceDeclaration */: - case 215 /* ModuleDeclaration */: - case 210 /* FunctionDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 223 /* ImportSpecifier */: - case 227 /* ExportSpecifier */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 213 /* InterfaceDeclaration */: + case 216 /* ModuleDeclaration */: + case 211 /* FunctionDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 224 /* ImportSpecifier */: + case 228 /* ExportSpecifier */: childNodes.push(node); break; } @@ -35664,17 +36793,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 213 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -35685,12 +36814,12 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 210 /* FunctionDeclaration */) { + if (functionDeclaration.kind === 211 /* FunctionDeclaration */) { // A function declaration is 'top level' if it contains any function declarations // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 189 /* Block */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 190 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 210 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 211 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { return true; } // Or if it is not parented by another function. i.e all functions @@ -35750,7 +36879,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 135 /* Parameter */: + case 136 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } @@ -35758,36 +36887,36 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 142 /* GetAccessor */: + case 143 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 143 /* SetAccessor */: + case 144 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 146 /* IndexSignature */: + case 147 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 144 /* CallSignature */: + case 145 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: var variableDeclarationNode; var name_29; - if (node.kind === 160 /* BindingElement */) { + if (node.kind === 161 /* BindingElement */) { name_29 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 208 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 209 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -35806,13 +36935,13 @@ var ts; else { return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.variableElement); } - case 141 /* Constructor */: + case 142 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 227 /* ExportSpecifier */: - case 223 /* ImportSpecifier */: - case 218 /* ImportEqualsDeclaration */: - case 220 /* ImportClause */: - case 221 /* NamespaceImport */: + case 228 /* ExportSpecifier */: + case 224 /* ImportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportClause */: + case 222 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -35842,29 +36971,29 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 245 /* SourceFile */: + case 246 /* SourceFile */: return createSourceFileItem(node); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return createClassItem(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return createEnumItem(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return createIterfaceItem(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return createModuleItem(node); - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; function getModuleName(moduleDeclaration) { // We want to maintain quotation marks. - if (moduleDeclaration.name.kind === 8 /* StringLiteral */) { + if (moduleDeclaration.name.kind === 9 /* StringLiteral */) { return getTextOfNode(moduleDeclaration.name); } // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 215 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 216 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -35876,7 +37005,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 189 /* Block */) { + if (node.body && node.body.kind === 190 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -35897,7 +37026,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 141 /* Constructor */ && member; + return member.kind === 142 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -35921,7 +37050,7 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 133 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 134 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -35930,13 +37059,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 215 /* ModuleDeclaration */) { + while (node.body.kind === 216 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 245 /* SourceFile */ + return node.kind === 246 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -36039,12 +37168,12 @@ var ts; 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, candidate === chunk.text); + 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, startsWith(candidate, chunk.text)); + return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text)); } } var isLowercase = chunk.isLowerCase; @@ -36060,9 +37189,9 @@ var ts; var wordSpans = getWordSpans(candidate); for (var _i = 0; _i < wordSpans.length; _i++) { var span = wordSpans[_i]; - if (partStartsWith(candidate, span, chunk.text, true)) { + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, - /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, false)); + /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); } } } @@ -36072,20 +37201,20 @@ var ts; // 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, true); + 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, false); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, true, camelCaseWeight); + return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); } - camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true); + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, false, camelCaseWeight); + return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); } } } @@ -36098,7 +37227,7 @@ var ts; // (Pattern: fogbar, Candidate: quuxfogbarFogBar). if (chunk.text.length < candidate.length) { if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, false); + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ false); } } } @@ -36122,7 +37251,7 @@ var ts; // 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, false); + var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); if (match) { return [match]; } @@ -36168,7 +37297,7 @@ var ts; for (var _i = 0; _i < subWordTextChunks.length; _i++) { var subWordTextChunk = subWordTextChunks[_i]; // Try to match the candidate with this word - var result = matchTextChunk(candidate, subWordTextChunk, true); + var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); if (!result) { return undefined; } @@ -36434,11 +37563,11 @@ var ts; }; } /* @internal */ function breakIntoCharacterSpans(identifier) { - return breakIntoSpans(identifier, false); + return breakIntoSpans(identifier, /*word:*/ false); } ts.breakIntoCharacterSpans = breakIntoCharacterSpans; /* @internal */ function breakIntoWordSpans(identifier) { - return breakIntoSpans(identifier, true); + return breakIntoSpans(identifier, /*word:*/ true); } ts.breakIntoWordSpans = breakIntoWordSpans; function breakIntoSpans(identifier, word) { @@ -36731,15 +37860,15 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 165 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 166 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. var callExpression = argumentInfo.invocation; var expression = callExpression.expression; - var name = expression.kind === 66 /* Identifier */ + var name = expression.kind === 67 /* Identifier */ ? expression - : expression.kind === 163 /* PropertyAccessExpression */ + : expression.kind === 164 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -36772,7 +37901,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 165 /* CallExpression */ || node.parent.kind === 166 /* NewExpression */) { + if (node.parent.kind === 166 /* CallExpression */ || node.parent.kind === 167 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -36788,8 +37917,8 @@ var ts; // Case 3: // foo(a#, #b#) -> The token is buried inside a list, and should give sig help // Find out if 'node' is an argument, a type argument, or neither - if (node.kind === 24 /* LessThanToken */ || - node.kind === 16 /* OpenParenToken */) { + if (node.kind === 25 /* LessThanToken */ || + node.kind === 17 /* OpenParenToken */) { // Find the list that starts right *after* the < or ( token. // If the user has just opened a list, consider this item 0. var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); @@ -36825,27 +37954,27 @@ var ts; }; } } - else if (node.kind === 10 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 167 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 168 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { - return getArgumentListInfoForTemplate(node.parent, 0); + return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0); } } - else if (node.kind === 11 /* TemplateHead */ && node.parent.parent.kind === 167 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 168 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 180 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 181 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 187 /* TemplateSpan */ && node.parent.parent.parent.kind === 167 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 188 /* TemplateSpan */ && node.parent.parent.parent.kind === 168 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 180 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 181 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. - if (node.kind === 13 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { + if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); @@ -36873,7 +38002,7 @@ var ts; if (child === node) { break; } - if (child.kind !== 23 /* CommaToken */) { + if (child.kind !== 24 /* CommaToken */) { argumentIndex++; } } @@ -36892,8 +38021,8 @@ var ts; // That will give us 2 non-commas. We then add one for the last comma, givin us an // arg count of 3. var listChildren = argumentsList.getChildren(); - var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 23 /* CommaToken */; }); - if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23 /* CommaToken */) { + var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 24 /* CommaToken */; }); + if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 24 /* CommaToken */) { argumentCount++; } return argumentCount; @@ -36923,7 +38052,7 @@ var ts; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { // argumentCount is either 1 or (numSpans + 1) to account for the template strings array argument. - var argumentCount = tagExpression.template.kind === 10 /* NoSubstitutionTemplateLiteral */ + var argumentCount = tagExpression.template.kind === 11 /* NoSubstitutionTemplateLiteral */ ? 1 : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); @@ -36945,7 +38074,7 @@ var ts; // The applicable span is from the first bar to the second bar (inclusive, // but not including parentheses) var applicableSpanStart = argumentsList.getFullStart(); - var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false); + var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), /*stopAfterLineBreak*/ false); return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getApplicableSpanForTaggedTemplate(taggedTemplate) { @@ -36961,16 +38090,16 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 180 /* TemplateExpression */) { + if (template.kind === 181 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { - applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); + applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); } } return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 245 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 246 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -37021,7 +38150,7 @@ var ts; var invocation = argumentListInfo.invocation; var callTarget = ts.getInvokedExpression(invocation); var callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget); - var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, undefined, undefined); + var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined); var items = ts.map(candidates, function (candidateSignature) { var signatureHelpParameters; var prefixDisplayParts = []; @@ -37030,10 +38159,10 @@ var ts; ts.addRange(prefixDisplayParts, callTargetDisplayParts); } if (isTypeParameterList) { - prefixDisplayParts.push(ts.punctuationPart(24 /* LessThanToken */)); + prefixDisplayParts.push(ts.punctuationPart(25 /* LessThanToken */)); var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; - suffixDisplayParts.push(ts.punctuationPart(26 /* GreaterThanToken */)); + suffixDisplayParts.push(ts.punctuationPart(27 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); }); @@ -37044,10 +38173,10 @@ var ts; return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); }); ts.addRange(prefixDisplayParts, typeParameterParts); - prefixDisplayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); + prefixDisplayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; - suffixDisplayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + suffixDisplayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); } var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); @@ -37057,7 +38186,7 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ts.punctuationPart(23 /* CommaToken */), ts.spacePart()], + separatorDisplayParts: [ts.punctuationPart(24 /* CommaToken */), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -37081,12 +38210,11 @@ var ts; var displayParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); }); - var isOptional = ts.hasQuestionToken(parameter.valueDeclaration); return { name: parameter.name, documentation: parameter.getDocumentationComment(), displayParts: displayParts, - isOptional: isOptional + isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration) }; } function createSignatureHelpParameterForTypeParameter(typeParameter) { @@ -37171,40 +38299,40 @@ var ts; return false; } switch (n.kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 162 /* ObjectLiteralExpression */: - case 158 /* ObjectBindingPattern */: - case 152 /* TypeLiteral */: - case 189 /* Block */: - case 216 /* ModuleBlock */: - case 217 /* CaseBlock */: - return nodeEndsWith(n, 15 /* CloseBraceToken */, sourceFile); - case 241 /* CatchClause */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 163 /* ObjectLiteralExpression */: + case 159 /* ObjectBindingPattern */: + case 153 /* TypeLiteral */: + case 190 /* Block */: + case 217 /* ModuleBlock */: + case 218 /* CaseBlock */: + return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); + case 242 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 166 /* NewExpression */: + case 167 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 165 /* CallExpression */: - case 169 /* ParenthesizedExpression */: - case 157 /* ParenthesizedType */: - return nodeEndsWith(n, 17 /* CloseParenToken */, sourceFile); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 166 /* CallExpression */: + case 170 /* ParenthesizedExpression */: + case 158 /* ParenthesizedType */: + return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); + case 150 /* FunctionType */: + case 151 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 145 /* ConstructSignature */: - case 144 /* CallSignature */: - case 171 /* ArrowFunction */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 146 /* ConstructSignature */: + case 145 /* CallSignature */: + case 172 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -37213,64 +38341,64 @@ var ts; } // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. - return hasChildOfKind(n, 17 /* CloseParenToken */, sourceFile); - case 215 /* ModuleDeclaration */: + return hasChildOfKind(n, 18 /* CloseParenToken */, sourceFile); + case 216 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 193 /* IfStatement */: + case 194 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile); - case 161 /* ArrayLiteralExpression */: - case 159 /* ArrayBindingPattern */: - case 164 /* ElementAccessExpression */: - case 133 /* ComputedPropertyName */: - case 154 /* TupleType */: - return nodeEndsWith(n, 19 /* CloseBracketToken */, sourceFile); - case 146 /* IndexSignature */: + case 162 /* ArrayLiteralExpression */: + case 160 /* ArrayBindingPattern */: + case 165 /* ElementAccessExpression */: + case 134 /* ComputedPropertyName */: + case 155 /* TupleType */: + return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); + case 147 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } - return hasChildOfKind(n, 19 /* CloseBracketToken */, sourceFile); - case 238 /* CaseClause */: - case 239 /* DefaultClause */: + return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); + case 239 /* CaseClause */: + case 240 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed return false; - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 195 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 196 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 194 /* DoStatement */: + case 195 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; - var hasWhileKeyword = findChildOfKind(n, 101 /* WhileKeyword */, sourceFile); + var hasWhileKeyword = findChildOfKind(n, 102 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { - return nodeEndsWith(n, 17 /* CloseParenToken */, sourceFile); + return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 173 /* TypeOfExpression */: - case 172 /* DeleteExpression */: - case 174 /* VoidExpression */: - case 181 /* YieldExpression */: - case 182 /* SpreadElementExpression */: + case 174 /* TypeOfExpression */: + case 173 /* DeleteExpression */: + case 175 /* VoidExpression */: + case 182 /* YieldExpression */: + case 183 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 180 /* TemplateExpression */: + case 181 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 187 /* TemplateSpan */: + case 188 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -37288,7 +38416,7 @@ var ts; if (last.kind === expectedLastToken) { return true; } - else if (last.kind === 22 /* SemicolonToken */ && children.length !== 1) { + else if (last.kind === 23 /* SemicolonToken */ && children.length !== 1) { return children[children.length - 2].kind === expectedLastToken; } } @@ -37326,7 +38454,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 268 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 269 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -37351,12 +38479,12 @@ var ts; ts.getTouchingPropertyName = getTouchingPropertyName; /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */ function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { - return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition); + return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition); } ts.getTouchingToken = getTouchingToken; /** Returns a token if position is in [start-of-leading-trivia, end) */ function getTokenAtPosition(sourceFile, position) { - return getTokenAtPositionWorker(sourceFile, position, true, undefined); + return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined); } ts.getTokenAtPosition = getTokenAtPosition; /** Get the token whose text contains the position */ @@ -37436,7 +38564,7 @@ var ts; return n; } var children = n.getChildren(); - var candidate = findRightmostChildNodeWithTokens(children, children.length); + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); return candidate && findRightmostToken(candidate); } function find(n) { @@ -37450,7 +38578,7 @@ var ts; if (position <= child.end) { if (child.getStart(sourceFile) >= position) { // actual start of the node is past the position - previous token should be at the end of previous child - var candidate = findRightmostChildNodeWithTokens(children, i); + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); return candidate && findRightmostToken(candidate); } else { @@ -37460,13 +38588,13 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 245 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 246 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. // Namely we are skipping the check: 'position < node.end' if (children.length) { - var candidate = findRightmostChildNodeWithTokens(children, children.length); + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); return candidate && findRightmostToken(candidate); } } @@ -37480,6 +38608,54 @@ var ts; } } ts.findPrecedingToken = findPrecedingToken; + function isInString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return token && token.kind === 9 /* StringLiteral */ && position > token.getStart(); + } + ts.isInString = isInString; + function isInComment(sourceFile, position) { + return isInCommentHelper(sourceFile, position, /*predicate*/ undefined); + } + ts.isInComment = isInComment; + /** + * Returns true if the cursor at position in sourceFile is within a comment that additionally + * satisfies predicate, and false otherwise. + */ + function isInCommentHelper(sourceFile, position, predicate) { + var token = getTokenAtPosition(sourceFile, position); + if (token && position <= token.getStart()) { + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + // The end marker of a single-line comment does not include the newline character. + // In the following case, we are inside a comment (^ denotes the cursor position): + // + // // asdf ^\n + // + // But for multi-line comments, we don't want to be inside the comment in the following case: + // + // /* asdf */^ + // + // Internally, we represent the end of the comment at the newline and closing '/', respectively. + return predicate ? + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) && + predicate(c); }) : + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); }); + } + return false; + } + ts.isInCommentHelper = isInCommentHelper; + function hasDocComment(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + // First, we have to see if this position actually landed in a comment. + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return ts.forEach(commentRanges, jsDocPrefix); + function jsDocPrefix(c) { + var text = sourceFile.text; + return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*'; + } + } + ts.hasDocComment = hasDocComment; function nodeHasTokens(n) { // If we have a token or node that has a non-zero width, it must have tokens. // Note, that getWidth() does not take trivia into account. @@ -37506,32 +38682,32 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 148 /* TypeReference */ || node.kind === 165 /* CallExpression */) { + if (node.kind === 149 /* TypeReference */ || node.kind === 166 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 211 /* ClassDeclaration */ || node.kind === 212 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 212 /* ClassDeclaration */ || node.kind === 213 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 131 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 132 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { - return kind === 66 /* Identifier */ || ts.isKeyword(kind); + return kind === 67 /* Identifier */ || ts.isKeyword(kind); } ts.isWord = isWord; function isPropertyName(kind) { - return kind === 8 /* StringLiteral */ || kind === 7 /* NumericLiteral */ || isWord(kind); + return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ || isWord(kind); } function isComment(kind) { return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; } ts.isComment = isComment; function isPunctuation(kind) { - return 14 /* FirstPunctuation */ <= kind && kind <= 65 /* LastPunctuation */; + return 15 /* FirstPunctuation */ <= kind && kind <= 66 /* LastPunctuation */; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { @@ -37541,9 +38717,9 @@ var ts; ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function isAccessibilityModifier(kind) { switch (kind) { - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: return true; } return false; @@ -37571,7 +38747,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 135 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 136 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -37706,6 +38882,14 @@ var ts; return displayPart(text, ts.SymbolDisplayPartKind.text); } ts.textPart = textPart; + var carriageReturnLineFeed = "\r\n"; + /** + * The default is CRLF. + */ + function getNewLineOrDefaultFromHost(host) { + return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed; + } + ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost; function lineBreakPart() { return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak); } @@ -37750,7 +38934,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 223 /* ImportSpecifier */ || location.parent.kind === 227 /* ExportSpecifier */) && + (location.parent.kind === 224 /* ImportSpecifier */ || location.parent.kind === 228 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -37778,7 +38962,7 @@ var ts; (function (ts) { var formatting; (function (formatting) { - var scanner = ts.createScanner(2 /* Latest */, false); + var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false); var ScanAction; (function (ScanAction) { ScanAction[ScanAction["Scan"] = 0] = "Scan"; @@ -37848,25 +39032,25 @@ var ts; function shouldRescanGreaterThanToken(node) { if (node) { switch (node.kind) { - case 28 /* GreaterThanEqualsToken */: - case 61 /* GreaterThanGreaterThanEqualsToken */: - case 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 43 /* GreaterThanGreaterThanGreaterThanToken */: - case 42 /* GreaterThanGreaterThanToken */: + case 29 /* GreaterThanEqualsToken */: + case 62 /* GreaterThanGreaterThanEqualsToken */: + case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 43 /* GreaterThanGreaterThanToken */: return true; } } return false; } function shouldRescanSlashToken(container) { - return container.kind === 9 /* RegularExpressionLiteral */; + return container.kind === 10 /* RegularExpressionLiteral */; } function shouldRescanTemplateToken(container) { - return container.kind === 12 /* TemplateMiddle */ || - container.kind === 13 /* TemplateTail */; + return container.kind === 13 /* TemplateMiddle */ || + container.kind === 14 /* TemplateTail */; } function startsWithSlashToken(t) { - return t === 37 /* SlashToken */ || t === 58 /* SlashEqualsToken */; + return t === 38 /* SlashToken */ || t === 59 /* SlashEqualsToken */; } function readTokenInfo(n) { if (!isOnToken()) { @@ -37902,7 +39086,7 @@ var ts; scanner.scan(); } var currentToken = scanner.getToken(); - if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 26 /* GreaterThanToken */) { + if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 27 /* GreaterThanToken */) { currentToken = scanner.reScanGreaterToken(); ts.Debug.assert(n.kind === currentToken); lastScanAction = 1 /* RescanGreaterThanToken */; @@ -37912,7 +39096,7 @@ var ts; ts.Debug.assert(n.kind === currentToken); lastScanAction = 2 /* RescanSlashToken */; } - else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 15 /* CloseBraceToken */) { + else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 16 /* CloseBraceToken */) { currentToken = scanner.reScanTemplateToken(); lastScanAction = 3 /* RescanTemplateToken */; } @@ -38041,8 +39225,8 @@ var ts; return startLine === endLine; }; FormattingContext.prototype.BlockIsOnOneLine = function (node) { - var openBrace = ts.findChildOfKind(node, 14 /* OpenBraceToken */, this.sourceFile); - var closeBrace = ts.findChildOfKind(node, 15 /* CloseBraceToken */, this.sourceFile); + var openBrace = ts.findChildOfKind(node, 15 /* OpenBraceToken */, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 16 /* CloseBraceToken */, this.sourceFile); if (openBrace && closeBrace) { var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; @@ -38233,112 +39417,112 @@ var ts; this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1 /* Ignore */)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); // Space after keyword but not before ; or : or ? - this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 51 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(51 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(51 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* CloseBraceToken */, 77 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* CloseBraceToken */, 101 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([17 /* CloseParenToken */, 19 /* CloseBracketToken */, 23 /* CommaToken */, 22 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - // No space for indexer and dot - this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(18 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 78 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 102 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + // No space for dot + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + // No space before and after indexer + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([66 /* Identifier */, 3 /* MultiLineCommentTrivia */]); - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 3 /* MultiLineCommentTrivia */]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a control flow construct - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 76 /* DoKeyword */, 97 /* TryKeyword */, 82 /* FinallyKeyword */, 77 /* ElseKeyword */]); - this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 77 /* DoKeyword */, 98 /* TryKeyword */, 83 /* FinallyKeyword */, 78 /* ElseKeyword */]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14 /* OpenBraceToken */, 15 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. - this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(14 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); // For functions and control block place } on a new line [multi-line rule] - this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 15 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); // Special handling of unary operators. // Prefix operators generally shouldn't have a space between // them and their target unary expression. this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(39 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 39 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 40 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 40 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(39 /* PlusPlusToken */, 34 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(34 /* PlusToken */, 34 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(34 /* PlusToken */, 39 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* MinusMinusToken */, 35 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* MinusToken */, 35 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* MinusToken */, 40 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([99 /* VarKeyword */, 95 /* ThrowKeyword */, 89 /* NewKeyword */, 75 /* DeleteKeyword */, 91 /* ReturnKeyword */, 98 /* TypeOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([105 /* LetKeyword */, 71 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); - this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(84 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(100 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(91 /* ReturnKeyword */, 22 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 40 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100 /* VarKeyword */, 96 /* ThrowKeyword */, 90 /* NewKeyword */, 76 /* DeleteKeyword */, 92 /* ReturnKeyword */, 99 /* TypeOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106 /* LetKeyword */, 72 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(101 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(92 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17 /* CloseParenToken */, 76 /* DoKeyword */, 77 /* ElseKeyword */, 68 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 77 /* DoKeyword */, 78 /* ElseKeyword */, 69 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([97 /* TryKeyword */, 82 /* FinallyKeyword */]), 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([98 /* TryKeyword */, 83 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([120 /* GetKeyword */, 126 /* SetKeyword */]), 66 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([121 /* GetKeyword */, 127 /* SetKeyword */]), 67 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* ConstructorKeyword */, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(119 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([122 /* ModuleKeyword */, 124 /* RequireKeyword */]), 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* ModuleKeyword */, 125 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112 /* AbstractKeyword */, 70 /* ClassKeyword */, 119 /* DeclareKeyword */, 74 /* DefaultKeyword */, 78 /* EnumKeyword */, 79 /* ExportKeyword */, 80 /* ExtendsKeyword */, 120 /* GetKeyword */, 103 /* ImplementsKeyword */, 86 /* ImportKeyword */, 104 /* InterfaceKeyword */, 122 /* ModuleKeyword */, 123 /* NamespaceKeyword */, 107 /* PrivateKeyword */, 109 /* PublicKeyword */, 108 /* ProtectedKeyword */, 126 /* SetKeyword */, 110 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([80 /* ExtendsKeyword */, 103 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 71 /* ClassKeyword */, 120 /* DeclareKeyword */, 75 /* DefaultKeyword */, 79 /* EnumKeyword */, 80 /* ExportKeyword */, 81 /* ExtendsKeyword */, 121 /* GetKeyword */, 104 /* ImplementsKeyword */, 87 /* ImportKeyword */, 105 /* InterfaceKeyword */, 123 /* ModuleKeyword */, 124 /* NamespaceKeyword */, 108 /* PrivateKeyword */, 110 /* PublicKeyword */, 109 /* ProtectedKeyword */, 127 /* SetKeyword */, 111 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81 /* ExtendsKeyword */, 104 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { - this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8 /* StringLiteral */, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions - this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(33 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Optional parameters and let args - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21 /* DotDotDotToken */, 66 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(51 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([17 /* CloseParenToken */, 23 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - // generics - this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseParenToken */, 24 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); - this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* LessThanToken */, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 26 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(26 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([16 /* OpenParenToken */, 18 /* OpenBracketToken */, 26 /* GreaterThanToken */, 23 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 67 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + // generics and type assertions + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([17 /* OpenParenToken */, 19 /* OpenBracketToken */, 27 /* GreaterThanToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */)); // Remove spaces in empty interface literals. e.g.: x: {} - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14 /* OpenBraceToken */, 15 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); // decorators - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([112 /* AbstractKeyword */, 66 /* Identifier */, 79 /* ExportKeyword */, 74 /* DefaultKeyword */, 70 /* ClassKeyword */, 110 /* StaticKeyword */, 109 /* PublicKeyword */, 107 /* PrivateKeyword */, 108 /* ProtectedKeyword */, 120 /* GetKeyword */, 126 /* SetKeyword */, 18 /* OpenBracketToken */, 36 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); - this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(84 /* FunctionKeyword */, 36 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); - this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(36 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([66 /* Identifier */, 16 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(111 /* YieldKeyword */, 36 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([111 /* YieldKeyword */, 36 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 67 /* Identifier */, 80 /* ExportKeyword */, 75 /* DefaultKeyword */, 71 /* ClassKeyword */, 111 /* StaticKeyword */, 110 /* PublicKeyword */, 108 /* PrivateKeyword */, 109 /* ProtectedKeyword */, 121 /* GetKeyword */, 127 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(112 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -38378,6 +39562,7 @@ var ts; this.NoSpaceAfterOpenAngularBracket, this.NoSpaceBeforeCloseAngularBracket, this.NoSpaceAfterCloseAngularBracket, + this.NoSpaceAfterTypeAssertion, this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, @@ -38388,8 +39573,8 @@ var ts; this.NoSpaceBeforeSemicolon, this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally @@ -38398,35 +39583,41 @@ var ts; /// Rules controlled by user options /// // Insert space after comma delimiter - this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Insert space before and after binary operators 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 /* Space */)); 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 /* Space */)); 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 /* Delete */)); 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 /* Delete */)); // Insert space after keywords in control flow statements - this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); - this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); // Open Brace braces after function //TypeScript: Function can have return types, which can be made of tons of different token kinds - this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Open Brace braces after TypeScript module/class/interface - this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Open Brace braces after control block - this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Insert space after semicolon in for statement - this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); - this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); // Insert space after opening and before closing nonempty parenthesis - this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenParenToken */, 17 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* OpenParenToken */, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + // Insert space after opening and before closing nonempty brackets + this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* OpenBracketToken */, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Insert space after function keyword for anonymous functions - this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(84 /* FunctionKeyword */, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(84 /* FunctionKeyword */, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); } Rules.prototype.getRuleName = function (rule) { var o = this; @@ -38441,38 +39632,38 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 196 /* ForStatement */; + return context.contextNode.kind === 197 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 178 /* BinaryExpression */: - case 179 /* ConditionalExpression */: - case 186 /* AsExpression */: - case 147 /* TypePredicate */: + case 179 /* BinaryExpression */: + case 180 /* ConditionalExpression */: + case 187 /* AsExpression */: + case 148 /* TypePredicate */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 160 /* BindingElement */: + case 161 /* BindingElement */: // equals in type X = ... - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: // equal in p = 0; - case 135 /* Parameter */: - case 244 /* EnumMember */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - return context.currentTokenSpan.kind === 54 /* EqualsToken */ || context.nextTokenSpan.kind === 54 /* EqualsToken */; + case 136 /* Parameter */: + case 245 /* EnumMember */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + return context.currentTokenSpan.kind === 55 /* EqualsToken */ || context.nextTokenSpan.kind === 55 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 197 /* ForInStatement */: - return context.currentTokenSpan.kind === 87 /* InKeyword */ || context.nextTokenSpan.kind === 87 /* InKeyword */; + case 198 /* ForInStatement */: + return context.currentTokenSpan.kind === 88 /* InKeyword */ || context.nextTokenSpan.kind === 88 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 198 /* ForOfStatement */: - return context.currentTokenSpan.kind === 131 /* OfKeyword */ || context.nextTokenSpan.kind === 131 /* OfKeyword */; + case 199 /* ForOfStatement */: + return context.currentTokenSpan.kind === 132 /* OfKeyword */ || context.nextTokenSpan.kind === 132 /* OfKeyword */; } return false; }; @@ -38480,7 +39671,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 179 /* ConditionalExpression */; + return context.contextNode.kind === 180 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -38524,98 +39715,98 @@ var ts; return true; } switch (node.kind) { - case 189 /* Block */: - case 217 /* CaseBlock */: - case 162 /* ObjectLiteralExpression */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 218 /* CaseBlock */: + case 163 /* ObjectLiteralExpression */: + case 217 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 144 /* CallSignature */: - case 170 /* FunctionExpression */: - case 141 /* Constructor */: - case 171 /* ArrowFunction */: + case 145 /* CallSignature */: + case 171 /* FunctionExpression */: + case 142 /* Constructor */: + case 172 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 210 /* FunctionDeclaration */ || context.contextNode.kind === 170 /* FunctionExpression */; + return context.contextNode.kind === 211 /* FunctionDeclaration */ || context.contextNode.kind === 171 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 152 /* TypeLiteral */: - case 215 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 153 /* TypeLiteral */: + case 216 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 211 /* ClassDeclaration */: - case 215 /* ModuleDeclaration */: - case 214 /* EnumDeclaration */: - case 189 /* Block */: - case 241 /* CatchClause */: - case 216 /* ModuleBlock */: - case 203 /* SwitchStatement */: + case 212 /* ClassDeclaration */: + case 216 /* ModuleDeclaration */: + case 215 /* EnumDeclaration */: + case 190 /* Block */: + case 242 /* CatchClause */: + case 217 /* ModuleBlock */: + case 204 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 193 /* IfStatement */: - case 203 /* SwitchStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 195 /* WhileStatement */: - case 206 /* TryStatement */: - case 194 /* DoStatement */: - case 202 /* WithStatement */: + case 194 /* IfStatement */: + case 204 /* SwitchStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 196 /* WhileStatement */: + case 207 /* TryStatement */: + case 195 /* DoStatement */: + case 203 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 241 /* CatchClause */: + case 242 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 162 /* ObjectLiteralExpression */; + return context.contextNode.kind === 163 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 165 /* CallExpression */; + return context.contextNode.kind === 166 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 166 /* NewExpression */; + return context.contextNode.kind === 167 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); }; Rules.IsPreviousTokenNotComma = function (context) { - return context.currentTokenSpan.kind !== 23 /* CommaToken */; + return context.currentTokenSpan.kind !== 24 /* CommaToken */; }; Rules.IsSameLineTokenContext = function (context) { return context.TokensAreOnSameLine(); @@ -38633,52 +39824,58 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 136 /* Decorator */; + return node.kind === 137 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 209 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 210 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 215 /* ModuleDeclaration */; + return context.contextNode.kind === 216 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 152 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 153 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; - Rules.IsTypeArgumentOrParameter = function (token, parent) { - if (token.kind !== 24 /* LessThanToken */ && token.kind !== 26 /* GreaterThanToken */) { + Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { + if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 148 /* TypeReference */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 149 /* TypeReference */: + case 169 /* TypeAssertionExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 186 /* ExpressionWithTypeArguments */: return true; default: return false; } }; - Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || - Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + Rules.IsTypeArgumentOrParameterOrAssertionContext = function (context) { + return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); + }; + Rules.IsTypeAssertionContext = function (context) { + return context.contextNode.kind === 169 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 100 /* VoidKeyword */ && context.currentTokenParent.kind === 174 /* VoidExpression */; + return context.currentTokenSpan.kind === 101 /* VoidKeyword */ && context.currentTokenParent.kind === 175 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 181 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 182 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; })(); @@ -38702,7 +39899,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 131 /* LastToken */ + 1; + this.mapRowLength = 132 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); //new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); //new Array(this.map.length); @@ -38897,7 +40094,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 131 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 132 /* LastToken */; token++) { result.push(token); } return result; @@ -38939,17 +40136,17 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(67 /* FirstKeyword */, 131 /* LastKeyword */); - TokenRange.BinaryOperators = TokenRange.FromRange(24 /* FirstBinaryOperator */, 65 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([87 /* InKeyword */, 88 /* InstanceOfKeyword */, 131 /* OfKeyword */, 113 /* AsKeyword */, 121 /* IsKeyword */]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([39 /* PlusPlusToken */, 40 /* MinusMinusToken */, 48 /* TildeToken */, 47 /* ExclamationToken */]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7 /* NumericLiteral */, 66 /* Identifier */, 16 /* OpenParenToken */, 18 /* OpenBracketToken */, 14 /* OpenBraceToken */, 94 /* ThisKeyword */, 89 /* NewKeyword */]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([66 /* Identifier */, 16 /* OpenParenToken */, 94 /* ThisKeyword */, 89 /* NewKeyword */]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([66 /* Identifier */, 17 /* CloseParenToken */, 19 /* CloseBracketToken */, 89 /* NewKeyword */]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([66 /* Identifier */, 16 /* OpenParenToken */, 94 /* ThisKeyword */, 89 /* NewKeyword */]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([66 /* Identifier */, 17 /* CloseParenToken */, 19 /* CloseBracketToken */, 89 /* NewKeyword */]); + TokenRange.Keywords = TokenRange.FromRange(68 /* FirstKeyword */, 132 /* LastKeyword */); + TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 66 /* LastBinaryOperator */); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([88 /* InKeyword */, 89 /* InstanceOfKeyword */, 132 /* OfKeyword */, 114 /* AsKeyword */, 122 /* IsKeyword */]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([40 /* PlusPlusToken */, 41 /* MinusMinusToken */, 49 /* TildeToken */, 48 /* ExclamationToken */]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 67 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 90 /* NewKeyword */]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 90 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([66 /* Identifier */, 125 /* NumberKeyword */, 127 /* StringKeyword */, 117 /* BooleanKeyword */, 128 /* SymbolKeyword */, 100 /* VoidKeyword */, 114 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([67 /* Identifier */, 126 /* NumberKeyword */, 128 /* StringKeyword */, 118 /* BooleanKeyword */, 129 /* SymbolKeyword */, 101 /* VoidKeyword */, 115 /* AnyKeyword */]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -39027,6 +40224,16 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeCloseParen); rules.push(this.globalRules.NoSpaceBetweenParens); } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) { + rules.push(this.globalRules.SpaceAfterOpenBracket); + rules.push(this.globalRules.SpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenBracket); + rules.push(this.globalRules.NoSpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } if (options.InsertSpaceAfterSemicolonInForStatements) { rules.push(this.globalRules.SpaceAfterSemicolonInFor); } @@ -39085,11 +40292,11 @@ var ts; } formatting.formatOnEnter = formatOnEnter; function formatOnSemicolon(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 22 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */); + return formatOutermostParent(position, 23 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */); } formatting.formatOnSemicolon = formatOnSemicolon; function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 15 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */); + return formatOutermostParent(position, 16 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */); } formatting.formatOnClosingCurly = formatOnClosingCurly; function formatDocument(sourceFile, rulesProvider, options) { @@ -39153,17 +40360,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 189 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 245 /* SourceFile */: - case 189 /* Block */: - case 216 /* ModuleBlock */: + return body && body.kind === 190 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 246 /* SourceFile */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -39336,9 +40543,9 @@ var ts; // - source file // - switch\default clauses if (isSomeBlock(parent.kind) || - parent.kind === 245 /* SourceFile */ || - parent.kind === 238 /* CaseClause */ || - parent.kind === 239 /* DefaultClause */) { + parent.kind === 246 /* SourceFile */ || + parent.kind === 239 /* CaseClause */ || + parent.kind === 240 /* DefaultClause */) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -39374,19 +40581,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 211 /* ClassDeclaration */: return 70 /* ClassKeyword */; - case 212 /* InterfaceDeclaration */: return 104 /* InterfaceKeyword */; - case 210 /* FunctionDeclaration */: return 84 /* FunctionKeyword */; - case 214 /* EnumDeclaration */: return 214 /* EnumDeclaration */; - case 142 /* GetAccessor */: return 120 /* GetKeyword */; - case 143 /* SetAccessor */: return 126 /* SetKeyword */; - case 140 /* MethodDeclaration */: + case 212 /* ClassDeclaration */: return 71 /* ClassKeyword */; + case 213 /* InterfaceDeclaration */: return 105 /* InterfaceKeyword */; + case 211 /* FunctionDeclaration */: return 85 /* FunctionKeyword */; + case 215 /* EnumDeclaration */: return 215 /* EnumDeclaration */; + case 143 /* GetAccessor */: return 121 /* GetKeyword */; + case 144 /* SetAccessor */: return 127 /* SetKeyword */; + case 141 /* MethodDeclaration */: if (node.asteriskToken) { - return 36 /* AsteriskToken */; + return 37 /* AsteriskToken */; } // fall-through - case 138 /* PropertyDeclaration */: - case 135 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 136 /* Parameter */: return node.name.kind; } } @@ -39398,8 +40605,8 @@ var ts; // .. { // // comment // } - case 15 /* CloseBraceToken */: - case 19 /* CloseBracketToken */: + case 16 /* CloseBraceToken */: + case 20 /* CloseBracketToken */: return indentation + delta; } return indentation; @@ -39413,15 +40620,15 @@ var ts; } switch (kind) { // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent - case 14 /* OpenBraceToken */: - case 15 /* CloseBraceToken */: - case 18 /* OpenBracketToken */: - case 19 /* CloseBracketToken */: - case 16 /* OpenParenToken */: - case 17 /* CloseParenToken */: - case 77 /* ElseKeyword */: - case 101 /* WhileKeyword */: - case 53 /* AtToken */: + case 15 /* OpenBraceToken */: + case 16 /* CloseBraceToken */: + case 19 /* OpenBracketToken */: + case 20 /* CloseBracketToken */: + case 17 /* OpenParenToken */: + case 18 /* CloseParenToken */: + case 78 /* ElseKeyword */: + case 102 /* WhileKeyword */: + case 54 /* AtToken */: return indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation @@ -39468,7 +40675,7 @@ var ts; // if there are any tokens that logically belong to node and interleave child nodes // such tokens will be consumed in processChildNode for for the child that follows them ts.forEachChild(node, function (child) { - processChildNode(child, -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, false); + processChildNode(child, /*inheritedIndentation*/ -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListElement*/ false); }, function (nodes) { processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); }); @@ -39521,7 +40728,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 136 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 137 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -39556,7 +40763,7 @@ var ts; var inheritedIndentation = -1 /* Unknown */; for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; - inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true); + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true); } if (listEndToken !== 0 /* Unknown */) { if (formattingScanner.isOnToken()) { @@ -39614,13 +40821,13 @@ var ts; switch (triviaItem.kind) { case 3 /* MultiLineCommentTrivia */: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; break; case 2 /* SingleLineCommentTrivia */: if (indentNextTokenOrTrivia) { var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation_1, false); + insertIndentation(triviaItem.pos, commentIndentation_1, /*lineAdded*/ false); indentNextTokenOrTrivia = false; } break; @@ -39683,7 +40890,7 @@ var ts; // Handle the case where the next line is moved to be the end of this line. // In this case we don't indent the next line in the next pass. if (currentParent.getStart(sourceFile) === currentItem.pos) { - dynamicIndentation.recomputeIndentation(false); + dynamicIndentation.recomputeIndentation(/*lineAdded*/ false); } } else if (rule.Operation.Action & 4 /* NewLine */ && currentStartLine === previousStartLine) { @@ -39692,7 +40899,7 @@ var ts; // In this case we indent token2 in the next pass but we set // sameLineIndent flag to notify the indenter that the indentation is within the line. if (currentParent.getStart(sourceFile) === currentItem.pos) { - dynamicIndentation.recomputeIndentation(true); + dynamicIndentation.recomputeIndentation(/*lineAdded*/ true); } } // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line @@ -39732,7 +40939,7 @@ var ts; if (startLine === endLine) { if (!firstLineIsIndented) { // treat as single line comment - insertIndentation(commentRange.pos, indentation, false); + insertIndentation(commentRange.pos, indentation, /*lineAdded*/ false); } return; } @@ -39844,49 +41051,49 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 189 /* Block */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 141 /* Constructor */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 171 /* ArrowFunction */: + case 142 /* Constructor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 172 /* ArrowFunction */: if (node.typeParameters === list) { - return 24 /* LessThanToken */; + return 25 /* LessThanToken */; } else if (node.parameters === list) { - return 16 /* OpenParenToken */; + return 17 /* OpenParenToken */; } break; - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: if (node.typeArguments === list) { - return 24 /* LessThanToken */; + return 25 /* LessThanToken */; } else if (node.arguments === list) { - return 16 /* OpenParenToken */; + return 17 /* OpenParenToken */; } break; - case 148 /* TypeReference */: + case 149 /* TypeReference */: if (node.typeArguments === list) { - return 24 /* LessThanToken */; + return 25 /* LessThanToken */; } } return 0 /* Unknown */; } function getCloseTokenForOpenToken(kind) { switch (kind) { - case 16 /* OpenParenToken */: - return 17 /* CloseParenToken */; - case 24 /* LessThanToken */: - return 26 /* GreaterThanToken */; + case 17 /* OpenParenToken */: + return 18 /* CloseParenToken */; + case 25 /* LessThanToken */: + return 27 /* GreaterThanToken */; } return 0 /* Unknown */; } @@ -39963,17 +41170,17 @@ var ts; return 0; } // no indentation in string \regex\template literals - var precedingTokenIsLiteral = precedingToken.kind === 8 /* StringLiteral */ || - precedingToken.kind === 9 /* RegularExpressionLiteral */ || - precedingToken.kind === 10 /* NoSubstitutionTemplateLiteral */ || - precedingToken.kind === 11 /* TemplateHead */ || - precedingToken.kind === 12 /* TemplateMiddle */ || - precedingToken.kind === 13 /* TemplateTail */; + var precedingTokenIsLiteral = precedingToken.kind === 9 /* StringLiteral */ || + precedingToken.kind === 10 /* RegularExpressionLiteral */ || + precedingToken.kind === 11 /* NoSubstitutionTemplateLiteral */ || + precedingToken.kind === 12 /* TemplateHead */ || + precedingToken.kind === 13 /* TemplateMiddle */ || + precedingToken.kind === 14 /* TemplateTail */; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 23 /* CommaToken */ && precedingToken.parent.kind !== 178 /* BinaryExpression */) { + if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 179 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -40013,12 +41220,12 @@ var ts; // no parent was found - return 0 to be indented on the level of SourceFile return 0; } - return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options); + return getIndentationForNodeWorker(current, currentStart, /*ignoreActualIndentationRange*/ 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); + return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } SmartIndenter.getIndentationForNode = getIndentationForNode; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { @@ -40092,7 +41299,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 245 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 246 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -40103,11 +41310,11 @@ var ts; if (!nextToken) { return false; } - if (nextToken.kind === 14 /* OpenBraceToken */) { + if (nextToken.kind === 15 /* OpenBraceToken */) { // open braces are always indented at the parent level return true; } - else if (nextToken.kind === 15 /* CloseBraceToken */) { + else if (nextToken.kind === 16 /* CloseBraceToken */) { // close braces are indented at the parent level if they are located on the same line with cursor // this means that if new line will be added at $ position, this case will be indented // class A { @@ -40125,8 +41332,8 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 193 /* IfStatement */ && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 77 /* ElseKeyword */, sourceFile); + if (parent.kind === 194 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 78 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -40137,23 +41344,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 148 /* TypeReference */: + case 149 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return node.parent.properties; - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return node.parent.elements; - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: { + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -40164,8 +41371,8 @@ var ts; } break; } - case 166 /* NewExpression */: - case 165 /* CallExpression */: { + case 167 /* NewExpression */: + case 166 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -40192,11 +41399,11 @@ var ts; function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) { // actual indentation should not be used when: // - node is close parenthesis - this is the end of the expression - if (node.kind === 17 /* CloseParenToken */) { + if (node.kind === 18 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 165 /* CallExpression */ || - node.parent.kind === 166 /* NewExpression */) && + if (node.parent && (node.parent.kind === 166 /* CallExpression */ || + node.parent.kind === 167 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -40214,10 +41421,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: node = node.expression; break; default: @@ -40234,7 +41441,7 @@ var ts; // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i] var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); for (var i = index - 1; i >= 0; --i) { - if (list[i].kind === 23 /* CommaToken */) { + if (list[i].kind === 24 /* CommaToken */) { continue; } // skip list items that ends on the same line with the current list element @@ -40282,28 +41489,30 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 161 /* ArrayLiteralExpression */: - case 189 /* Block */: - case 216 /* ModuleBlock */: - case 162 /* ObjectLiteralExpression */: - case 152 /* TypeLiteral */: - case 154 /* TupleType */: - case 217 /* CaseBlock */: - case 239 /* DefaultClause */: - case 238 /* CaseClause */: - case 169 /* ParenthesizedExpression */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 190 /* VariableStatement */: - case 208 /* VariableDeclaration */: - case 224 /* ExportAssignment */: - case 201 /* ReturnStatement */: - case 179 /* ConditionalExpression */: - case 159 /* ArrayBindingPattern */: - case 158 /* ObjectBindingPattern */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 162 /* ArrayLiteralExpression */: + case 190 /* Block */: + case 217 /* ModuleBlock */: + case 163 /* ObjectLiteralExpression */: + case 153 /* TypeLiteral */: + case 155 /* TupleType */: + case 218 /* CaseBlock */: + case 240 /* DefaultClause */: + case 239 /* CaseClause */: + case 170 /* ParenthesizedExpression */: + case 164 /* PropertyAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 191 /* VariableStatement */: + case 209 /* VariableDeclaration */: + case 225 /* ExportAssignment */: + case 202 /* ReturnStatement */: + case 180 /* ConditionalExpression */: + case 160 /* ArrayBindingPattern */: + case 159 /* ObjectBindingPattern */: + case 231 /* JsxElement */: return true; } return false; @@ -40313,22 +41522,22 @@ var ts; return true; } switch (parent) { - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 196 /* ForStatement */: - case 193 /* IfStatement */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 144 /* CallSignature */: - case 171 /* ArrowFunction */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - return child !== 189 /* Block */; + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 197 /* ForStatement */: + case 194 /* IfStatement */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 145 /* CallSignature */: + case 172 /* ArrowFunction */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + return child !== 190 /* Block */; default: return false; } @@ -40380,7 +41589,7 @@ var ts; } ScriptSnapshot.fromString = fromString; })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); - var scanner = ts.createScanner(2 /* Latest */, true); + var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ true); var emptyArray = []; function createNode(kind, pos, end, flags, parent) { var node = new (ts.getNodeConstructor(kind))(); @@ -40431,7 +41640,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(268 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); + var list = createNode(269 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -40450,7 +41659,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 132 /* FirstNode */) { + if (this.kind >= 133 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -40492,24 +41701,20 @@ var ts; 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 < 132 /* FirstNode */) { - return child; - } - return child.getFirstToken(sourceFile); + var children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; } + var child = children[0]; + return child.kind < 133 /* FirstNode */ ? child : 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 < 132 /* FirstNode */) { - return child; - } - return child.getLastToken(sourceFile); + var child = ts.lastOrUndefined(children); + if (!child) { + return undefined; } + return child.kind < 133 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; })(); @@ -40550,15 +41755,15 @@ var ts; var jsDocCommentParts = []; ts.forEach(declarations, function (declaration, indexOfDeclaration) { // Make sure we are collecting doc comment from declaration once, - // In case of union property there might be same declaration multiple times + // In case of union property there might be same declaration multiple times // which only varies in type parameter // Eg. let a: Array | Array; a.length - // The property length will have two declarations of property length coming + // The property length will have two declarations of property length coming // from Array - Array and Array if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 135 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 136 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -40567,15 +41772,15 @@ var ts; }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 215 /* ModuleDeclaration */ && declaration.body.kind === 215 /* ModuleDeclaration */) { + if (declaration.kind === 216 /* ModuleDeclaration */ && declaration.body.kind === 216 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 215 /* ModuleDeclaration */ && declaration.parent.kind === 215 /* ModuleDeclaration */) { + while (declaration.kind === 216 /* ModuleDeclaration */ && declaration.parent.kind === 216 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 208 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 209 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -40588,7 +41793,7 @@ var ts; return ts.map(ts.getJsDocComments(node, sourceFile), function (jsDocComment) { return { pos: jsDocComment.pos + "/*".length, - end: jsDocComment.end - "*/".length // Trim off comment end indicator + end: jsDocComment.end - "*/".length // Trim off comment end indicator }; }); } @@ -40690,7 +41895,7 @@ var ts; if (isParamTag(pos, end, sourceFile)) { var blankLineCount = 0; var recordedParamTag = false; - // Consume leading spaces + // Consume leading spaces pos = consumeWhiteSpaces(pos + paramTag.length); if (pos >= end) { break; @@ -40740,7 +41945,7 @@ var ts; var firstLineParamHelpStringPos = pos; while (pos < end) { var ch = sourceFile.text.charCodeAt(pos); - // at line break, set this comment line text and go to next line + // at line break, set this comment line text and go to next line if (ts.isLineBreak(ch)) { if (paramHelpString) { pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); @@ -40793,7 +41998,7 @@ var ts; if (paramHelpStringMargin === undefined) { paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } - // Now consume white spaces max + // Now consume white spaces max var startOfLinePos = pos; pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); if (pos >= end) { @@ -40843,6 +42048,11 @@ var ts; TypeObject.prototype.getNumberIndexType = function () { return this.checker.getIndexTypeOfType(this, 1 /* Number */); }; + TypeObject.prototype.getBaseTypes = function () { + return this.flags & (1024 /* Class */ | 2048 /* Interface */) + ? this.checker.getBaseTypes(this) + : undefined; + }; return TypeObject; })(); var SignatureObject = (function () { @@ -40914,9 +42124,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 133 /* ComputedPropertyName */) { + if (declaration.name.kind === 134 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 163 /* PropertyAccessExpression */) { + if (expr.kind === 164 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -40926,9 +42136,9 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 66 /* Identifier */ || - node.kind === 8 /* StringLiteral */ || - node.kind === 7 /* NumericLiteral */) { + if (node.kind === 67 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + node.kind === 8 /* NumericLiteral */) { return node.text; } } @@ -40936,9 +42146,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -40958,60 +42168,60 @@ var ts; ts.forEachChild(node, visit); } break; - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 214 /* EnumDeclaration */: - case 215 /* ModuleDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 227 /* ExportSpecifier */: - case 223 /* ImportSpecifier */: - case 218 /* ImportEqualsDeclaration */: - case 220 /* ImportClause */: - case 221 /* NamespaceImport */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 152 /* TypeLiteral */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 215 /* EnumDeclaration */: + case 216 /* ModuleDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 228 /* ExportSpecifier */: + case 224 /* ImportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportClause */: + case 222 /* NamespaceImport */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 153 /* TypeLiteral */: addDeclaration(node); // fall through - case 141 /* Constructor */: - case 190 /* VariableStatement */: - case 209 /* VariableDeclarationList */: - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: - case 216 /* ModuleBlock */: + case 142 /* Constructor */: + case 191 /* VariableStatement */: + case 210 /* VariableDeclarationList */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: + case 217 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 189 /* Block */: + case 190 /* Block */: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 135 /* Parameter */: + case 136 /* Parameter */: // Only consider properties defined as constructor parameters if (!(node.flags & 112 /* AccessibilityModifier */)) { break; } // fall through - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 244 /* EnumMember */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 245 /* EnumMember */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: addDeclaration(node); break; - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -41023,7 +42233,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -41227,16 +42437,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 170 /* FunctionExpression */) { + if (declaration.kind === 171 /* FunctionExpression */) { return true; } - if (declaration.kind !== 208 /* VariableDeclaration */ && declaration.kind !== 210 /* FunctionDeclaration */) { + if (declaration.kind !== 209 /* VariableDeclaration */ && declaration.kind !== 211 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_9 = declaration.parent; !ts.isFunctionBlock(parent_9); parent_9 = parent_9.parent) { + for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { // Reached source file or module block - if (parent_9.kind === 245 /* SourceFile */ || parent_9.kind === 216 /* ModuleBlock */) { + if (parent_8.kind === 246 /* SourceFile */ || parent_8.kind === 217 /* ModuleBlock */) { return false; } } @@ -41253,8 +42463,8 @@ var ts; }; } ts.getDefaultCompilerOptions = getDefaultCompilerOptions; - // Cache host information about scrip Should be refreshed - // at each language service public entry point, since we don't know when + // Cache host information about scrip Should be refreshed + // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. var HostCache = (function () { function HostCache(host, getCanonicalFileName) { @@ -41331,7 +42541,7 @@ var ts; var sourceFile; if (this.currentFileName !== fileName) { // This is a new file, just parse it - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, /*setNodeParents:*/ true); } else if (this.currentFileVersion !== version) { // This is the same file, just a newer version. Incrementally parse the file. @@ -41356,52 +42566,76 @@ var ts; /* * This function will compile source text from 'input' argument using specified compiler options. * If not options are provided - it will use a set of default compiler options. - * Extra compiler options that will unconditionally be used bu this function are: + * Extra compiler options that will unconditionally be used by this function are: * - isolatedModules = true * - allowNonTsExtensions = true * - noLib = true * - noResolve = true */ - function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { - var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + function transpileModule(input, transpileOptions) { + var options = transpileOptions.compilerOptions ? ts.clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions(); options.isolatedModules = true; // Filename can be non-ts file. options.allowNonTsExtensions = true; - // We are not returning a sourceFile for lib file when asked by the program, + // We are not returning a sourceFile for lib file when asked by the program, // so pass --noLib to avoid reporting a file not found error. options.noLib = true; // We are not doing a full typecheck, we are not resolving the whole context, // so pass --noResolve to avoid reporting missing file errors. options.noResolve = true; // Parse - var inputFileName = fileName || "module.ts"; + var inputFileName = transpileOptions.fileName || "module.ts"; var sourceFile = ts.createSourceFile(inputFileName, input, options.target); - if (moduleName) { - sourceFile.moduleName = moduleName; + if (transpileOptions.moduleName) { + sourceFile.moduleName = transpileOptions.moduleName; } + sourceFile.renamedDependencies = transpileOptions.renamedDependencies; var newLine = ts.getNewLineCharacter(options); // Output var outputText; + var sourceMapText; // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { - ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); - outputText = text; + if (ts.fileExtensionIs(name, ".map")) { + ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); + sourceMapText = text; + } + else { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + } }, getDefaultLibFileName: function () { return "lib.d.ts"; }, useCaseSensitiveFileNames: function () { return false; }, getCanonicalFileName: function (fileName) { return fileName; }, getCurrentDirectory: function () { return ""; }, - getNewLine: function () { return newLine; } + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return fileName === inputFileName; }, + readFile: function (fileName) { return ""; } }; var program = ts.createProgram([inputFileName], options, compilerHost); - ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile)); - ts.addRange(diagnostics, program.getOptionsDiagnostics()); + var diagnostics; + if (transpileOptions.reportDiagnostics) { + diagnostics = []; + ts.addRange(/*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile)); + ts.addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics()); + } // Emit program.emit(); ts.Debug.assert(outputText !== undefined, "Output generation failed"); - return outputText; + return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText }; + } + ts.transpileModule = transpileModule; + /* + * This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result. + */ + function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { + var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName }); + // addRange correctly handles cases when wither 'from' or 'to' argument is missing + ts.addRange(diagnostics, output.diagnostics); + return output.outputText; } ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { @@ -41415,7 +42649,7 @@ var ts; ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; ts.disableIncrementalParsing = false; function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) { - // If we were given a text change range, and our version or open-ness changed, then + // If we were given a text change range, and our version or open-ness changed, then // incrementally parse this file. if (textChangeRange) { if (version !== sourceFile.version) { @@ -41461,7 +42695,7 @@ var ts; } } // Otherwise, just create a new source file. - return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true); + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true); } ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; function createGetCanonicalFileName(useCaseSensitivefileNames) { @@ -41469,13 +42703,14 @@ var ts; ? (function (fileName) { return fileName; }) : (function (fileName) { return fileName.toLowerCase(); }); } + ts.createGetCanonicalFileName = createGetCanonicalFileName; function createDocumentRegistry(useCaseSensitiveFileNames) { // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. var buckets = {}; var getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); function getKeyFromCompilationSettings(settings) { - return "_" + settings.target; // + "|" + settings.propagateEnumConstantoString() + return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx; } function getBucketForCompilationSettings(settings, createIfMissing) { var key = getKeyFromCompilationSettings(settings); @@ -41506,18 +42741,18 @@ var ts; return JSON.stringify(bucketInfoArray, null, 2); } function acquireDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, true); + return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ true); } function updateDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, false); + return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ false); } function acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, acquiring) { - var bucket = getBucketForCompilationSettings(compilationSettings, true); + var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); var entry = bucket.get(fileName); if (!entry) { ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); // Have never seen this file with these settings. Create a new source file for it. - var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false); + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); entry = { sourceFile: sourceFile, languageServiceRefCount: 0, @@ -41526,7 +42761,7 @@ var ts; bucket.set(fileName, entry); } else { - // We have an entry for this file. However, it may be for a different version of + // We have an entry for this file. However, it may be for a different version of // the script snapshot. If so, update it appropriately. Otherwise, we can just // return it as is. if (entry.sourceFile.version !== version) { @@ -41565,6 +42800,7 @@ var ts; if (readImportFiles === void 0) { readImportFiles = true; } var referencedFiles = []; var importedFiles = []; + var ambientExternalModules; var isNoDefaultLib = false; function processTripleSlashDirectives() { var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); @@ -41580,6 +42816,12 @@ var ts; } }); } + function recordAmbientExternalModule() { + if (!ambientExternalModules) { + ambientExternalModules = []; + } + ambientExternalModules.push(scanner.getTokenValue()); + } function recordModuleName() { var importPath = scanner.getTokenValue(); var pos = scanner.getTokenPos(); @@ -41603,31 +42845,42 @@ var ts; // export * from "mod" // export {a as b} from "mod" while (token !== 1 /* EndOfFileToken */) { - if (token === 86 /* ImportKeyword */) { + if (token === 120 /* DeclareKeyword */) { + // declare module "mod" token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 123 /* ModuleKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + recordAmbientExternalModule(); + continue; + } + } + } + else if (token === 87 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { // import "mod"; recordModuleName(); continue; } else { - if (token === 66 /* Identifier */) { + if (token === 67 /* Identifier */ || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // import d from "mod"; recordModuleName(); continue; } } - else if (token === 54 /* EqualsToken */) { + else if (token === 55 /* EqualsToken */) { token = scanner.scan(); - if (token === 124 /* RequireKeyword */) { + if (token === 125 /* RequireKeyword */) { token = scanner.scan(); - if (token === 16 /* OpenParenToken */) { + if (token === 17 /* OpenParenToken */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // import i = require("mod"); recordModuleName(); continue; @@ -41635,7 +42888,7 @@ var ts; } } } - else if (token === 23 /* CommaToken */) { + else if (token === 24 /* CommaToken */) { // consume comma and keep going token = scanner.scan(); } @@ -41644,17 +42897,17 @@ var ts; continue; } } - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { token = scanner.scan(); // consume "{ a as B, c, d as D}" clauses - while (token !== 15 /* CloseBraceToken */) { + while (token !== 16 /* CloseBraceToken */) { token = scanner.scan(); } - if (token === 15 /* CloseBraceToken */) { + if (token === 16 /* CloseBraceToken */) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; // import d, {a, b as B} from "mod" recordModuleName(); @@ -41662,15 +42915,15 @@ var ts; } } } - else if (token === 36 /* AsteriskToken */) { + else if (token === 37 /* AsteriskToken */) { token = scanner.scan(); - if (token === 113 /* AsKeyword */) { + if (token === 114 /* AsKeyword */) { token = scanner.scan(); - if (token === 66 /* Identifier */) { + if (token === 67 /* Identifier */ || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // import * as NS from "mod" // import d, * as NS from "mod" recordModuleName(); @@ -41681,19 +42934,19 @@ var ts; } } } - else if (token === 79 /* ExportKeyword */) { + else if (token === 80 /* ExportKeyword */) { token = scanner.scan(); - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { token = scanner.scan(); // consume "{ a as B, c, d as D}" clauses - while (token !== 15 /* CloseBraceToken */) { + while (token !== 16 /* CloseBraceToken */) { token = scanner.scan(); } - if (token === 15 /* CloseBraceToken */) { + if (token === 16 /* CloseBraceToken */) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; // export {a, b as B} from "mod" recordModuleName(); @@ -41701,11 +42954,11 @@ var ts; } } } - else if (token === 36 /* AsteriskToken */) { + else if (token === 37 /* AsteriskToken */) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // export * from "mod" recordModuleName(); } @@ -41720,13 +42973,13 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; } ts.preProcessFile = preProcessFile; /// Helpers function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 204 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 205 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -41734,13 +42987,13 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 66 /* Identifier */ && - (node.parent.kind === 200 /* BreakStatement */ || node.parent.kind === 199 /* ContinueStatement */) && + return node.kind === 67 /* Identifier */ && + (node.parent.kind === 201 /* BreakStatement */ || node.parent.kind === 200 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 66 /* Identifier */ && - node.parent.kind === 204 /* LabeledStatement */ && + return node.kind === 67 /* Identifier */ && + node.parent.kind === 205 /* LabeledStatement */ && node.parent.label === node; } /** @@ -41748,7 +43001,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 204 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 205 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -41759,56 +43012,56 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 132 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 163 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 165 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 166 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 166 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 167 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 215 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 216 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 66 /* Identifier */ && + return node.kind === 67 /* Identifier */ && ts.isFunctionLike(node.parent) && node.parent.name === node; } /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node) { - return (node.kind === 66 /* Identifier */ || node.kind === 8 /* StringLiteral */ || node.kind === 7 /* NumericLiteral */) && - (node.parent.kind === 242 /* PropertyAssignment */ || node.parent.kind === 243 /* ShorthandPropertyAssignment */) && node.parent.name === node; + return (node.kind === 67 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && + (node.parent.kind === 243 /* PropertyAssignment */ || node.parent.kind === 244 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { - if (node.kind === 8 /* StringLiteral */ || node.kind === 7 /* NumericLiteral */) { + if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 242 /* PropertyAssignment */: - case 244 /* EnumMember */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 215 /* ModuleDeclaration */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 243 /* PropertyAssignment */: + case 245 /* EnumMember */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 216 /* ModuleDeclaration */: return node.parent.name === node; - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: return node.parent.argumentExpression === node; } } return false; } function isNameOfExternalModuleImportOrDeclaration(node) { - if (node.kind === 8 /* StringLiteral */) { + if (node.kind === 9 /* StringLiteral */) { return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } @@ -41860,7 +43113,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 67 /* FirstKeyword */; i <= 131 /* LastKeyword */; i++) { + for (var i = 68 /* FirstKeyword */; i <= 132 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -41875,17 +43128,17 @@ var ts; return undefined; } switch (node.kind) { - case 245 /* SourceFile */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 215 /* ModuleDeclaration */: + case 246 /* SourceFile */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 216 /* ModuleDeclaration */: return node; } } @@ -41893,38 +43146,38 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 215 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 211 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 212 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 213 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 214 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 208 /* VariableDeclaration */: + case 216 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 212 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 213 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 214 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 215 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 209 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 210 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 142 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 143 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 211 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 143 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 144 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 146 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 145 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 144 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 141 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 134 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 244 /* EnumMember */: return ScriptElementKind.variableElement; - case 135 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 218 /* ImportEqualsDeclaration */: - case 223 /* ImportSpecifier */: - case 220 /* ImportClause */: - case 227 /* ExportSpecifier */: - case 221 /* NamespaceImport */: + case 147 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 146 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 145 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 142 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 135 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 245 /* EnumMember */: return ScriptElementKind.variableElement; + case 136 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 219 /* ImportEqualsDeclaration */: + case 224 /* ImportSpecifier */: + case 221 /* ImportClause */: + case 228 /* ExportSpecifier */: + case 222 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -41995,26 +43248,44 @@ var ts; if (programUpToDate()) { return; } - // IMPORTANT - It is critical from this moment onward that we do not check + // IMPORTANT - It is critical from this moment onward that we do not check // cancellation tokens. We are about to mutate source files from a previous program // instance. If we cancel midway through, we may end up in an inconsistent state where - // the program points to old source files that have been invalidated because of + // the program points to old source files that have been invalidated because of // incremental parsing. var oldSettings = program && program.getCompilerOptions(); var newSettings = hostCache.compilationSettings(); - var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; + var changesInCompilationSettingsAffectSyntax = oldSettings && + (oldSettings.target !== newSettings.target || + oldSettings.module !== newSettings.module || + oldSettings.noResolve !== newSettings.noResolve || + oldSettings.jsx !== newSettings.jsx); // Now create a new compiler - var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { + var compilerHost = { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, - getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, + getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); } - }); - // Release any files we have acquired in the old program but are + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + fileExists: function (fileName) { + // stub missing host functionality + ts.Debug.assert(!host.resolveModuleNames); + return hostCache.getOrCreateEntry(fileName) !== undefined; + }, + readFile: function (fileName) { + // stub missing host functionality + var entry = hostCache.getOrCreateEntry(fileName); + return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + } + }; + if (host.resolveModuleNames) { + compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); + // Release any files we have acquired in the old program but are // not part of the new program. if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -42030,7 +43301,7 @@ var ts; // It needs to be cleared to allow all collected snapshots to be released hostCache = undefined; program = newProgram; - // Make sure all the nodes in the program are both bound, and have their parent + // Make sure all the nodes in the program are both bound, and have their parent // pointers set property. program.getTypeChecker(); return; @@ -42050,7 +43321,7 @@ var ts; // Check if the old program had this file already var oldSourceFile = program && program.getSourceFile(fileName); if (oldSourceFile) { - // We already had a source file for this file name. Go to the registry to + // We already had a source file for this file name. Go to the registry to // ensure that we get the right up to date version of it. We need this to // address the following 'race'. Specifically, say we have the following: // @@ -42061,15 +43332,15 @@ var ts; // LS2 // // Each LS has a reference to file 'foo.ts' at version 1. LS2 then updates - // it's version of 'foo.ts' to version 2. This will cause LS2 and the - // DocumentRegistry to have version 2 of the document. HOwever, LS1 will + // it's version of 'foo.ts' to version 2. This will cause LS2 and the + // DocumentRegistry to have version 2 of the document. HOwever, LS1 will // have version 1. And *importantly* this source file will be *corrupt*. // The act of creating version 2 of the file irrevocably damages the version // 1 file. // // So, later when we call into LS1, we need to make sure that it doesn't use // it's source file any more, and instead defers to DocumentRegistry to get - // either version 1, version 2 (or some other version) depending on what the + // either version 1, version 2 (or some other version) depending on what the // host says should be used. return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } @@ -42128,7 +43399,7 @@ var ts; synchronizeHostData(); var targetSourceFile = getValidSourceFile(fileName); // For JavaScript files, we don't want to report the normal typescript semantic errors. - // Instead, we just report errors for using TypeScript-only constructs from within a + // Instead, we just report errors for using TypeScript-only constructs from within a // JavaScript file. if (ts.isJavaScript(fileName)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); @@ -42152,44 +43423,44 @@ var ts; return false; } switch (node.kind) { - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 240 /* HeritageClause */: + case 241 /* HeritageClause */: var heritageClause = node; - if (heritageClause.token === 103 /* ImplementsKeyword */) { + if (heritageClause.token === 104 /* ImplementsKeyword */) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: - case 210 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -42197,20 +43468,20 @@ var ts; return true; } break; - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -42218,7 +43489,7 @@ var ts; return true; } break; - case 135 /* Parameter */: + case 136 /* Parameter */: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -42234,17 +43505,17 @@ var ts; return true; } break; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 168 /* TypeAssertionExpression */: + case 169 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 136 /* Decorator */: + case 137 /* Decorator */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -42270,18 +43541,18 @@ var ts; for (var _i = 0; _i < modifiers.length; _i++) { var modifier = modifiers[_i]; switch (modifier.kind) { - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 119 /* DeclareKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 120 /* DeclareKeyword */: diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); return true; // These are all legal modifiers. - case 110 /* StaticKeyword */: - case 79 /* ExportKeyword */: - case 71 /* ConstKeyword */: - case 74 /* DefaultKeyword */: - case 112 /* AbstractKeyword */: + case 111 /* StaticKeyword */: + case 80 /* ExportKeyword */: + case 72 /* ConstKeyword */: + case 75 /* DefaultKeyword */: + case 113 /* AbstractKeyword */: } } } @@ -42380,13 +43651,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_10 = contextToken.parent, kind = contextToken.kind; - if (kind === 20 /* DotToken */) { - if (parent_10.kind === 163 /* PropertyAccessExpression */) { + var parent_9 = contextToken.parent, kind = contextToken.kind; + if (kind === 21 /* DotToken */) { + if (parent_9.kind === 164 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_10.kind === 132 /* QualifiedName */) { + else if (parent_9.kind === 133 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -42396,7 +43667,7 @@ var ts; return undefined; } } - else if (kind === 24 /* LessThanToken */ && sourceFile.languageVariant === 1 /* JSX */) { + else if (kind === 25 /* LessThanToken */ && sourceFile.languageVariant === 1 /* JSX */) { isRightOfOpenTag = true; location = contextToken; } @@ -42433,7 +43704,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 66 /* Identifier */ || node.kind === 132 /* QualifiedName */ || node.kind === 163 /* PropertyAccessExpression */) { + if (node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */ || node.kind === 164 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -42462,7 +43733,7 @@ var ts; } } if (isJavaScriptFile && type.flags & 16384 /* Union */) { - // In javascript files, for union types, we don't just get the members that + // In javascript files, for union types, we don't just get the members that // the individual types have in common, we also include all the members that // each individual type has. This is because we're going to add all identifiers // anyways. So we might as well elevate the members that were at least part @@ -42489,7 +43760,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType; - if ((jsxContainer.kind === 231 /* JsxSelfClosingElement */) || (jsxContainer.kind === 232 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 232 /* JsxSelfClosingElement */) || (jsxContainer.kind === 233 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -42510,10 +43781,10 @@ var ts; // aggregating completion candidates. This is achieved in 'getScopeNode' // by finding the first node that encompasses a position, accounting for whether a node // is "complete" to decide whether a position belongs to the node. - // + // // However, at the end of an identifier, we are interested in the scope of the identifier // itself, but fall outside of the identifier. For instance: - // + // // xyz => x$ // // the cursor is outside of both the 'x' and the arrow function 'xyz => x', @@ -42563,41 +43834,41 @@ var ts; if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { - case 23 /* CommaToken */: - return containingNodeKind === 165 /* CallExpression */ // func( a, | - || containingNodeKind === 141 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 166 /* NewExpression */ // new C(a, | - || containingNodeKind === 161 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 178 /* BinaryExpression */ // let x = (a, | - || containingNodeKind === 149 /* FunctionType */; // var x: (s: string, list| - case 16 /* OpenParenToken */: - return containingNodeKind === 165 /* CallExpression */ // func( | - || containingNodeKind === 141 /* Constructor */ // constructor( | - || containingNodeKind === 166 /* NewExpression */ // new C(a| - || containingNodeKind === 169 /* ParenthesizedExpression */ // let x = (a| - || containingNodeKind === 157 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ - case 18 /* OpenBracketToken */: - return containingNodeKind === 161 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 146 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 133 /* ComputedPropertyName */; // [ | /* this can become an index signature */ - case 122 /* ModuleKeyword */: // module | - case 123 /* NamespaceKeyword */: + case 24 /* CommaToken */: + return containingNodeKind === 166 /* CallExpression */ // func( a, | + || containingNodeKind === 142 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 167 /* NewExpression */ // new C(a, | + || containingNodeKind === 162 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 179 /* BinaryExpression */ // let x = (a, | + || containingNodeKind === 150 /* FunctionType */; // var x: (s: string, list| + case 17 /* OpenParenToken */: + return containingNodeKind === 166 /* CallExpression */ // func( | + || containingNodeKind === 142 /* Constructor */ // constructor( | + || containingNodeKind === 167 /* NewExpression */ // new C(a| + || containingNodeKind === 170 /* ParenthesizedExpression */ // let x = (a| + || containingNodeKind === 158 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + case 19 /* OpenBracketToken */: + return containingNodeKind === 162 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 147 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 134 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + case 123 /* ModuleKeyword */: // module | + case 124 /* NamespaceKeyword */: return true; - case 20 /* DotToken */: - return containingNodeKind === 215 /* ModuleDeclaration */; // module A.| - case 14 /* OpenBraceToken */: - return containingNodeKind === 211 /* ClassDeclaration */; // class A{ | - case 54 /* EqualsToken */: - return containingNodeKind === 208 /* VariableDeclaration */ // let x = a| - || containingNodeKind === 178 /* BinaryExpression */; // x = a| - case 11 /* TemplateHead */: - return containingNodeKind === 180 /* TemplateExpression */; // `aa ${| - case 12 /* TemplateMiddle */: - return containingNodeKind === 187 /* TemplateSpan */; // `aa ${10} dd ${| - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - return containingNodeKind === 138 /* PropertyDeclaration */; // class A{ public | + case 21 /* DotToken */: + return containingNodeKind === 216 /* ModuleDeclaration */; // module A.| + case 15 /* OpenBraceToken */: + return containingNodeKind === 212 /* ClassDeclaration */; // class A{ | + case 55 /* EqualsToken */: + return containingNodeKind === 209 /* VariableDeclaration */ // let x = a| + || containingNodeKind === 179 /* BinaryExpression */; // x = a| + case 12 /* TemplateHead */: + return containingNodeKind === 181 /* TemplateExpression */; // `aa ${| + case 13 /* TemplateMiddle */: + return containingNodeKind === 188 /* TemplateSpan */; // `aa ${10} dd ${| + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + return containingNodeKind === 139 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -42610,8 +43881,8 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { - if (contextToken.kind === 8 /* StringLiteral */ - || contextToken.kind === 9 /* RegularExpressionLiteral */ + if (contextToken.kind === 9 /* StringLiteral */ + || contextToken.kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(contextToken.kind)) { var start_3 = contextToken.getStart(); var end = contextToken.getEnd(); @@ -42624,7 +43895,7 @@ var ts; } if (position === end) { return !!contextToken.isUnterminated - || contextToken.kind === 9 /* RegularExpressionLiteral */; + || contextToken.kind === 10 /* RegularExpressionLiteral */; } } return false; @@ -42640,18 +43911,29 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 162 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 163 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 158 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 159 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; - typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); - existingMembers = objectLikeContainer.elements; + var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); + if (ts.isVariableLike(rootDeclaration)) { + // We don't want to complete using the type acquired by the shape + // of the binding pattern; we are only interested in types acquired + // through type declaration or inference. + if (rootDeclaration.initializer || rootDeclaration.type) { + typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); + existingMembers = objectLikeContainer.elements; + } + } + else { + ts.Debug.fail("Root declaration is not variable-like."); + } } else { ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind); @@ -42682,9 +43964,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 222 /* NamedImports */ ? - 219 /* ImportDeclaration */ : - 225 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 223 /* NamedImports */ ? + 220 /* ImportDeclaration */ : + 226 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -42707,11 +43989,11 @@ var ts; function tryGetObjectLikeCompletionContainer(contextToken) { if (contextToken) { switch (contextToken.kind) { - case 14 /* OpenBraceToken */: // let x = { | - case 23 /* CommaToken */: - var parent_11 = contextToken.parent; - if (parent_11 && (parent_11.kind === 162 /* ObjectLiteralExpression */ || parent_11.kind === 158 /* ObjectBindingPattern */)) { - return parent_11; + case 15 /* OpenBraceToken */: // let x = { | + case 24 /* CommaToken */: + var parent_10 = contextToken.parent; + if (parent_10 && (parent_10.kind === 163 /* ObjectLiteralExpression */ || parent_10.kind === 159 /* ObjectBindingPattern */)) { + return parent_10; } break; } @@ -42725,11 +44007,11 @@ var ts; function tryGetNamedImportsOrExportsForCompletion(contextToken) { if (contextToken) { switch (contextToken.kind) { - case 14 /* OpenBraceToken */: // import { | - case 23 /* CommaToken */: + case 15 /* OpenBraceToken */: // import { | + case 24 /* CommaToken */: switch (contextToken.parent.kind) { - case 222 /* NamedImports */: - case 226 /* NamedExports */: + case 223 /* NamedImports */: + case 227 /* NamedExports */: return contextToken.parent; } } @@ -42738,24 +44020,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_12 = contextToken.parent; + var parent_11 = contextToken.parent; switch (contextToken.kind) { - case 25 /* LessThanSlashToken */: - case 37 /* SlashToken */: - case 66 /* Identifier */: - if (parent_12 && (parent_12.kind === 231 /* JsxSelfClosingElement */ || parent_12.kind === 232 /* JsxOpeningElement */)) { - return parent_12; + case 26 /* LessThanSlashToken */: + case 38 /* SlashToken */: + case 67 /* Identifier */: + case 236 /* JsxAttribute */: + case 237 /* JsxSpreadAttribute */: + if (parent_11 && (parent_11.kind === 232 /* JsxSelfClosingElement */ || parent_11.kind === 233 /* JsxOpeningElement */)) { + return parent_11; + } + break; + // The context token is the closing } or " of an attribute, which means + // its parent is a JsxExpression, whose parent is a JsxAttribute, + // whose parent is a JsxOpeningLikeElement + case 9 /* StringLiteral */: + if (parent_11 && ((parent_11.kind === 236 /* JsxAttribute */) || (parent_11.kind === 237 /* JsxSpreadAttribute */))) { + return parent_11.parent; } break; - case 15 /* CloseBraceToken */: - // The context token is the closing } of an attribute, which means - // its parent is a JsxExpression, whose parent is a JsxAttribute, - // whose parent is a JsxOpeningLikeElement - if (parent_12 && - parent_12.kind === 237 /* JsxExpression */ && - parent_12.parent && - parent_12.parent.kind === 235 /* JsxAttribute */) { - return parent_12.parent.parent; + case 16 /* CloseBraceToken */: + if (parent_11 && + parent_11.kind === 238 /* JsxExpression */ && + parent_11.parent && + (parent_11.parent.kind === 236 /* JsxAttribute */)) { + return parent_11.parent.parent; + } + if (parent_11 && parent_11.kind === 237 /* JsxSpreadAttribute */) { + return parent_11.parent; } break; } @@ -42764,16 +44056,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: return true; } return false; @@ -42784,65 +44076,65 @@ var ts; function isSolelyIdentifierDefinitionLocation(contextToken) { var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { - case 23 /* CommaToken */: - return containingNodeKind === 208 /* VariableDeclaration */ || - containingNodeKind === 209 /* VariableDeclarationList */ || - containingNodeKind === 190 /* VariableStatement */ || - containingNodeKind === 214 /* EnumDeclaration */ || + case 24 /* CommaToken */: + return containingNodeKind === 209 /* VariableDeclaration */ || + containingNodeKind === 210 /* VariableDeclarationList */ || + containingNodeKind === 191 /* VariableStatement */ || + containingNodeKind === 215 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 211 /* ClassDeclaration */ || - containingNodeKind === 210 /* FunctionDeclaration */ || - containingNodeKind === 212 /* InterfaceDeclaration */ || - containingNodeKind === 159 /* ArrayBindingPattern */; // var [x, y| - case 20 /* DotToken */: - return containingNodeKind === 159 /* ArrayBindingPattern */; // var [.| - case 52 /* ColonToken */: - return containingNodeKind === 160 /* BindingElement */; // var {x :html| - case 18 /* OpenBracketToken */: - return containingNodeKind === 159 /* ArrayBindingPattern */; // var [x| - case 16 /* OpenParenToken */: - return containingNodeKind === 241 /* CatchClause */ || + containingNodeKind === 212 /* ClassDeclaration */ || + containingNodeKind === 211 /* FunctionDeclaration */ || + containingNodeKind === 213 /* InterfaceDeclaration */ || + containingNodeKind === 160 /* ArrayBindingPattern */; // var [x, y| + case 21 /* DotToken */: + return containingNodeKind === 160 /* ArrayBindingPattern */; // var [.| + case 53 /* ColonToken */: + return containingNodeKind === 161 /* BindingElement */; // var {x :html| + case 19 /* OpenBracketToken */: + return containingNodeKind === 160 /* ArrayBindingPattern */; // var [x| + case 17 /* OpenParenToken */: + return containingNodeKind === 242 /* CatchClause */ || isFunction(containingNodeKind); - case 14 /* OpenBraceToken */: - return containingNodeKind === 214 /* EnumDeclaration */ || - containingNodeKind === 212 /* InterfaceDeclaration */ || - containingNodeKind === 152 /* TypeLiteral */; // let x : { | - case 22 /* SemicolonToken */: - return containingNodeKind === 137 /* PropertySignature */ && + case 15 /* OpenBraceToken */: + return containingNodeKind === 215 /* EnumDeclaration */ || + containingNodeKind === 213 /* InterfaceDeclaration */ || + containingNodeKind === 153 /* TypeLiteral */; // let x : { | + case 23 /* SemicolonToken */: + return containingNodeKind === 138 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 212 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 152 /* TypeLiteral */); // let x : { a; | - case 24 /* LessThanToken */: - return containingNodeKind === 211 /* ClassDeclaration */ || - containingNodeKind === 210 /* FunctionDeclaration */ || - containingNodeKind === 212 /* InterfaceDeclaration */ || + (contextToken.parent.parent.kind === 213 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 153 /* TypeLiteral */); // let x : { a; | + case 25 /* LessThanToken */: + return containingNodeKind === 212 /* ClassDeclaration */ || + containingNodeKind === 211 /* FunctionDeclaration */ || + containingNodeKind === 213 /* InterfaceDeclaration */ || isFunction(containingNodeKind); - case 110 /* StaticKeyword */: - return containingNodeKind === 138 /* PropertyDeclaration */; - case 21 /* DotDotDotToken */: - return containingNodeKind === 135 /* Parameter */ || + case 111 /* StaticKeyword */: + return containingNodeKind === 139 /* PropertyDeclaration */; + case 22 /* DotDotDotToken */: + return containingNodeKind === 136 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 159 /* ArrayBindingPattern */); // var [...z| - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - return containingNodeKind === 135 /* Parameter */; - case 113 /* AsKeyword */: - containingNodeKind === 223 /* ImportSpecifier */ || - containingNodeKind === 227 /* ExportSpecifier */ || - containingNodeKind === 221 /* NamespaceImport */; - case 70 /* ClassKeyword */: - case 78 /* EnumKeyword */: - case 104 /* InterfaceKeyword */: - case 84 /* FunctionKeyword */: - case 99 /* VarKeyword */: - case 120 /* GetKeyword */: - case 126 /* SetKeyword */: - case 86 /* ImportKeyword */: - case 105 /* LetKeyword */: - case 71 /* ConstKeyword */: - case 111 /* YieldKeyword */: - case 129 /* TypeKeyword */: + contextToken.parent.parent.kind === 160 /* ArrayBindingPattern */); // var [...z| + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + return containingNodeKind === 136 /* Parameter */; + case 114 /* AsKeyword */: + containingNodeKind === 224 /* ImportSpecifier */ || + containingNodeKind === 228 /* ExportSpecifier */ || + containingNodeKind === 222 /* NamespaceImport */; + case 71 /* ClassKeyword */: + case 79 /* EnumKeyword */: + case 105 /* InterfaceKeyword */: + case 85 /* FunctionKeyword */: + case 100 /* VarKeyword */: + case 121 /* GetKeyword */: + case 127 /* SetKeyword */: + case 87 /* ImportKeyword */: + case 106 /* LetKeyword */: + case 72 /* ConstKeyword */: + case 112 /* YieldKeyword */: + case 130 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -42861,7 +44153,7 @@ var ts; return false; } function isDotOfNumericLiteral(contextToken) { - if (contextToken.kind === 7 /* NumericLiteral */) { + if (contextToken.kind === 8 /* NumericLiteral */) { var text = contextToken.getFullText(); return text.charAt(text.length - 1) === "."; } @@ -42906,9 +44198,9 @@ var ts; for (var _i = 0; _i < existingMembers.length; _i++) { var m = existingMembers[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 242 /* PropertyAssignment */ && - m.kind !== 243 /* ShorthandPropertyAssignment */ && - m.kind !== 160 /* BindingElement */) { + if (m.kind !== 243 /* PropertyAssignment */ && + m.kind !== 244 /* ShorthandPropertyAssignment */ && + m.kind !== 161 /* BindingElement */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -42916,7 +44208,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 160 /* BindingElement */ && m.propertyName) { + if (m.kind === 161 /* BindingElement */ && m.propertyName) { existingName = m.propertyName.text; } else { @@ -42943,7 +44235,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 235 /* JsxAttribute */) { + if (attr.kind === 236 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -42983,7 +44275,7 @@ var ts; for (var name_32 in nameTable) { if (!allNames[name_32]) { allNames[name_32] = name_32; - var displayName = getCompletionEntryDisplayName(name_32, target, true); + var displayName = getCompletionEntryDisplayName(name_32, target, /*performCharacterChecks:*/ true); if (displayName) { var entry = { name: displayName, @@ -42999,17 +44291,17 @@ var ts; return entries; } function createCompletionEntry(symbol, location) { - // Try to get a valid display name for this symbol, if we could not find one, then ignore it. + // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, true, location); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks:*/ true, location); if (!displayName) { return undefined; } - // TODO(drosen): Right now we just permit *all* semantic meanings when calling - // 'getSymbolKind' which is permissible given that it is backwards compatible; but + // TODO(drosen): Right now we just permit *all* semantic meanings when calling + // 'getSymbolKind' which is permissible given that it is backwards compatible; but // really we should consider passing the meaning for the node so that we don't report - // that a suggestion for a value is an interface. We COULD also just do what + // that a suggestion for a value is an interface. We COULD also just do what // 'getSymbolModifiers' does, which is to use the first declaration. // Use a 'sortText' of 0' so that all symbol completion entries come before any other // entries (like JavaScript identifier entries). @@ -43049,10 +44341,10 @@ var ts; var symbols = completionData.symbols, location_2 = completionData.location; // Find the symbol with the matching entry name. var target = program.getCompilerOptions().target; - // We don't need to perform character checks here because we're only comparing the - // name against 'entryName' (which is known to be good), not building a new + // We don't need to perform character checks here because we're only comparing the + // name against 'entryName' (which is known to be good), not building a new // completion entry. - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target, false, location_2) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target, /*performCharacterChecks:*/ false, location_2) === entryName ? s : undefined; }); if (symbol) { var _a = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { @@ -43081,7 +44373,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 183 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 184 /* ClassExpression */) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ScriptElementKind.enumElement; @@ -43145,7 +44437,7 @@ var ts; ts.Debug.assert(!!(rootSymbolFlags & 8192 /* Method */)); }); if (!unionPropertyKind) { - // If this was union of all methods, + // If this was union of all methods, //make sure it has call signatures before we can label it as method var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (typeOfUnionProperty.getCallSignatures().length) { @@ -43183,7 +44475,7 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 163 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 164 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -43192,7 +44484,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression; - if (location.kind === 165 /* CallExpression */ || location.kind === 166 /* NewExpression */) { + if (location.kind === 166 /* CallExpression */ || location.kind === 167 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -43205,10 +44497,10 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 166 /* NewExpression */ || callExpression.expression.kind === 92 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 167 /* NewExpression */ || callExpression.expression.kind === 93 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { - // Get the first signature if there + // Get the first signature if there signature = allSignatures.length ? allSignatures[0] : undefined; } if (signature) { @@ -43222,7 +44514,7 @@ var ts; pushTypePart(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(89 /* NewKeyword */)); + displayParts.push(ts.keywordPart(90 /* NewKeyword */)); displayParts.push(ts.spacePart()); } addFullSymbolName(symbol); @@ -43238,14 +44530,14 @@ var ts; case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(52 /* ColonToken */)); + displayParts.push(ts.punctuationPart(53 /* ColonToken */)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(89 /* NewKeyword */)); + displayParts.push(ts.keywordPart(90 /* NewKeyword */)); displayParts.push(ts.spacePart()); } if (!(type.flags & 65536 /* Anonymous */)) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 1 /* WriteTypeParametersOrArguments */)); + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */)); } addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); break; @@ -43257,24 +44549,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 118 /* ConstructorKeyword */ && location.parent.kind === 141 /* Constructor */)) { + (location.kind === 119 /* ConstructorKeyword */ && location.parent.kind === 142 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 141 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 142 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 141 /* Constructor */) { + if (functionDeclaration.kind === 142 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 144 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 145 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -43283,7 +44575,7 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 183 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 184 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -43291,7 +44583,7 @@ var ts; } else { // Class declaration has name which is not local. - displayParts.push(ts.keywordPart(70 /* ClassKeyword */)); + displayParts.push(ts.keywordPart(71 /* ClassKeyword */)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); @@ -43299,48 +44591,48 @@ var ts; } if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(104 /* InterfaceKeyword */)); + displayParts.push(ts.keywordPart(105 /* InterfaceKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(129 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(130 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54 /* EqualsToken */)); + displayParts.push(ts.operatorPart(55 /* EqualsToken */)); displayParts.push(ts.spacePart()); ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); } if (symbolFlags & 384 /* Enum */) { addNewLineIfDisplayPartsExist(); if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { - displayParts.push(ts.keywordPart(71 /* ConstKeyword */)); + displayParts.push(ts.keywordPart(72 /* ConstKeyword */)); displayParts.push(ts.spacePart()); } - displayParts.push(ts.keywordPart(78 /* EnumKeyword */)); + displayParts.push(ts.keywordPart(79 /* EnumKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 215 /* ModuleDeclaration */); - var isNamespace = declaration && declaration.name && declaration.name.kind === 66 /* Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 123 /* NamespaceKeyword */ : 122 /* ModuleKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 216 /* ModuleDeclaration */); + var isNamespace = declaration && declaration.name && declaration.name.kind === 67 /* Identifier */; + displayParts.push(ts.keywordPart(isNamespace ? 124 /* NamespaceKeyword */ : 123 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if ((symbolFlags & 262144 /* TypeParameter */) && (semanticMeaning & 2 /* Type */)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); + displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.textPart("type parameter")); - displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(87 /* InKeyword */)); + displayParts.push(ts.keywordPart(88 /* InKeyword */)); displayParts.push(ts.spacePart()); if (symbol.parent) { // Class/Interface type parameter @@ -43349,13 +44641,13 @@ var ts; } else { // Method/function type parameter - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 134 /* TypeParameter */).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 145 /* ConstructSignature */) { - displayParts.push(ts.keywordPart(89 /* NewKeyword */)); + if (signatureDeclaration.kind === 146 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(90 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 144 /* CallSignature */ && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 145 /* CallSignature */ && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -43364,11 +44656,11 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 244 /* EnumMember */) { + if (declaration.kind === 245 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54 /* EqualsToken */)); + displayParts.push(ts.operatorPart(55 /* EqualsToken */)); displayParts.push(ts.spacePart()); displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); } @@ -43376,26 +44668,26 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(86 /* ImportKeyword */)); + displayParts.push(ts.keywordPart(87 /* ImportKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 218 /* ImportEqualsDeclaration */) { + if (declaration.kind === 219 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54 /* EqualsToken */)); + displayParts.push(ts.operatorPart(55 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(124 /* RequireKeyword */)); - displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); + displayParts.push(ts.keywordPart(125 /* RequireKeyword */)); + displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); - displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); } else { var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54 /* EqualsToken */)); + displayParts.push(ts.operatorPart(55 /* EqualsToken */)); displayParts.push(ts.spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -43412,7 +44704,7 @@ var ts; if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 /* Variable */ || symbolKind === ScriptElementKind.localVariableElement) { - displayParts.push(ts.punctuationPart(52 /* ColonToken */)); + displayParts.push(ts.punctuationPart(53 /* ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */) { @@ -43450,7 +44742,7 @@ var ts; } } function addFullSymbolName(symbol, enclosingDeclaration) { - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, undefined, 1 /* WriteTypeParametersOrArguments */ | 2 /* UseOnlyExternalAliasing */); + var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */ | 2 /* UseOnlyExternalAliasing */); ts.addRange(displayParts, fullSymbolDisplayParts); } function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { @@ -43471,9 +44763,9 @@ var ts; displayParts.push(ts.textOrKeywordPart(symbolKind)); return; default: - displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); + displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.textOrKeywordPart(symbolKind)); - displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); return; } } @@ -43481,12 +44773,12 @@ var ts; ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); if (allSignatures.length > 1) { displayParts.push(ts.spacePart()); - displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); - displayParts.push(ts.operatorPart(34 /* PlusToken */)); + displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); + displayParts.push(ts.operatorPart(35 /* PlusToken */)); displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral)); displayParts.push(ts.spacePart()); displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); - displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); } documentation = signature.getDocumentationComment(); } @@ -43512,11 +44804,11 @@ var ts; if (!symbol) { // Try getting just type at this position and show switch (node.kind) { - case 66 /* Identifier */: - case 163 /* PropertyAccessExpression */: - case 132 /* QualifiedName */: - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: + case 67 /* Identifier */: + case 164 /* PropertyAccessExpression */: + case 133 /* QualifiedName */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -43560,7 +44852,7 @@ var ts; var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : ""; if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { - // Just add all the declarations. + // Just add all the declarations. ts.forEach(declarations, function (declaration) { result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -43569,18 +44861,18 @@ var ts; function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (isNewExpressionTarget(location) || location.kind === 118 /* ConstructorKeyword */) { + if (isNewExpressionTarget(location) || location.kind === 119 /* ConstructorKeyword */) { if (symbol.flags & 32 /* Class */) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 211 /* ClassDeclaration */); - return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 212 /* ClassDeclaration */); + return tryAddSignature(classDeclaration.members, /*selectConstructors*/ 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 tryAddSignature(symbol.declarations, /*selectConstructors*/ false, symbolKind, symbolName, containerName, result); } return false; } @@ -43588,8 +44880,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 141 /* Constructor */) || - (!selectConstructors && (d.kind === 210 /* FunctionDeclaration */ || d.kind === 140 /* MethodDeclaration */ || d.kind === 139 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 142 /* Constructor */) || + (!selectConstructors && (d.kind === 211 /* FunctionDeclaration */ || d.kind === 141 /* MethodDeclaration */ || d.kind === 140 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -43618,7 +44910,7 @@ var ts; if (isJumpStatementTarget(node)) { var labelName = node.text; var label = getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } /// Triple slash reference comments var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); @@ -43649,16 +44941,16 @@ var ts; // to jump to the implementation directly. if (symbol.flags & 8388608 /* Alias */) { var declaration = symbol.declarations[0]; - if (node.kind === 66 /* Identifier */ && node.parent === declaration) { + if (node.kind === 67 /* Identifier */ && node.parent === declaration) { symbol = typeChecker.getAliasedSymbol(symbol); } } // Because name in short-hand property assignment has two different meanings: property name and property value, // using go-to-definition at such position should go to the variable declaration of the property value rather than - // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition + // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 243 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 244 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -43692,7 +44984,7 @@ var ts; var result = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(result, getDefinitionFromSymbol(t.symbol, node)); + ts.addRange(/*to*/ result, /*from*/ getDefinitionFromSymbol(t.symbol, node)); } }); return result; @@ -43706,7 +44998,7 @@ var ts; var results = getOccurrencesAtPositionCore(fileName, position); if (results) { var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); - // Get occurrences only supports reporting occurrences for the file queried. So + // Get occurrences only supports reporting occurrences for the file queried. So // filter down to that list. results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile; }); } @@ -43732,12 +45024,12 @@ var ts; }; } function getSemanticDocumentHighlights(node) { - if (node.kind === 66 /* Identifier */ || - node.kind === 94 /* ThisKeyword */ || - node.kind === 92 /* SuperKeyword */ || + if (node.kind === 67 /* Identifier */ || + node.kind === 95 /* ThisKeyword */ || + node.kind === 93 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, false, false); + var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings:*/ false, /*findInComments:*/ false); return convertReferencedSymbols(referencedSymbols); } return undefined; @@ -43785,77 +45077,77 @@ var ts; function getHighlightSpans(node) { if (node) { switch (node.kind) { - case 85 /* IfKeyword */: - case 77 /* ElseKeyword */: - if (hasKind(node.parent, 193 /* IfStatement */)) { + case 86 /* IfKeyword */: + case 78 /* ElseKeyword */: + if (hasKind(node.parent, 194 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; - case 91 /* ReturnKeyword */: - if (hasKind(node.parent, 201 /* ReturnStatement */)) { + case 92 /* ReturnKeyword */: + if (hasKind(node.parent, 202 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; - case 95 /* ThrowKeyword */: - if (hasKind(node.parent, 205 /* ThrowStatement */)) { + case 96 /* ThrowKeyword */: + if (hasKind(node.parent, 206 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; - case 69 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 206 /* TryStatement */)) { + case 70 /* CatchKeyword */: + if (hasKind(parent(parent(node)), 207 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; - case 97 /* TryKeyword */: - case 82 /* FinallyKeyword */: - if (hasKind(parent(node), 206 /* TryStatement */)) { + case 98 /* TryKeyword */: + case 83 /* FinallyKeyword */: + if (hasKind(parent(node), 207 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; - case 93 /* SwitchKeyword */: - if (hasKind(node.parent, 203 /* SwitchStatement */)) { + case 94 /* SwitchKeyword */: + if (hasKind(node.parent, 204 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 68 /* CaseKeyword */: - case 74 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 203 /* SwitchStatement */)) { + case 69 /* CaseKeyword */: + case 75 /* DefaultKeyword */: + if (hasKind(parent(parent(parent(node))), 204 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; - case 67 /* BreakKeyword */: - case 72 /* ContinueKeyword */: - if (hasKind(node.parent, 200 /* BreakStatement */) || hasKind(node.parent, 199 /* ContinueStatement */)) { - return getBreakOrContinueStatementOccurences(node.parent); + case 68 /* BreakKeyword */: + case 73 /* ContinueKeyword */: + if (hasKind(node.parent, 201 /* BreakStatement */) || hasKind(node.parent, 200 /* ContinueStatement */)) { + return getBreakOrContinueStatementOccurrences(node.parent); } break; - case 83 /* ForKeyword */: - if (hasKind(node.parent, 196 /* ForStatement */) || - hasKind(node.parent, 197 /* ForInStatement */) || - hasKind(node.parent, 198 /* ForOfStatement */)) { + case 84 /* ForKeyword */: + if (hasKind(node.parent, 197 /* ForStatement */) || + hasKind(node.parent, 198 /* ForInStatement */) || + hasKind(node.parent, 199 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 101 /* WhileKeyword */: - case 76 /* DoKeyword */: - if (hasKind(node.parent, 195 /* WhileStatement */) || hasKind(node.parent, 194 /* DoStatement */)) { + case 102 /* WhileKeyword */: + case 77 /* DoKeyword */: + if (hasKind(node.parent, 196 /* WhileStatement */) || hasKind(node.parent, 195 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 118 /* ConstructorKeyword */: - if (hasKind(node.parent, 141 /* Constructor */)) { + case 119 /* ConstructorKeyword */: + if (hasKind(node.parent, 142 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; - case 120 /* GetKeyword */: - case 126 /* SetKeyword */: - if (hasKind(node.parent, 142 /* GetAccessor */) || hasKind(node.parent, 143 /* SetAccessor */)) { + case 121 /* GetKeyword */: + case 127 /* SetKeyword */: + if (hasKind(node.parent, 143 /* GetAccessor */) || hasKind(node.parent, 144 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 190 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 191 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -43871,10 +45163,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 205 /* ThrowStatement */) { + if (node.kind === 206 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 206 /* TryStatement */) { + else if (node.kind === 207 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -43902,19 +45194,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_13 = child.parent; - if (ts.isFunctionBlock(parent_13) || parent_13.kind === 245 /* SourceFile */) { - return parent_13; + var parent_12 = child.parent; + if (ts.isFunctionBlock(parent_12) || parent_12.kind === 246 /* SourceFile */) { + return parent_12; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_13.kind === 206 /* TryStatement */) { - var tryStatement = parent_13; + if (parent_12.kind === 207 /* TryStatement */) { + var tryStatement = parent_12; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_13; + child = parent_12; } return undefined; } @@ -43923,7 +45215,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 200 /* BreakStatement */ || node.kind === 199 /* ContinueStatement */) { + if (node.kind === 201 /* BreakStatement */ || node.kind === 200 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -43939,16 +45231,16 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 203 /* SwitchStatement */: - if (statement.kind === 199 /* ContinueStatement */) { + case 204 /* SwitchStatement */: + if (statement.kind === 200 /* ContinueStatement */) { continue; } // Fall through. - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 195 /* WhileStatement */: - case 194 /* DoStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 196 /* WhileStatement */: + case 195 /* DoStatement */: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -43967,24 +45259,24 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 211 /* ClassDeclaration */ || - container.kind === 183 /* ClassExpression */ || - (declaration.kind === 135 /* Parameter */ && hasKind(container, 141 /* Constructor */)))) { + if (!(container.kind === 212 /* ClassDeclaration */ || + container.kind === 184 /* ClassExpression */ || + (declaration.kind === 136 /* Parameter */ && hasKind(container, 142 /* Constructor */)))) { return undefined; } } - else if (modifier === 110 /* StaticKeyword */) { - if (!(container.kind === 211 /* ClassDeclaration */ || container.kind === 183 /* ClassExpression */)) { + else if (modifier === 111 /* StaticKeyword */) { + if (!(container.kind === 212 /* ClassDeclaration */ || container.kind === 184 /* ClassExpression */)) { return undefined; } } - else if (modifier === 79 /* ExportKeyword */ || modifier === 119 /* DeclareKeyword */) { - if (!(container.kind === 216 /* ModuleBlock */ || container.kind === 245 /* SourceFile */)) { + else if (modifier === 80 /* ExportKeyword */ || modifier === 120 /* DeclareKeyword */) { + if (!(container.kind === 217 /* ModuleBlock */ || container.kind === 246 /* SourceFile */)) { return undefined; } } - else if (modifier === 112 /* AbstractKeyword */) { - if (!(container.kind === 211 /* ClassDeclaration */ || declaration.kind === 211 /* ClassDeclaration */)) { + else if (modifier === 113 /* AbstractKeyword */) { + if (!(container.kind === 212 /* ClassDeclaration */ || declaration.kind === 212 /* ClassDeclaration */)) { return undefined; } } @@ -43996,8 +45288,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 216 /* ModuleBlock */: - case 245 /* SourceFile */: + case 217 /* ModuleBlock */: + case 246 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 256 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -44006,17 +45298,17 @@ var ts; nodes = container.statements; } break; - case 141 /* Constructor */: + case 142 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. if (modifierFlag & 112 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 141 /* Constructor */ && member; + return member.kind === 142 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -44037,19 +45329,19 @@ var ts; return ts.map(keywords, getHighlightSpanForNode); function getFlagFromModifier(modifier) { switch (modifier) { - case 109 /* PublicKeyword */: + case 110 /* PublicKeyword */: return 16 /* Public */; - case 107 /* PrivateKeyword */: + case 108 /* PrivateKeyword */: return 32 /* Private */; - case 108 /* ProtectedKeyword */: + case 109 /* ProtectedKeyword */: return 64 /* Protected */; - case 110 /* StaticKeyword */: + case 111 /* StaticKeyword */: return 128 /* Static */; - case 79 /* ExportKeyword */: + case 80 /* ExportKeyword */: return 1 /* Export */; - case 119 /* DeclareKeyword */: + case 120 /* DeclareKeyword */: return 2 /* Ambient */; - case 112 /* AbstractKeyword */: + case 113 /* AbstractKeyword */: return 256 /* Abstract */; default: ts.Debug.fail(); @@ -44069,13 +45361,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 142 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 143 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 143 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 144 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 120 /* GetKeyword */, 126 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 121 /* GetKeyword */, 127 /* SetKeyword */); }); } } } @@ -44084,19 +45376,19 @@ var ts; var keywords = []; ts.forEach(declarations, function (declaration) { ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 118 /* ConstructorKeyword */); + return pushKeywordIf(keywords, token, 119 /* ConstructorKeyword */); }); }); return ts.map(keywords, getHighlightSpanForNode); } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 83 /* ForKeyword */, 101 /* WhileKeyword */, 76 /* DoKeyword */)) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 84 /* ForKeyword */, 102 /* WhileKeyword */, 77 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 194 /* DoStatement */) { + if (loopNode.kind === 195 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 101 /* WhileKeyword */)) { + if (pushKeywordIf(keywords, loopTokens[i], 102 /* WhileKeyword */)) { break; } } @@ -44105,22 +45397,22 @@ var ts; var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 67 /* BreakKeyword */, 72 /* ContinueKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 68 /* BreakKeyword */, 73 /* ContinueKeyword */); } }); return ts.map(keywords, getHighlightSpanForNode); } - function getBreakOrContinueStatementOccurences(breakOrContinueStatement) { + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -44128,14 +45420,14 @@ var ts; } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 93 /* SwitchKeyword */); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 94 /* SwitchKeyword */); // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 68 /* CaseKeyword */, 74 /* DefaultKeyword */); + pushKeywordIf(keywords, clause.getFirstToken(), 69 /* CaseKeyword */, 75 /* DefaultKeyword */); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 67 /* BreakKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 68 /* BreakKeyword */); } }); }); @@ -44143,13 +45435,13 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 97 /* TryKeyword */); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 98 /* TryKeyword */); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 69 /* CatchKeyword */); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 70 /* CatchKeyword */); } if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 82 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 82 /* FinallyKeyword */); + var finallyKeyword = ts.findChildOfKind(tryStatement, 83 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 83 /* FinallyKeyword */); } return ts.map(keywords, getHighlightSpanForNode); } @@ -44160,13 +45452,13 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 95 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 96 /* ThrowKeyword */); }); // If the "owner" is a function, then we equate 'return' and 'throw' statements in their // ability to "jump out" of the function, and include occurrences for both. if (ts.isFunctionBlock(owner)) { ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 91 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 92 /* ReturnKeyword */); }); } return ts.map(keywords, getHighlightSpanForNode); @@ -44174,36 +45466,36 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 189 /* Block */))) { + if (!(func && hasKind(func.body, 190 /* Block */))) { return undefined; } var keywords = []; ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 91 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 92 /* ReturnKeyword */); }); // Include 'throw' statements that do not occur within a try block. ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 95 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 96 /* ThrowKeyword */); }); return ts.map(keywords, getHighlightSpanForNode); } function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 193 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 194 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. while (ifStatement) { var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 85 /* IfKeyword */); + pushKeywordIf(keywords, children[0], 86 /* IfKeyword */); // Generally the 'else' keyword is second-to-last, so we traverse backwards. for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 77 /* ElseKeyword */)) { + if (pushKeywordIf(keywords, children[i], 78 /* ElseKeyword */)) { break; } } - if (!hasKind(ifStatement.elseStatement, 193 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 194 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -44212,7 +45504,7 @@ var ts; // We'd like to highlight else/ifs together if they are only separated by whitespace // (i.e. the keywords are separated by no comments, no newlines). for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 77 /* ElseKeyword */ && i < keywords.length - 1) { + if (keywords[i].kind === 78 /* ElseKeyword */ && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. var shouldCombindElseAndIf = true; @@ -44279,11 +45571,11 @@ var ts; return convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); return convertReferences(referencedSymbols); } function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); // Only include referenced symbols that have a valid definition. return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); } @@ -44294,7 +45586,7 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 66 /* Identifier */ && + if (node.kind !== 67 /* Identifier */ && // TODO (drosen): This should be enabled in a later release - currently breaks rename. //node.kind !== SyntaxKind.ThisKeyword && //node.kind !== SyntaxKind.SuperKeyword && @@ -44302,7 +45594,7 @@ var ts; !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } - ts.Debug.assert(node.kind === 66 /* Identifier */ || node.kind === 7 /* NumericLiteral */ || node.kind === 8 /* StringLiteral */); + ts.Debug.assert(node.kind === 67 /* Identifier */ || node.kind === 8 /* NumericLiteral */ || node.kind === 9 /* StringLiteral */); return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); } function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { @@ -44320,10 +45612,10 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 94 /* ThisKeyword */) { + if (node.kind === 95 /* ThisKeyword */) { return getReferencesForThisKeyword(node, sourceFiles); } - if (node.kind === 92 /* SuperKeyword */) { + if (node.kind === 93 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); @@ -44383,7 +45675,7 @@ var ts; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608 /* Alias */) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 223 /* ImportSpecifier */ || declaration.kind === 227 /* ExportSpecifier */; + return declaration.kind === 224 /* ImportSpecifier */ || declaration.kind === 228 /* ExportSpecifier */; }); } function getInternedName(symbol, location, declarations) { @@ -44410,14 +45702,14 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 170 /* FunctionExpression */ || valueDeclaration.kind === 183 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 171 /* FunctionExpression */ || valueDeclaration.kind === 184 /* ClassExpression */)) { return valueDeclaration; } // If this is private property or method, the scope is the containing class if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 211 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 212 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -44443,7 +45735,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 245 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 246 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -44471,12 +45763,12 @@ var ts; // If we are past the end, stop looking if (position > end) break; - // We found a match. Make sure it's not part of a larger word (i.e. the char + // We found a match. Make sure it's not part of a larger word (i.e. the char // before and after it have to be a non-identifier char). var endPosition = position + symbolNameLength; if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2 /* Latest */)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2 /* Latest */))) { - // Found a real match. Keep searching. + // Found a real match. Keep searching. positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -44514,16 +45806,16 @@ var ts; if (node) { // Compare the length so we filter out strict superstrings of the symbol we are looking for switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return node.getWidth() === searchSymbolName.length; - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { // For string literals we have two additional chars for the quotes return node.getWidth() === searchSymbolName.length + 2; } break; - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { return node.getWidth() === searchSymbolName.length; } @@ -44547,11 +45839,11 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - // This wasn't the start of a token. Check to see if it might be a + // This wasn't the start of a token. Check to see if it might be a // match in a comment or string if that's what the caller is asking // for. - if ((findInStrings && isInString(position)) || - (findInComments && isInComment(position))) { + if ((findInStrings && ts.isInString(sourceFile, position)) || + (findInComments && isInNonReferenceComment(sourceFile, position))) { // In the case where we're looking inside comments/strings, we don't have // an actual definition. So just use 'undefined' here. Features like // 'Rename' won't care (as they ignore the definitions), and features like @@ -44600,44 +45892,29 @@ var ts; } return result[index]; } - function isInString(position) { - var token = ts.getTokenAtPosition(sourceFile, position); - return token && token.kind === 8 /* StringLiteral */ && position > token.getStart(); - } - function isInComment(position) { - var token = ts.getTokenAtPosition(sourceFile, position); - if (token && position < token.getStart()) { - // First, we have to see if this position actually landed in a comment. - var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); - // Then we want to make sure that it wasn't in a "///<" directive comment - // We don't want to unintentionally update a file name. - 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; - } - } - }); + function isInNonReferenceComment(sourceFile, position) { + return ts.isInCommentHelper(sourceFile, position, isNonReferenceComment); + function isNonReferenceComment(c) { + var commentText = sourceFile.text.substring(c.pos, c.end); + return !tripleSlashDirectivePrefixRegex.test(commentText); } - return false; } } function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, false); + var searchSpaceNode = ts.getSuperContainer(superKeyword, /*includeFunctions*/ false); if (!searchSpaceNode) { return undefined; } // Whether 'super' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -44650,10 +45927,10 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 92 /* SuperKeyword */) { + if (!node || node.kind !== 93 /* SuperKeyword */) { return; } - var container = ts.getSuperContainer(node, false); + var container = ts.getSuperContainer(node, /*includeFunctions*/ false); // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. @@ -44665,31 +45942,31 @@ var ts; return [{ definition: definition, references: references }]; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { - var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -44698,7 +45975,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 245 /* SourceFile */) { + if (searchSpaceNode.kind === 246 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -44724,32 +46001,32 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 94 /* ThisKeyword */) { + if (!node || node.kind !== 95 /* ThisKeyword */) { return; } - var container = ts.getThisContainer(node, false); + var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 245 /* SourceFile */: - if (container.kind === 245 /* SourceFile */ && !ts.isExternalModule(container)) { + case 246 /* SourceFile */: + if (container.kind === 246 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -44803,11 +46080,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 211 /* ClassDeclaration */) { + if (declaration.kind === 212 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 212 /* InterfaceDeclaration */) { + else if (declaration.kind === 213 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -44839,7 +46116,7 @@ var ts; return aliasedSymbol; } } - // If the reference location is in an object literal, try to get the contextual type for the + // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol if (isNameOfPropertyAssignment(referenceLocation)) { @@ -44854,7 +46131,7 @@ var ts; if (searchSymbols.indexOf(rootSymbol) >= 0) { return rootSymbol; } - // Finally, try all properties with the same name in any type the containing type extended or implemented, and + // Finally, try all properties with the same name in any type the containing type extended or implemented, and // see if any is in the list if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { var result_3 = []; @@ -44930,7 +46207,7 @@ var ts; function getReferenceEntryFromNode(node) { var start = node.getStart(); var end = node.getEnd(); - if (node.kind === 8 /* StringLiteral */) { + if (node.kind === 9 /* StringLiteral */) { start += 1; end -= 1; } @@ -44942,17 +46219,17 @@ var ts; } /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ function isWriteAccess(node) { - if (node.kind === 66 /* Identifier */ && ts.isDeclarationName(node)) { + if (node.kind === 67 /* Identifier */ && ts.isDeclarationName(node)) { return true; } var parent = node.parent; if (parent) { - if (parent.kind === 177 /* PostfixUnaryExpression */ || parent.kind === 176 /* PrefixUnaryExpression */) { + if (parent.kind === 178 /* PostfixUnaryExpression */ || parent.kind === 177 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 178 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 179 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; - return 54 /* FirstAssignment */ <= operator && operator <= 65 /* LastAssignment */; + return 55 /* FirstAssignment */ <= operator && operator <= 66 /* LastAssignment */; } } return false; @@ -44984,34 +46261,34 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 135 /* Parameter */: - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 242 /* PropertyAssignment */: - case 243 /* ShorthandPropertyAssignment */: - case 244 /* EnumMember */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 241 /* CatchClause */: + case 136 /* Parameter */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 243 /* PropertyAssignment */: + case 244 /* ShorthandPropertyAssignment */: + case 245 /* EnumMember */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 242 /* CatchClause */: return 1 /* Value */; - case 134 /* TypeParameter */: - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 152 /* TypeLiteral */: + case 135 /* TypeParameter */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 153 /* TypeLiteral */: return 2 /* Type */; - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 215 /* ModuleDeclaration */: - if (node.name.kind === 8 /* StringLiteral */) { + case 216 /* ModuleDeclaration */: + if (node.name.kind === 9 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) { @@ -45020,15 +46297,15 @@ var ts; else { return 4 /* Namespace */; } - case 222 /* NamedImports */: - case 223 /* ImportSpecifier */: - case 218 /* ImportEqualsDeclaration */: - case 219 /* ImportDeclaration */: - case 224 /* ExportAssignment */: - case 225 /* ExportDeclaration */: + case 223 /* NamedImports */: + case 224 /* ImportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 220 /* ImportDeclaration */: + case 225 /* ExportAssignment */: + case 226 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 245 /* SourceFile */: + case 246 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -45038,8 +46315,8 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 148 /* TypeReference */ || - (node.parent.kind === 185 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); + return node.parent.kind === 149 /* TypeReference */ || + (node.parent.kind === 186 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -45047,50 +46324,50 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 163 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 163 /* PropertyAccessExpression */) { + if (root.parent.kind === 164 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 164 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 185 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 240 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 186 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 241 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 211 /* ClassDeclaration */ && root.parent.parent.token === 103 /* ImplementsKeyword */) || - (decl.kind === 212 /* InterfaceDeclaration */ && root.parent.parent.token === 80 /* ExtendsKeyword */); + return (decl.kind === 212 /* ClassDeclaration */ && root.parent.parent.token === 104 /* ImplementsKeyword */) || + (decl.kind === 213 /* InterfaceDeclaration */ && root.parent.parent.token === 81 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 132 /* QualifiedName */) { - while (root.parent && root.parent.kind === 132 /* QualifiedName */) { + if (root.parent.kind === 133 /* QualifiedName */) { + while (root.parent && root.parent.kind === 133 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 148 /* TypeReference */ && !isLastClause; + return root.parent.kind === 149 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 132 /* QualifiedName */) { + while (node.parent.kind === 133 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { - ts.Debug.assert(node.kind === 66 /* Identifier */); + ts.Debug.assert(node.kind === 67 /* Identifier */); // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 132 /* QualifiedName */ && + if (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 218 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 219 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 224 /* ExportAssignment */) { + if (node.parent.kind === 225 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -45130,15 +46407,15 @@ var ts; return; } switch (node.kind) { - case 163 /* PropertyAccessExpression */: - case 132 /* QualifiedName */: - case 8 /* StringLiteral */: - case 81 /* FalseKeyword */: - case 96 /* TrueKeyword */: - case 90 /* NullKeyword */: - case 92 /* SuperKeyword */: - case 94 /* ThisKeyword */: - case 66 /* Identifier */: + case 164 /* PropertyAccessExpression */: + case 133 /* QualifiedName */: + case 9 /* StringLiteral */: + case 82 /* FalseKeyword */: + case 97 /* TrueKeyword */: + case 91 /* NullKeyword */: + case 93 /* SuperKeyword */: + case 95 /* ThisKeyword */: + case 67 /* Identifier */: break; // Cant create the text span default: @@ -45152,9 +46429,9 @@ var ts; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { // If this is name of a module declarations, check if this is right side of dotted module name - // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of + // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 215 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 216 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -45188,17 +46465,17 @@ var ts; // been canceled. That would be an enormous amount of chattyness, along with the all // the overhead of marshalling the data to/from the host. So instead we pick a few // reasonable node kinds to bother checking on. These node kinds represent high level - // constructs that we would expect to see commonly, but just at a far less frequent + // constructs that we would expect to see commonly, but just at a far less frequent // interval. // // For example, in checker.ts (around 750k) we only have around 600 of these constructs. // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 215 /* ModuleDeclaration */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: + case 216 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -45252,7 +46529,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 215 /* ModuleDeclaration */ && + return declaration.kind === 216 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -45262,7 +46539,7 @@ var ts; if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { var kind = node.kind; checkForClassificationCancellation(kind); - if (kind === 66 /* Identifier */ && !ts.nodeIsMissing(node)) { + if (kind === 67 /* Identifier */ && !ts.nodeIsMissing(node)) { var identifier = node; // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run @@ -45323,8 +46600,8 @@ var ts; var spanStart = span.start; var spanLength = span.length; // Make a scanner we can get trivia from. - var triviaScanner = ts.createScanner(2 /* Latest */, false, sourceFile.languageVariant, sourceFile.text); - var mergeConflictScanner = ts.createScanner(2 /* Latest */, false, sourceFile.languageVariant, sourceFile.text); + var triviaScanner = ts.createScanner(2 /* Latest */, /*skipTrivia:*/ false, sourceFile.languageVariant, sourceFile.text); + var mergeConflictScanner = ts.createScanner(2 /* Latest */, /*skipTrivia:*/ false, sourceFile.languageVariant, sourceFile.text); var result = []; processElement(sourceFile); return { spans: result, endOfLineState: 0 /* None */ }; @@ -45355,13 +46632,13 @@ var ts; // Only bother with the trivia if it at least intersects the span of interest. if (ts.isComment(kind)) { classifyComment(token, kind, start, width); - // Classifying a comment might cause us to reuse the trivia scanner + // Classifying a comment might cause us to reuse the trivia scanner // (because of jsdoc comments). So after we classify the comment make // sure we set the scanner position back to where it needs to be. triviaScanner.setTextPos(end); continue; } - if (kind === 6 /* ConflictMarkerTrivia */) { + if (kind === 7 /* ConflictMarkerTrivia */) { var text = sourceFile.text; var ch = text.charCodeAt(start); // for the <<<<<<< and >>>>>>> markers, we just add them in as comments @@ -45399,7 +46676,7 @@ var ts; for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) { var tag = _a[_i]; // As we walk through each tag, classify the portion of text from the end of - // the last tag (or the start of the entire doc comment) as 'comment'. + // the last tag (or the start of the entire doc comment) as 'comment'. if (tag.pos !== pos) { pushCommentRange(pos, tag.pos - pos); } @@ -45407,16 +46684,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 264 /* JSDocParameterTag */: + case 265 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 267 /* JSDocTemplateTag */: + case 268 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 266 /* JSDocTypeTag */: + case 267 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 265 /* JSDocReturnTag */: + case 266 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -45451,7 +46728,7 @@ var ts; } } function classifyDisabledMergeCode(text, start, end) { - // Classify the line that the ======= marker is on as a comment. Then just lex + // Classify the line that the ======= marker is on as a comment. Then just lex // all further tokens and add them to the result. for (var i = start; i < end; i++) { if (ts.isLineBreak(text.charCodeAt(i))) { @@ -45487,7 +46764,7 @@ var ts; } } } - // for accurate classification, the actual token should be passed in. however, for + // for accurate classification, the actual token should be passed in. however, for // cases like 'disabled merge code' classification, we just get the token kind and // classify based on that instead. function classifyTokenType(tokenKind, token) { @@ -45496,7 +46773,7 @@ var ts; } // Special case < and > If they appear in a generic context they are punctuation, // not operators. - if (tokenKind === 24 /* LessThanToken */ || tokenKind === 26 /* GreaterThanToken */) { + if (tokenKind === 25 /* LessThanToken */ || tokenKind === 27 /* GreaterThanToken */) { // If the node owning the token has a type argument list or type parameter list, then // we can effectively assume that a '<' and '>' belong to those lists. if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { @@ -45505,30 +46782,30 @@ var ts; } if (ts.isPunctuation(tokenKind)) { if (token) { - if (tokenKind === 54 /* EqualsToken */) { + if (tokenKind === 55 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 208 /* VariableDeclaration */ || - token.parent.kind === 138 /* PropertyDeclaration */ || - token.parent.kind === 135 /* Parameter */) { + if (token.parent.kind === 209 /* VariableDeclaration */ || + token.parent.kind === 139 /* PropertyDeclaration */ || + token.parent.kind === 136 /* Parameter */) { return 5 /* operator */; } } - if (token.parent.kind === 178 /* BinaryExpression */ || - token.parent.kind === 176 /* PrefixUnaryExpression */ || - token.parent.kind === 177 /* PostfixUnaryExpression */ || - token.parent.kind === 179 /* ConditionalExpression */) { + if (token.parent.kind === 179 /* BinaryExpression */ || + token.parent.kind === 177 /* PrefixUnaryExpression */ || + token.parent.kind === 178 /* PostfixUnaryExpression */ || + token.parent.kind === 180 /* ConditionalExpression */) { return 5 /* operator */; } } return 10 /* punctuation */; } - else if (tokenKind === 7 /* NumericLiteral */) { + else if (tokenKind === 8 /* NumericLiteral */) { return 4 /* numericLiteral */; } - else if (tokenKind === 8 /* StringLiteral */) { + else if (tokenKind === 9 /* StringLiteral */) { return 6 /* stringLiteral */; } - else if (tokenKind === 9 /* RegularExpressionLiteral */) { + else if (tokenKind === 10 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. return 6 /* stringLiteral */; } @@ -45536,35 +46813,35 @@ var ts; // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */; } - else if (tokenKind === 66 /* Identifier */) { + else if (tokenKind === 67 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 135 /* Parameter */: + case 136 /* Parameter */: if (token.parent.name === token) { return 17 /* parameterName */; } @@ -45630,14 +46907,14 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14 /* OpenBraceToken */: return 15 /* CloseBraceToken */; - case 16 /* OpenParenToken */: return 17 /* CloseParenToken */; - case 18 /* OpenBracketToken */: return 19 /* CloseBracketToken */; - case 24 /* LessThanToken */: return 26 /* GreaterThanToken */; - case 15 /* CloseBraceToken */: return 14 /* OpenBraceToken */; - case 17 /* CloseParenToken */: return 16 /* OpenParenToken */; - case 19 /* CloseBracketToken */: return 18 /* OpenBracketToken */; - case 26 /* GreaterThanToken */: return 24 /* LessThanToken */; + case 15 /* OpenBraceToken */: return 16 /* CloseBraceToken */; + case 17 /* OpenParenToken */: return 18 /* CloseParenToken */; + case 19 /* OpenBracketToken */: return 20 /* CloseBracketToken */; + case 25 /* LessThanToken */: return 27 /* GreaterThanToken */; + case 16 /* CloseBraceToken */: return 15 /* OpenBraceToken */; + case 18 /* CloseParenToken */: return 17 /* OpenParenToken */; + case 20 /* CloseBracketToken */: return 19 /* OpenBracketToken */; + case 27 /* GreaterThanToken */: return 25 /* LessThanToken */; } return undefined; } @@ -45672,12 +46949,73 @@ var ts; } return []; } + /** + * Checks if position points to a valid position to add JSDoc comments, and if so, + * returns the appropriate template. Otherwise returns an empty string. + * Valid positions are + * - outside of comments, statements, and expressions, and + * - preceding a function declaration. + * + * Hosts should ideally check that: + * - The line is all whitespace up to 'position' before performing the insertion. + * - If the keystroke sequence "/\*\*" induced the call, we also check that the next + * non-whitespace character is '*', which (approximately) indicates whether we added + * the second '*' to complete an existing (JSDoc) comment. + * @param fileName The file in which to perform the check. + * @param position The (character-indexed) position in the file where the check should + * be performed. + */ + function getDocCommentTemplateAtPosition(fileName, position) { + var start = new Date().getTime(); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + // Check if in a context where we don't want to perform any insertion + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { + return undefined; + } + var tokenAtPos = ts.getTokenAtPosition(sourceFile, position); + var tokenStart = tokenAtPos.getStart(); + if (!tokenAtPos || tokenStart < position) { + return undefined; + } + // TODO: add support for: + // - methods + // - constructors + // - class decls + var containingFunction = ts.getAncestor(tokenAtPos, 211 /* FunctionDeclaration */); + if (!containingFunction || containingFunction.getStart() < position) { + return undefined; + } + var parameters = containingFunction.parameters; + var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); + var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + // TODO: call a helper method instead once PR #4133 gets merged in. + var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; + var docParams = parameters.reduce(function (prev, cur, index) { + return prev + + indentationStr + " * @param " + (cur.name.kind === 67 /* Identifier */ ? cur.name.text : "param" + index) + newLine; + }, ""); + // A doc comment consists of the following + // * The opening comment line + // * the first line (without a param) for the object's untagged info (this is also where the caret ends up) + // * the '@param'-tagged lines + // * TODO: other tags. + // * the closing comment line + // * if the caret was directly in front of the object, then we add an extra line and indentation. + var preamble = "/**" + newLine + + indentationStr + " * "; + var result = preamble + newLine + + docParams + + indentationStr + " */" + + (tokenStart === position ? newLine + indentationStr : ""); + return { newText: result, caretOffset: preamble.length }; + } function getTodoComments(fileName, descriptors) { - // Note: while getting todo comments seems like a syntactic operation, we actually + // Note: while getting todo comments seems like a syntactic operation, we actually // treat it as a semantic operation here. This is because we expect our host to call // this on every single file. If we treat this syntactically, then that will cause // us to populate and throw away the tree in our syntax tree cache for each file. By - // treating this as a semantic operation, we can access any tree without throwing + // treating this as a semantic operation, we can access any tree without throwing // anything away. synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -45701,7 +47039,7 @@ var ts; // 0) The full match for the entire regexp. // 1) The preamble to the message portion. // 2) The message portion. - // 3...N) The descriptor that was matched - by index. 'undefined' for each + // 3...N) The descriptor that was matched - by index. 'undefined' for each // descriptor that didn't match. an actual value if it did match. // // i.e. 'undefined' in position 3 above means TODO(jason) didn't match. @@ -45723,7 +47061,7 @@ var ts; } } ts.Debug.assert(descriptor !== undefined); - // We don't want to match something like 'TODOBY', so we make sure a non + // We don't want to match something like 'TODOBY', so we make sure a non // letter/digit follows the match. if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { continue; @@ -45768,10 +47106,10 @@ var ts; // (?:(TODO\(jason\))|(HACK)) // // Note that the outermost group is *not* a capture group, but the innermost groups - // *are* capture groups. By capturing the inner literals we can determine after + // *are* capture groups. By capturing the inner literals we can determine after // matching which descriptor we are dealing with. var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; - // After matching a descriptor literal, the following regexp matches the rest of the + // After matching a descriptor literal, the following regexp matches the rest of the // text up to the end of the line (or */). var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; @@ -45802,7 +47140,7 @@ var ts; var typeChecker = program.getTypeChecker(); var node = ts.getTouchingWord(sourceFile, position); // Can only rename an identifier. - if (node && node.kind === 66 /* Identifier */) { + if (node && node.kind === 67 /* Identifier */) { var symbol = typeChecker.getSymbolAtLocation(node); // Only allow a symbol to be renamed if it actually has at least one declaration. if (symbol) { @@ -45882,6 +47220,7 @@ var ts; getFormattingEditsForRange: getFormattingEditsForRange, getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, + getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, getEmitOutput: getEmitOutput, getSourceFile: getSourceFile, getProgram: getProgram @@ -45902,17 +47241,17 @@ var ts; sourceFile.nameTable = nameTable; function walk(node) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: nameTable[node.text] = node.text; break; - case 8 /* StringLiteral */: - case 7 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: // We want to store any numbers/strings if they were a name that could be // related to a declaration. So, if we have 'import x = require("something")' // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 229 /* ExternalModuleReference */ || + node.parent.kind === 230 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -45925,29 +47264,29 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 164 /* ElementAccessExpression */ && + node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier function createClassifier() { - var scanner = ts.createScanner(2 /* Latest */, false); + var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false); /// We do not have a full parser support to know when we should parse a regex or not /// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where - /// we have a series of divide operator. this list allows us to be more accurate by ruling out + /// we have a series of divide operator. this list allows us to be more accurate by ruling out /// locations where a regexp cannot exist. var noRegexTable = []; - noRegexTable[66 /* Identifier */] = true; - noRegexTable[8 /* StringLiteral */] = true; - noRegexTable[7 /* NumericLiteral */] = true; - noRegexTable[9 /* RegularExpressionLiteral */] = true; - noRegexTable[94 /* ThisKeyword */] = true; - noRegexTable[39 /* PlusPlusToken */] = true; - noRegexTable[40 /* MinusMinusToken */] = true; - noRegexTable[17 /* CloseParenToken */] = true; - noRegexTable[19 /* CloseBracketToken */] = true; - noRegexTable[15 /* CloseBraceToken */] = true; - noRegexTable[96 /* TrueKeyword */] = true; - noRegexTable[81 /* FalseKeyword */] = true; + noRegexTable[67 /* Identifier */] = true; + noRegexTable[9 /* StringLiteral */] = true; + noRegexTable[8 /* NumericLiteral */] = true; + noRegexTable[10 /* RegularExpressionLiteral */] = true; + noRegexTable[95 /* ThisKeyword */] = true; + noRegexTable[40 /* PlusPlusToken */] = true; + noRegexTable[41 /* MinusMinusToken */] = true; + noRegexTable[18 /* CloseParenToken */] = true; + noRegexTable[20 /* CloseBracketToken */] = true; + noRegexTable[16 /* CloseBraceToken */] = true; + noRegexTable[97 /* TrueKeyword */] = true; + noRegexTable[82 /* 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 @@ -45972,11 +47311,11 @@ var ts; /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */ function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { - if (keyword2 === 120 /* GetKeyword */ || - keyword2 === 126 /* SetKeyword */ || - keyword2 === 118 /* ConstructorKeyword */ || - keyword2 === 110 /* StaticKeyword */) { - // Allow things like "public get", "public constructor" and "public static". + if (keyword2 === 121 /* GetKeyword */ || + keyword2 === 127 /* SetKeyword */ || + keyword2 === 119 /* ConstructorKeyword */ || + keyword2 === 111 /* StaticKeyword */) { + // Allow things like "public get", "public constructor" and "public static". // These are all legal. return true; } @@ -45994,7 +47333,7 @@ var ts; var lastEnd = 0; for (var i = 0, n = dense.length; i < n; i += 3) { var start = dense[i]; - var length_2 = dense[i + 1]; + var length_3 = dense[i + 1]; var type = dense[i + 2]; // Make a whitespace entry between the last item and this one. if (lastEnd >= 0) { @@ -46003,8 +47342,8 @@ var ts; entries.push({ length: whitespaceLength_1, classification: TokenClass.Whitespace }); } } - entries.push({ length: length_2, classification: convertClassification(type) }); - lastEnd = start + length_2; + entries.push({ length: length_3, classification: convertClassification(type) }); + lastEnd = start + length_3; } var whitespaceLength = text.length - lastEnd; if (whitespaceLength > 0) { @@ -46074,7 +47413,7 @@ var ts; offset = 2; // fallthrough case 6 /* InTemplateSubstitutionPosition */: - templateStack.push(11 /* TemplateHead */); + templateStack.push(12 /* TemplateHead */); break; } scanner.setText(text); @@ -46093,83 +47432,83 @@ var ts; // token. So the classification will go back to being an identifier. The moment the user // types again, number will become a keyword, then an identifier, etc. etc. // - // To try to avoid this problem, we avoid classifying contextual keywords as keywords + // To try to avoid this problem, we avoid classifying contextual keywords as keywords // when the user is potentially typing something generic. We just can't do a good enough // job at the lexical level, and so well leave it up to the syntactic classifier to make // the determination. // - // In order to determine if the user is potentially typing something generic, we use a + // In order to determine if the user is potentially typing something generic, we use a // weak heuristic where we track < and > tokens. It's a weak heuristic, but should // work well enough in practice. var angleBracketStack = 0; do { token = scanner.scan(); if (!ts.isTrivia(token)) { - if ((token === 37 /* SlashToken */ || token === 58 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { - if (scanner.reScanSlashToken() === 9 /* RegularExpressionLiteral */) { - token = 9 /* RegularExpressionLiteral */; + if ((token === 38 /* SlashToken */ || token === 59 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === 10 /* RegularExpressionLiteral */) { + token = 10 /* RegularExpressionLiteral */; } } - else if (lastNonTriviaToken === 20 /* DotToken */ && isKeyword(token)) { - token = 66 /* Identifier */; + else if (lastNonTriviaToken === 21 /* DotToken */ && isKeyword(token)) { + token = 67 /* 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 + // 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 = 66 /* Identifier */; + token = 67 /* Identifier */; } - else if (lastNonTriviaToken === 66 /* Identifier */ && - token === 24 /* LessThanToken */) { - // Could be the start of something generic. Keep track of that by bumping + else if (lastNonTriviaToken === 67 /* Identifier */ && + token === 25 /* LessThanToken */) { + // Could be the start of something generic. Keep track of that by bumping // up the current count of generic contexts we may be in. angleBracketStack++; } - else if (token === 26 /* GreaterThanToken */ && angleBracketStack > 0) { + else if (token === 27 /* GreaterThanToken */ && angleBracketStack > 0) { // If we think we're currently in something generic, then mark that that // generic entity is complete. angleBracketStack--; } - else if (token === 114 /* AnyKeyword */ || - token === 127 /* StringKeyword */ || - token === 125 /* NumberKeyword */ || - token === 117 /* BooleanKeyword */ || - token === 128 /* SymbolKeyword */) { + else if (token === 115 /* AnyKeyword */ || + token === 128 /* StringKeyword */ || + token === 126 /* NumberKeyword */ || + token === 118 /* BooleanKeyword */ || + token === 129 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { - // If it looks like we're could be in something generic, don't classify this + // 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 = 66 /* Identifier */; + token = 67 /* Identifier */; } } - else if (token === 11 /* TemplateHead */) { + else if (token === 12 /* TemplateHead */) { templateStack.push(token); } - else if (token === 14 /* OpenBraceToken */) { + else if (token === 15 /* 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 === 15 /* CloseBraceToken */) { + else if (token === 16 /* 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 = ts.lastOrUndefined(templateStack); - if (lastTemplateStackToken === 11 /* TemplateHead */) { + if (lastTemplateStackToken === 12 /* TemplateHead */) { token = scanner.reScanTemplateToken(); // Only pop on a TemplateTail; a TemplateMiddle indicates there is more for us. - if (token === 13 /* TemplateTail */) { + if (token === 14 /* TemplateTail */) { templateStack.pop(); } else { - ts.Debug.assert(token === 12 /* TemplateMiddle */, "Should have been a template middle. Was " + token); + ts.Debug.assert(token === 13 /* TemplateMiddle */, "Should have been a template middle. Was " + token); } } else { - ts.Debug.assert(lastTemplateStackToken === 14 /* OpenBraceToken */, "Should have been an open brace. Was: " + token); + ts.Debug.assert(lastTemplateStackToken === 15 /* OpenBraceToken */, "Should have been an open brace. Was: " + token); templateStack.pop(); } } @@ -46184,7 +47523,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { @@ -46210,10 +47549,10 @@ var ts; } else if (ts.isTemplateLiteralKind(token)) { if (scanner.isUnterminated()) { - if (token === 13 /* TemplateTail */) { + if (token === 14 /* TemplateTail */) { result.endOfLineState = 5 /* InTemplateMiddleOrTail */; } - else if (token === 10 /* NoSubstitutionTemplateLiteral */) { + else if (token === 11 /* NoSubstitutionTemplateLiteral */) { result.endOfLineState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */; } else { @@ -46221,7 +47560,7 @@ var ts; } } } - else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11 /* TemplateHead */) { + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 12 /* TemplateHead */) { result.endOfLineState = 6 /* InTemplateSubstitutionPosition */; } } @@ -46232,8 +47571,8 @@ var ts; return; } if (start === 0 && offset > 0) { - // We're classifying the first token, and this was a case where we prepended - // text. We should consider the start of this token to be at the start of + // We're classifying the first token, and this was a case where we prepended + // text. We should consider the start of this token to be at the start of // the original text. start += offset; } @@ -46251,42 +47590,42 @@ var ts; } function isBinaryExpressionOperatorToken(token) { switch (token) { - case 36 /* AsteriskToken */: - case 37 /* SlashToken */: - case 38 /* PercentToken */: - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 41 /* LessThanLessThanToken */: - case 42 /* GreaterThanGreaterThanToken */: - case 43 /* GreaterThanGreaterThanGreaterThanToken */: - case 24 /* LessThanToken */: - case 26 /* GreaterThanToken */: - case 27 /* LessThanEqualsToken */: - case 28 /* GreaterThanEqualsToken */: - case 88 /* InstanceOfKeyword */: - case 87 /* InKeyword */: - case 29 /* EqualsEqualsToken */: - case 30 /* ExclamationEqualsToken */: - case 31 /* EqualsEqualsEqualsToken */: - case 32 /* ExclamationEqualsEqualsToken */: - case 44 /* AmpersandToken */: - case 46 /* CaretToken */: - case 45 /* BarToken */: - case 49 /* AmpersandAmpersandToken */: - case 50 /* BarBarToken */: - case 64 /* BarEqualsToken */: - case 63 /* AmpersandEqualsToken */: - case 65 /* CaretEqualsToken */: - case 60 /* LessThanLessThanEqualsToken */: - case 61 /* GreaterThanGreaterThanEqualsToken */: - case 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 55 /* PlusEqualsToken */: - case 56 /* MinusEqualsToken */: - case 57 /* AsteriskEqualsToken */: - case 58 /* SlashEqualsToken */: - case 59 /* PercentEqualsToken */: - case 54 /* EqualsToken */: - case 23 /* CommaToken */: + case 37 /* AsteriskToken */: + case 38 /* SlashToken */: + case 39 /* PercentToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 42 /* LessThanLessThanToken */: + case 43 /* GreaterThanGreaterThanToken */: + case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 25 /* LessThanToken */: + case 27 /* GreaterThanToken */: + case 28 /* LessThanEqualsToken */: + case 29 /* GreaterThanEqualsToken */: + case 89 /* InstanceOfKeyword */: + case 88 /* InKeyword */: + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: + case 45 /* AmpersandToken */: + case 47 /* CaretToken */: + case 46 /* BarToken */: + case 50 /* AmpersandAmpersandToken */: + case 51 /* BarBarToken */: + case 65 /* BarEqualsToken */: + case 64 /* AmpersandEqualsToken */: + case 66 /* CaretEqualsToken */: + case 61 /* LessThanLessThanEqualsToken */: + case 62 /* GreaterThanGreaterThanEqualsToken */: + case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 56 /* PlusEqualsToken */: + case 57 /* MinusEqualsToken */: + case 58 /* AsteriskEqualsToken */: + case 59 /* SlashEqualsToken */: + case 60 /* PercentEqualsToken */: + case 55 /* EqualsToken */: + case 24 /* CommaToken */: return true; default: return false; @@ -46294,19 +47633,19 @@ var ts; } function isPrefixUnaryExpressionOperatorToken(token) { switch (token) { - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 48 /* TildeToken */: - case 47 /* ExclamationToken */: - case 39 /* PlusPlusToken */: - case 40 /* MinusMinusToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 49 /* TildeToken */: + case 48 /* ExclamationToken */: + case 40 /* PlusPlusToken */: + case 41 /* MinusMinusToken */: return true; default: return false; } } function isKeyword(token) { - return token >= 67 /* FirstKeyword */ && token <= 131 /* LastKeyword */; + return token >= 68 /* FirstKeyword */ && token <= 132 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -46315,24 +47654,24 @@ var ts; else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5 /* operator */; } - else if (token >= 14 /* FirstPunctuation */ && token <= 65 /* LastPunctuation */) { + else if (token >= 15 /* FirstPunctuation */ && token <= 66 /* LastPunctuation */) { return 10 /* punctuation */; } switch (token) { - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: return 4 /* numericLiteral */; - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: return 6 /* stringLiteral */; - case 9 /* RegularExpressionLiteral */: + case 10 /* RegularExpressionLiteral */: return 7 /* regularExpressionLiteral */; - case 6 /* ConflictMarkerTrivia */: + case 7 /* ConflictMarkerTrivia */: case 3 /* MultiLineCommentTrivia */: case 2 /* SingleLineCommentTrivia */: return 1 /* comment */; case 5 /* WhitespaceTrivia */: case 4 /* NewLineTrivia */: return 8 /* whiteSpace */; - case 66 /* Identifier */: + case 67 /* Identifier */: default: if (ts.isTemplateLiteralKind(token)) { return 6 /* stringLiteral */; @@ -46364,7 +47703,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 245 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 246 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = -1; proto.end = -1; @@ -46434,159 +47773,159 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 194 /* DoStatement */) { + if (node.parent.kind === 195 /* DoStatement */) { // Set span as if on while keyword return spanInPreviousNode(node); } - if (node.parent.kind === 196 /* ForStatement */) { + if (node.parent.kind === 197 /* ForStatement */) { // For now lets set the span on this expression, fix it later return textSpan(node); } - if (node.parent.kind === 178 /* BinaryExpression */ && node.parent.operatorToken.kind === 23 /* CommaToken */) { + if (node.parent.kind === 179 /* BinaryExpression */ && node.parent.operatorToken.kind === 24 /* CommaToken */) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } - if (node.parent.kind === 171 /* ArrowFunction */ && node.parent.body === node) { + if (node.parent.kind === 172 /* ArrowFunction */ && node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); } } switch (node.kind) { - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 208 /* VariableDeclaration */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 209 /* VariableDeclaration */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return spanInVariableDeclaration(node); - case 135 /* Parameter */: + case 136 /* Parameter */: return spanInParameterDeclaration(node); - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 141 /* Constructor */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 142 /* Constructor */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 189 /* Block */: + case 190 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 216 /* ModuleBlock */: + case 217 /* ModuleBlock */: return spanInBlock(node); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return spanInBlock(node.block); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 195 /* WhileStatement */: + case 196 /* WhileStatement */: // Span on while(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 194 /* DoStatement */: + case 195 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 207 /* DebuggerStatement */: + case 208 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 193 /* IfStatement */: + case 194 /* IfStatement */: // set on if(..) span return textSpan(node, ts.findNextToken(node.expression, node)); - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 200 /* BreakStatement */: - case 199 /* ContinueStatement */: + case 201 /* BreakStatement */: + case 200 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 196 /* ForStatement */: + case 197 /* ForStatement */: return spanInForStatement(node); - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: // span on for (a in ...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: // span on switch(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 238 /* CaseClause */: - case 239 /* DefaultClause */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 206 /* TryStatement */: + case 207 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 205 /* ThrowStatement */: + case 206 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 244 /* EnumMember */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 245 /* EnumMember */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: // span on complete node return textSpan(node); - case 202 /* WithStatement */: + case 203 /* WithStatement */: // span in statement return spanInNode(node.statement); // No breakpoint in interface, type alias - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: return undefined; // Tokens: - case 22 /* SemicolonToken */: + case 23 /* SemicolonToken */: case 1 /* EndOfFileToken */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); - case 23 /* CommaToken */: + case 24 /* CommaToken */: return spanInPreviousNode(node); - case 14 /* OpenBraceToken */: + case 15 /* OpenBraceToken */: return spanInOpenBraceToken(node); - case 15 /* CloseBraceToken */: + case 16 /* CloseBraceToken */: return spanInCloseBraceToken(node); - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: return spanInOpenParenToken(node); - case 17 /* CloseParenToken */: + case 18 /* CloseParenToken */: return spanInCloseParenToken(node); - case 52 /* ColonToken */: + case 53 /* ColonToken */: return spanInColonToken(node); - case 26 /* GreaterThanToken */: - case 24 /* LessThanToken */: + case 27 /* GreaterThanToken */: + case 25 /* LessThanToken */: return spanInGreaterThanOrLessThanToken(node); // Keywords: - case 101 /* WhileKeyword */: + case 102 /* WhileKeyword */: return spanInWhileKeyword(node); - case 77 /* ElseKeyword */: - case 69 /* CatchKeyword */: - case 82 /* FinallyKeyword */: + case 78 /* ElseKeyword */: + case 70 /* CatchKeyword */: + case 83 /* FinallyKeyword */: return spanInNextNode(node); default: // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 242 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 243 /* PropertyAssignment */ && node.parent.name === node) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 168 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 169 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNode(node.parent.expression); } // return type of function go to previous token @@ -46599,12 +47938,12 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 197 /* ForInStatement */ || - variableDeclaration.parent.parent.kind === 198 /* ForOfStatement */) { + if (variableDeclaration.parent.parent.kind === 198 /* ForInStatement */ || + variableDeclaration.parent.parent.kind === 199 /* ForOfStatement */) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 190 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 196 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 191 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 197 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -46658,7 +47997,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 211 /* ClassDeclaration */ && functionDeclaration.kind !== 141 /* Constructor */); + (functionDeclaration.parent.kind === 212 /* ClassDeclaration */ && functionDeclaration.kind !== 142 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -46681,18 +48020,18 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 195 /* WhileStatement */: - case 193 /* IfStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 196 /* WhileStatement */: + case 194 /* IfStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 196 /* ForStatement */: + case 197 /* ForStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement @@ -46700,7 +48039,7 @@ var ts; } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 209 /* VariableDeclarationList */) { + if (forStatement.initializer.kind === 210 /* VariableDeclarationList */) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -46720,13 +48059,13 @@ var ts; // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 217 /* CaseBlock */: + case 218 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -46734,25 +48073,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 216 /* ModuleBlock */: + case 217 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 214 /* EnumDeclaration */: - case 211 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 212 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 189 /* Block */: + case 190 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through. - case 241 /* CatchClause */: + case 242 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); ; - case 217 /* CaseBlock */: + case 218 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -46766,7 +48105,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 194 /* DoStatement */) { + if (node.parent.kind === 195 /* DoStatement */) { // Go to while keyword and do action instead return spanInPreviousNode(node); } @@ -46776,17 +48115,17 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 141 /* Constructor */: - case 195 /* WhileStatement */: - case 194 /* DoStatement */: - case 196 /* ForStatement */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 142 /* Constructor */: + case 196 /* WhileStatement */: + case 195 /* DoStatement */: + case 197 /* ForStatement */: return spanInPreviousNode(node); // Default to parent node default: @@ -46797,19 +48136,19 @@ var ts; } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration - if (ts.isFunctionLike(node.parent) || node.parent.kind === 242 /* PropertyAssignment */) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 243 /* PropertyAssignment */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 168 /* TypeAssertionExpression */) { + if (node.parent.kind === 169 /* TypeAssertionExpression */) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 194 /* DoStatement */) { + if (node.parent.kind === 195 /* DoStatement */) { // Set span on while expression return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } @@ -46878,9 +48217,18 @@ var ts; })(); var LanguageServiceShimHostAdapter = (function () { function LanguageServiceShimHostAdapter(shimHost) { + var _this = this; this.shimHost = shimHost; this.loggingEnabled = false; this.tracingEnabled = false; + // if shimHost is a COM object then property check will become method call with no arguments. + // 'in' does not have this effect. + if ("getModuleResolutionsForFile" in this.shimHost) { + this.resolveModuleNames = function (moduleNames, containingFile) { + var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); + return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -46988,10 +48336,26 @@ var ts; function CoreServicesShimHostAdapter(shimHost) { this.shimHost = shimHost; } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension) { - var encoded = this.shimHost.readDirectory(rootDir, extension); + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { + // Wrap the API changes for 1.5 release. This try/catch + // should be removed once TypeScript 1.5 has shipped. + // Also consider removing the optional designation for + // the exclude param at this time. + var encoded; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension); + } return JSON.parse(encoded); }; + CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { + return this.shimHost.fileExists(fileName); + }; + CoreServicesShimHostAdapter.prototype.readFile = function (fileName) { + return this.shimHost.readFile(fileName); + }; return CoreServicesShimHostAdapter; })(); ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; @@ -47098,7 +48462,7 @@ var ts; }); }; LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { - var newLine = this.getNewLine(); + var newLine = ts.getNewLineOrDefaultFromHost(this.host); return ts.realizeDiagnostics(diagnostics, newLine); }; LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { @@ -47131,9 +48495,6 @@ var ts; return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); }; - 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 () { @@ -47270,7 +48631,10 @@ var ts; LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { var _this = this; return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { - return _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + // workaround for VS document higlighting issue - keep only items from the initial file + var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); + return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); }); }; /// COMPLETION LISTS @@ -47318,6 +48682,10 @@ var ts; return edits; }); }; + LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); }); + }; /// NAVIGATE TO /** Return a list of symbols that are interesting to navigate to */ LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { @@ -47401,12 +48769,20 @@ var ts; CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); }; + CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + }); + }; 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: [], + ambientExternalModules: result.ambientExternalModules, isLibFile: result.isLibFile }; ts.forEach(result.referencedFiles, function (refFile) { @@ -47530,4 +48906,4 @@ var TypeScript; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); /* @internal */ -var toolsVersion = "1.5"; +var toolsVersion = "1.6"; diff --git a/lib/typescriptServices.d.ts b/lib/typescriptServices.d.ts index 9840a5e688f15..890c77e5ae7b3 100644 --- a/lib/typescriptServices.d.ts +++ b/lib/typescriptServices.d.ts @@ -23,6 +23,7 @@ declare namespace ts { contains(fileName: string): boolean; remove(fileName: string): void; forEachValue(f: (v: T) => void): void; + clear(): void; } interface TextRange { pos: number; @@ -35,293 +36,294 @@ declare namespace ts { MultiLineCommentTrivia = 3, NewLineTrivia = 4, WhitespaceTrivia = 5, - ConflictMarkerTrivia = 6, - NumericLiteral = 7, - StringLiteral = 8, - RegularExpressionLiteral = 9, - NoSubstitutionTemplateLiteral = 10, - TemplateHead = 11, - TemplateMiddle = 12, - TemplateTail = 13, - OpenBraceToken = 14, - CloseBraceToken = 15, - OpenParenToken = 16, - CloseParenToken = 17, - OpenBracketToken = 18, - CloseBracketToken = 19, - DotToken = 20, - DotDotDotToken = 21, - SemicolonToken = 22, - CommaToken = 23, - LessThanToken = 24, - LessThanSlashToken = 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, - AtToken = 53, - EqualsToken = 54, - PlusEqualsToken = 55, - MinusEqualsToken = 56, - AsteriskEqualsToken = 57, - SlashEqualsToken = 58, - PercentEqualsToken = 59, - LessThanLessThanEqualsToken = 60, - GreaterThanGreaterThanEqualsToken = 61, - GreaterThanGreaterThanGreaterThanEqualsToken = 62, - AmpersandEqualsToken = 63, - BarEqualsToken = 64, - CaretEqualsToken = 65, - Identifier = 66, - BreakKeyword = 67, - CaseKeyword = 68, - CatchKeyword = 69, - ClassKeyword = 70, - ConstKeyword = 71, - ContinueKeyword = 72, - DebuggerKeyword = 73, - DefaultKeyword = 74, - DeleteKeyword = 75, - DoKeyword = 76, - ElseKeyword = 77, - EnumKeyword = 78, - ExportKeyword = 79, - ExtendsKeyword = 80, - FalseKeyword = 81, - FinallyKeyword = 82, - ForKeyword = 83, - FunctionKeyword = 84, - IfKeyword = 85, - ImportKeyword = 86, - InKeyword = 87, - InstanceOfKeyword = 88, - NewKeyword = 89, - NullKeyword = 90, - ReturnKeyword = 91, - SuperKeyword = 92, - SwitchKeyword = 93, - ThisKeyword = 94, - ThrowKeyword = 95, - TrueKeyword = 96, - TryKeyword = 97, - TypeOfKeyword = 98, - VarKeyword = 99, - VoidKeyword = 100, - WhileKeyword = 101, - WithKeyword = 102, - ImplementsKeyword = 103, - InterfaceKeyword = 104, - LetKeyword = 105, - PackageKeyword = 106, - PrivateKeyword = 107, - ProtectedKeyword = 108, - PublicKeyword = 109, - StaticKeyword = 110, - YieldKeyword = 111, - AbstractKeyword = 112, - AsKeyword = 113, - AnyKeyword = 114, - AsyncKeyword = 115, - AwaitKeyword = 116, - BooleanKeyword = 117, - ConstructorKeyword = 118, - DeclareKeyword = 119, - GetKeyword = 120, - IsKeyword = 121, - ModuleKeyword = 122, - NamespaceKeyword = 123, - RequireKeyword = 124, - NumberKeyword = 125, - SetKeyword = 126, - StringKeyword = 127, - SymbolKeyword = 128, - TypeKeyword = 129, - FromKeyword = 130, - OfKeyword = 131, - QualifiedName = 132, - ComputedPropertyName = 133, - TypeParameter = 134, - Parameter = 135, - Decorator = 136, - PropertySignature = 137, - PropertyDeclaration = 138, - MethodSignature = 139, - MethodDeclaration = 140, - Constructor = 141, - GetAccessor = 142, - SetAccessor = 143, - CallSignature = 144, - ConstructSignature = 145, - IndexSignature = 146, - TypePredicate = 147, - TypeReference = 148, - FunctionType = 149, - ConstructorType = 150, - TypeQuery = 151, - TypeLiteral = 152, - ArrayType = 153, - TupleType = 154, - UnionType = 155, - IntersectionType = 156, - ParenthesizedType = 157, - ObjectBindingPattern = 158, - ArrayBindingPattern = 159, - BindingElement = 160, - ArrayLiteralExpression = 161, - ObjectLiteralExpression = 162, - PropertyAccessExpression = 163, - ElementAccessExpression = 164, - CallExpression = 165, - NewExpression = 166, - TaggedTemplateExpression = 167, - TypeAssertionExpression = 168, - ParenthesizedExpression = 169, - FunctionExpression = 170, - ArrowFunction = 171, - DeleteExpression = 172, - TypeOfExpression = 173, - VoidExpression = 174, - AwaitExpression = 175, - PrefixUnaryExpression = 176, - PostfixUnaryExpression = 177, - BinaryExpression = 178, - ConditionalExpression = 179, - TemplateExpression = 180, - YieldExpression = 181, - SpreadElementExpression = 182, - ClassExpression = 183, - OmittedExpression = 184, - ExpressionWithTypeArguments = 185, - AsExpression = 186, - TemplateSpan = 187, - SemicolonClassElement = 188, - Block = 189, - VariableStatement = 190, - EmptyStatement = 191, - ExpressionStatement = 192, - IfStatement = 193, - DoStatement = 194, - WhileStatement = 195, - ForStatement = 196, - ForInStatement = 197, - ForOfStatement = 198, - ContinueStatement = 199, - BreakStatement = 200, - ReturnStatement = 201, - WithStatement = 202, - SwitchStatement = 203, - LabeledStatement = 204, - ThrowStatement = 205, - TryStatement = 206, - DebuggerStatement = 207, - VariableDeclaration = 208, - VariableDeclarationList = 209, - FunctionDeclaration = 210, - ClassDeclaration = 211, - InterfaceDeclaration = 212, - TypeAliasDeclaration = 213, - EnumDeclaration = 214, - ModuleDeclaration = 215, - ModuleBlock = 216, - CaseBlock = 217, - ImportEqualsDeclaration = 218, - ImportDeclaration = 219, - ImportClause = 220, - NamespaceImport = 221, - NamedImports = 222, - ImportSpecifier = 223, - ExportAssignment = 224, - ExportDeclaration = 225, - NamedExports = 226, - ExportSpecifier = 227, - MissingDeclaration = 228, - ExternalModuleReference = 229, - JsxElement = 230, - JsxSelfClosingElement = 231, - JsxOpeningElement = 232, - JsxText = 233, - JsxClosingElement = 234, - JsxAttribute = 235, - JsxSpreadAttribute = 236, - JsxExpression = 237, - CaseClause = 238, - DefaultClause = 239, - HeritageClause = 240, - CatchClause = 241, - PropertyAssignment = 242, - ShorthandPropertyAssignment = 243, - EnumMember = 244, - SourceFile = 245, - JSDocTypeExpression = 246, - JSDocAllType = 247, - JSDocUnknownType = 248, - JSDocArrayType = 249, - JSDocUnionType = 250, - JSDocTupleType = 251, - JSDocNullableType = 252, - JSDocNonNullableType = 253, - JSDocRecordType = 254, - JSDocRecordMember = 255, - JSDocTypeReference = 256, - JSDocOptionalType = 257, - JSDocFunctionType = 258, - JSDocVariadicType = 259, - JSDocConstructorType = 260, - JSDocThisType = 261, - JSDocComment = 262, - JSDocTag = 263, - JSDocParameterTag = 264, - JSDocReturnTag = 265, - JSDocTypeTag = 266, - JSDocTemplateTag = 267, - SyntaxList = 268, - Count = 269, - FirstAssignment = 54, - LastAssignment = 65, - FirstReservedWord = 67, - LastReservedWord = 102, - FirstKeyword = 67, - LastKeyword = 131, - FirstFutureReservedWord = 103, - LastFutureReservedWord = 111, - FirstTypeNode = 148, - LastTypeNode = 157, - FirstPunctuation = 14, - LastPunctuation = 65, + ShebangTrivia = 6, + ConflictMarkerTrivia = 7, + NumericLiteral = 8, + StringLiteral = 9, + RegularExpressionLiteral = 10, + NoSubstitutionTemplateLiteral = 11, + TemplateHead = 12, + TemplateMiddle = 13, + TemplateTail = 14, + OpenBraceToken = 15, + CloseBraceToken = 16, + OpenParenToken = 17, + CloseParenToken = 18, + OpenBracketToken = 19, + CloseBracketToken = 20, + DotToken = 21, + DotDotDotToken = 22, + SemicolonToken = 23, + CommaToken = 24, + LessThanToken = 25, + LessThanSlashToken = 26, + GreaterThanToken = 27, + LessThanEqualsToken = 28, + GreaterThanEqualsToken = 29, + EqualsEqualsToken = 30, + ExclamationEqualsToken = 31, + EqualsEqualsEqualsToken = 32, + ExclamationEqualsEqualsToken = 33, + EqualsGreaterThanToken = 34, + PlusToken = 35, + MinusToken = 36, + AsteriskToken = 37, + SlashToken = 38, + PercentToken = 39, + PlusPlusToken = 40, + MinusMinusToken = 41, + LessThanLessThanToken = 42, + GreaterThanGreaterThanToken = 43, + GreaterThanGreaterThanGreaterThanToken = 44, + AmpersandToken = 45, + BarToken = 46, + CaretToken = 47, + ExclamationToken = 48, + TildeToken = 49, + AmpersandAmpersandToken = 50, + BarBarToken = 51, + QuestionToken = 52, + ColonToken = 53, + AtToken = 54, + EqualsToken = 55, + PlusEqualsToken = 56, + MinusEqualsToken = 57, + AsteriskEqualsToken = 58, + SlashEqualsToken = 59, + PercentEqualsToken = 60, + LessThanLessThanEqualsToken = 61, + GreaterThanGreaterThanEqualsToken = 62, + GreaterThanGreaterThanGreaterThanEqualsToken = 63, + AmpersandEqualsToken = 64, + BarEqualsToken = 65, + CaretEqualsToken = 66, + Identifier = 67, + BreakKeyword = 68, + CaseKeyword = 69, + CatchKeyword = 70, + ClassKeyword = 71, + ConstKeyword = 72, + ContinueKeyword = 73, + DebuggerKeyword = 74, + DefaultKeyword = 75, + DeleteKeyword = 76, + DoKeyword = 77, + ElseKeyword = 78, + EnumKeyword = 79, + ExportKeyword = 80, + ExtendsKeyword = 81, + FalseKeyword = 82, + FinallyKeyword = 83, + ForKeyword = 84, + FunctionKeyword = 85, + IfKeyword = 86, + ImportKeyword = 87, + InKeyword = 88, + InstanceOfKeyword = 89, + NewKeyword = 90, + NullKeyword = 91, + ReturnKeyword = 92, + SuperKeyword = 93, + SwitchKeyword = 94, + ThisKeyword = 95, + ThrowKeyword = 96, + TrueKeyword = 97, + TryKeyword = 98, + TypeOfKeyword = 99, + VarKeyword = 100, + VoidKeyword = 101, + WhileKeyword = 102, + WithKeyword = 103, + ImplementsKeyword = 104, + InterfaceKeyword = 105, + LetKeyword = 106, + PackageKeyword = 107, + PrivateKeyword = 108, + ProtectedKeyword = 109, + PublicKeyword = 110, + StaticKeyword = 111, + YieldKeyword = 112, + AbstractKeyword = 113, + AsKeyword = 114, + AnyKeyword = 115, + AsyncKeyword = 116, + AwaitKeyword = 117, + BooleanKeyword = 118, + ConstructorKeyword = 119, + DeclareKeyword = 120, + GetKeyword = 121, + IsKeyword = 122, + ModuleKeyword = 123, + NamespaceKeyword = 124, + RequireKeyword = 125, + NumberKeyword = 126, + SetKeyword = 127, + StringKeyword = 128, + SymbolKeyword = 129, + TypeKeyword = 130, + FromKeyword = 131, + OfKeyword = 132, + QualifiedName = 133, + ComputedPropertyName = 134, + TypeParameter = 135, + Parameter = 136, + Decorator = 137, + PropertySignature = 138, + PropertyDeclaration = 139, + MethodSignature = 140, + MethodDeclaration = 141, + Constructor = 142, + GetAccessor = 143, + SetAccessor = 144, + CallSignature = 145, + ConstructSignature = 146, + IndexSignature = 147, + TypePredicate = 148, + TypeReference = 149, + FunctionType = 150, + ConstructorType = 151, + TypeQuery = 152, + TypeLiteral = 153, + ArrayType = 154, + TupleType = 155, + UnionType = 156, + IntersectionType = 157, + ParenthesizedType = 158, + ObjectBindingPattern = 159, + ArrayBindingPattern = 160, + BindingElement = 161, + ArrayLiteralExpression = 162, + ObjectLiteralExpression = 163, + PropertyAccessExpression = 164, + ElementAccessExpression = 165, + CallExpression = 166, + NewExpression = 167, + TaggedTemplateExpression = 168, + TypeAssertionExpression = 169, + ParenthesizedExpression = 170, + FunctionExpression = 171, + ArrowFunction = 172, + DeleteExpression = 173, + TypeOfExpression = 174, + VoidExpression = 175, + AwaitExpression = 176, + PrefixUnaryExpression = 177, + PostfixUnaryExpression = 178, + BinaryExpression = 179, + ConditionalExpression = 180, + TemplateExpression = 181, + YieldExpression = 182, + SpreadElementExpression = 183, + ClassExpression = 184, + OmittedExpression = 185, + ExpressionWithTypeArguments = 186, + AsExpression = 187, + TemplateSpan = 188, + SemicolonClassElement = 189, + Block = 190, + VariableStatement = 191, + EmptyStatement = 192, + ExpressionStatement = 193, + IfStatement = 194, + DoStatement = 195, + WhileStatement = 196, + ForStatement = 197, + ForInStatement = 198, + ForOfStatement = 199, + ContinueStatement = 200, + BreakStatement = 201, + ReturnStatement = 202, + WithStatement = 203, + SwitchStatement = 204, + LabeledStatement = 205, + ThrowStatement = 206, + TryStatement = 207, + DebuggerStatement = 208, + VariableDeclaration = 209, + VariableDeclarationList = 210, + FunctionDeclaration = 211, + ClassDeclaration = 212, + InterfaceDeclaration = 213, + TypeAliasDeclaration = 214, + EnumDeclaration = 215, + ModuleDeclaration = 216, + ModuleBlock = 217, + CaseBlock = 218, + ImportEqualsDeclaration = 219, + ImportDeclaration = 220, + ImportClause = 221, + NamespaceImport = 222, + NamedImports = 223, + ImportSpecifier = 224, + ExportAssignment = 225, + ExportDeclaration = 226, + NamedExports = 227, + ExportSpecifier = 228, + MissingDeclaration = 229, + ExternalModuleReference = 230, + JsxElement = 231, + JsxSelfClosingElement = 232, + JsxOpeningElement = 233, + JsxText = 234, + JsxClosingElement = 235, + JsxAttribute = 236, + JsxSpreadAttribute = 237, + JsxExpression = 238, + CaseClause = 239, + DefaultClause = 240, + HeritageClause = 241, + CatchClause = 242, + PropertyAssignment = 243, + ShorthandPropertyAssignment = 244, + EnumMember = 245, + SourceFile = 246, + JSDocTypeExpression = 247, + JSDocAllType = 248, + JSDocUnknownType = 249, + JSDocArrayType = 250, + JSDocUnionType = 251, + JSDocTupleType = 252, + JSDocNullableType = 253, + JSDocNonNullableType = 254, + JSDocRecordType = 255, + JSDocRecordMember = 256, + JSDocTypeReference = 257, + JSDocOptionalType = 258, + JSDocFunctionType = 259, + JSDocVariadicType = 260, + JSDocConstructorType = 261, + JSDocThisType = 262, + JSDocComment = 263, + JSDocTag = 264, + JSDocParameterTag = 265, + JSDocReturnTag = 266, + JSDocTypeTag = 267, + JSDocTemplateTag = 268, + SyntaxList = 269, + Count = 270, + FirstAssignment = 55, + LastAssignment = 66, + FirstReservedWord = 68, + LastReservedWord = 103, + FirstKeyword = 68, + LastKeyword = 132, + FirstFutureReservedWord = 104, + LastFutureReservedWord = 112, + FirstTypeNode = 149, + LastTypeNode = 158, + FirstPunctuation = 15, + LastPunctuation = 66, FirstToken = 0, - LastToken = 131, + LastToken = 132, FirstTriviaToken = 2, - LastTriviaToken = 6, - FirstLiteralToken = 7, - LastLiteralToken = 10, - FirstTemplateToken = 10, - LastTemplateToken = 13, - FirstBinaryOperator = 24, - LastBinaryOperator = 65, - FirstNode = 132, + LastTriviaToken = 7, + FirstLiteralToken = 8, + LastLiteralToken = 11, + FirstTemplateToken = 11, + LastTemplateToken = 14, + FirstBinaryOperator = 25, + LastBinaryOperator = 66, + FirstNode = 133, } const enum NodeFlags { Export = 1, @@ -452,9 +454,9 @@ declare namespace ts { * Several node kinds share function-like features such as a signature, * a name, and a body. These nodes should extend FunctionLikeDeclaration. * Examples: - * FunctionDeclaration - * MethodDeclaration - * AccessorDeclaration + * - FunctionDeclaration + * - MethodDeclaration + * - AccessorDeclaration */ interface FunctionLikeDeclaration extends SignatureDeclaration { _functionLikeDeclarationBrand: any; @@ -944,7 +946,7 @@ declare namespace ts { getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } - interface ParseConfigHost { + interface ParseConfigHost extends ModuleResolutionHost { readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; } interface WriteFileCallback { @@ -958,6 +960,10 @@ declare namespace ts { throwIfCancellationRequested(): void; } interface Program extends ScriptReferenceHost { + /** + * Get a list of root file names that were passed to a 'createProgram' + */ + getRootFileNames(): string[]; /** * Get a list of files in the program */ @@ -1019,11 +1025,6 @@ declare namespace ts { emitSkipped: boolean; diagnostics: Diagnostic[]; } - interface TypeCheckerHost { - getCompilerOptions(): CompilerOptions; - getSourceFiles(): SourceFile[]; - getSourceFile(fileName: string): SourceFile; - } interface TypeChecker { getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; getDeclaredTypeOfSymbol(symbol: Symbol): Type; @@ -1031,6 +1032,7 @@ declare namespace ts { getPropertyOfType(type: Type, propertyName: string): Symbol; getSignaturesOfType(type: Type, kind: SignatureKind): Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type; + getBaseTypes(type: InterfaceType): ObjectType[]; getReturnTypeOfSignature(signature: Signature): Type; getSymbolsInScope(location: Node, meaning: SymbolFlags): Symbol[]; getSymbolAtLocation(node: Node): Symbol; @@ -1054,6 +1056,7 @@ declare namespace ts { getExportsOfModule(moduleSymbol: Symbol): Symbol[]; getJsxElementAttributesType(elementNode: JsxOpeningLikeElement): Type; getJsxIntrinsicTagNames(): Symbol[]; + isOptionalParameter(node: ParameterDeclaration): boolean; } interface SymbolDisplayBuilder { buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void; @@ -1198,7 +1201,7 @@ declare namespace ts { Anonymous = 65536, Instantiated = 131072, ObjectLiteral = 524288, - ESSymbol = 4194304, + ESSymbol = 16777216, StringLike = 258, NumberLike = 132, ObjectType = 80896, @@ -1218,8 +1221,6 @@ declare namespace ts { typeParameters: TypeParameter[]; outerTypeParameters: TypeParameter[]; localTypeParameters: TypeParameter[]; - resolvedBaseConstructorType?: Type; - resolvedBaseTypes: ObjectType[]; } interface InterfaceTypeWithDeclaredMembers extends InterfaceType { declaredProperties: Symbol[]; @@ -1315,6 +1316,7 @@ declare namespace ts { noLib?: boolean; noResolve?: boolean; out?: string; + outFile?: string; outDir?: string; preserveConstEnums?: boolean; project?: string; @@ -1367,14 +1369,25 @@ declare namespace ts { fileNames: string[]; errors: Diagnostic[]; } - interface CompilerHost { + interface ModuleResolutionHost { + fileExists(fileName: string): boolean; + readFile(fileName: string): string; + } + interface ResolvedModule { + resolvedFileName: string; + failedLookupLocations: string[]; + } + type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule; + interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; + getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; writeFile: WriteFileCallback; getCurrentDirectory(): string; getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; + resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; } interface TextSpan { start: number; @@ -1448,8 +1461,11 @@ declare namespace ts { function couldStartTrivia(text: string, pos: number): boolean; function getLeadingCommentRanges(text: string, pos: number): CommentRange[]; function getTrailingCommentRanges(text: string, pos: number): CommentRange[]; + /** Optionally, get the shebang */ + function getShebang(text: string): string; function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean; function isIdentifierPart(ch: number, languageVersion: ScriptTarget): boolean; + function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, languageVariant?: LanguageVariant, text?: string, onError?: ErrorCallback, start?: number, length?: number): Scanner; } declare namespace ts { function getDefaultLibFileName(options: CompilerOptions): string; @@ -1489,13 +1505,14 @@ declare namespace ts { function updateSourceFile(sourceFile: SourceFile, newText: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; } declare namespace ts { - /** The version of the TypeScript compiler release */ const version: string; function findConfigFile(searchPath: string): string; + function resolveTripleslashReference(moduleName: string, containingFile: string): string; + function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile, cancellationToken?: CancellationToken): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; - function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; + function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program; } declare namespace ts { function parseCommandLine(commandLine: string[]): ParsedCommandLine; @@ -1559,6 +1576,7 @@ declare namespace ts { getConstructSignatures(): Signature[]; getStringIndexType(): Type; getNumberIndexType(): Type; + getBaseTypes(): ObjectType[]; } interface Signature { getDeclaration(): SignatureDeclaration; @@ -1600,6 +1618,7 @@ declare namespace ts { interface PreProcessedFileInfo { referencedFiles: FileReference[]; importedFiles: FileReference[]; + ambientExternalModules: string[]; isLibFile: boolean; } interface HostCancellationToken { @@ -1620,6 +1639,7 @@ declare namespace ts { trace?(s: string): void; error?(s: string): void; useCaseSensitiveFileNames?(): boolean; + resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; } interface LanguageService { cleanupSemanticCache(): void; @@ -1660,6 +1680,7 @@ declare namespace ts { getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[]; getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[]; getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[]; + getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion; getEmitOutput(fileName: string): EmitOutput; getProgram(): Program; getSourceFile(fileName: string): SourceFile; @@ -1696,6 +1717,11 @@ declare namespace ts { span: TextSpan; newText: string; } + interface TextInsertion { + newText: string; + /** The position in newText the caret should point to after the insertion. */ + caretOffset: number; + } interface RenameLocation { textSpan: TextSpan; fileName: string; @@ -1716,6 +1742,7 @@ declare namespace ts { const writtenReference: string; } interface HighlightSpan { + fileName?: string; textSpan: TextSpan; kind: string; } @@ -1743,6 +1770,7 @@ declare namespace ts { InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; [s: string]: boolean | number | string; @@ -1985,6 +2013,7 @@ declare namespace ts { * @param compilationSettings The compilation settings used to acquire the file */ releaseDocument(fileName: string, compilationSettings: CompilerOptions): void; + reportStats(): string; } module ScriptElementKind { const unknown: string; @@ -2071,10 +2100,24 @@ declare namespace ts { } function displayPartsToString(displayParts: SymbolDisplayPart[]): string; function getDefaultCompilerOptions(): CompilerOptions; + interface TranspileOptions { + compilerOptions?: CompilerOptions; + fileName?: string; + reportDiagnostics?: boolean; + moduleName?: string; + renamedDependencies?: Map; + } + interface TranspileOutput { + outputText: string; + diagnostics?: Diagnostic[]; + sourceMapText?: string; + } + function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput; function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string; function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile; let disableIncrementalParsing: boolean; function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile; + function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string; function createDocumentRegistry(useCaseSensitiveFileNames?: boolean): DocumentRegistry; function preProcessFile(sourceText: string, readImportFiles?: boolean): PreProcessedFileInfo; function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 6035d71fa2b64..9507f25db63c8 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -16,6 +16,7 @@ and limitations under the License. var ts; (function (ts) { // token > SyntaxKind.Identifer => token is a keyword + // Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync (function (SyntaxKind) { SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; @@ -23,324 +24,326 @@ var ts; SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + // We detect and preserve #! on the first line + SyntaxKind[SyntaxKind["ShebangTrivia"] = 6] = "ShebangTrivia"; // We detect and provide better error recovery when we encounter a git merge marker. This // allows us to edit files with git-conflict markers in them in a much more pleasant manner. - SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 6] = "ConflictMarkerTrivia"; + SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia"; // Literals - SyntaxKind[SyntaxKind["NumericLiteral"] = 7] = "NumericLiteral"; - SyntaxKind[SyntaxKind["StringLiteral"] = 8] = "StringLiteral"; - SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 9] = "RegularExpressionLiteral"; - SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 10] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 8] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 9] = "StringLiteral"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 10] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 11] = "NoSubstitutionTemplateLiteral"; // Pseudo-literals - SyntaxKind[SyntaxKind["TemplateHead"] = 11] = "TemplateHead"; - SyntaxKind[SyntaxKind["TemplateMiddle"] = 12] = "TemplateMiddle"; - SyntaxKind[SyntaxKind["TemplateTail"] = 13] = "TemplateTail"; + SyntaxKind[SyntaxKind["TemplateHead"] = 12] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 13] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 14] = "TemplateTail"; // Punctuation - 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["LessThanSlashToken"] = 25] = "LessThanSlashToken"; - SyntaxKind[SyntaxKind["GreaterThanToken"] = 26] = "GreaterThanToken"; - SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 27] = "LessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 28] = "GreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 29] = "EqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 30] = "ExclamationEqualsToken"; - SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 31] = "EqualsEqualsEqualsToken"; - SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 32] = "ExclamationEqualsEqualsToken"; - SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 33] = "EqualsGreaterThanToken"; - SyntaxKind[SyntaxKind["PlusToken"] = 34] = "PlusToken"; - SyntaxKind[SyntaxKind["MinusToken"] = 35] = "MinusToken"; - SyntaxKind[SyntaxKind["AsteriskToken"] = 36] = "AsteriskToken"; - SyntaxKind[SyntaxKind["SlashToken"] = 37] = "SlashToken"; - SyntaxKind[SyntaxKind["PercentToken"] = 38] = "PercentToken"; - SyntaxKind[SyntaxKind["PlusPlusToken"] = 39] = "PlusPlusToken"; - SyntaxKind[SyntaxKind["MinusMinusToken"] = 40] = "MinusMinusToken"; - SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 41] = "LessThanLessThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 42] = "GreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 43] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind[SyntaxKind["AmpersandToken"] = 44] = "AmpersandToken"; - SyntaxKind[SyntaxKind["BarToken"] = 45] = "BarToken"; - SyntaxKind[SyntaxKind["CaretToken"] = 46] = "CaretToken"; - SyntaxKind[SyntaxKind["ExclamationToken"] = 47] = "ExclamationToken"; - SyntaxKind[SyntaxKind["TildeToken"] = 48] = "TildeToken"; - SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 49] = "AmpersandAmpersandToken"; - SyntaxKind[SyntaxKind["BarBarToken"] = 50] = "BarBarToken"; - SyntaxKind[SyntaxKind["QuestionToken"] = 51] = "QuestionToken"; - SyntaxKind[SyntaxKind["ColonToken"] = 52] = "ColonToken"; - SyntaxKind[SyntaxKind["AtToken"] = 53] = "AtToken"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 15] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 16] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 17] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 18] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 19] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 20] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 21] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 22] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 23] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 24] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 25] = "LessThanToken"; + SyntaxKind[SyntaxKind["LessThanSlashToken"] = 26] = "LessThanSlashToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 27] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 28] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 29] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 30] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 31] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 32] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 33] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 34] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 35] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 36] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 37] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 38] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 39] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 40] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 41] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 42] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 43] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 44] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 45] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 46] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 47] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 48] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 49] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 50] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 51] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 52] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 53] = "ColonToken"; + SyntaxKind[SyntaxKind["AtToken"] = 54] = "AtToken"; // Assignments - SyntaxKind[SyntaxKind["EqualsToken"] = 54] = "EqualsToken"; - SyntaxKind[SyntaxKind["PlusEqualsToken"] = 55] = "PlusEqualsToken"; - SyntaxKind[SyntaxKind["MinusEqualsToken"] = 56] = "MinusEqualsToken"; - SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 57] = "AsteriskEqualsToken"; - SyntaxKind[SyntaxKind["SlashEqualsToken"] = 58] = "SlashEqualsToken"; - SyntaxKind[SyntaxKind["PercentEqualsToken"] = 59] = "PercentEqualsToken"; - SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 60] = "LessThanLessThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 61] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 62] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 63] = "AmpersandEqualsToken"; - SyntaxKind[SyntaxKind["BarEqualsToken"] = 64] = "BarEqualsToken"; - SyntaxKind[SyntaxKind["CaretEqualsToken"] = 65] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 55] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 56] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 57] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 58] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 59] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 60] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 61] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 62] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 63] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 64] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 65] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 66] = "CaretEqualsToken"; // Identifiers - SyntaxKind[SyntaxKind["Identifier"] = 66] = "Identifier"; + SyntaxKind[SyntaxKind["Identifier"] = 67] = "Identifier"; // Reserved words - SyntaxKind[SyntaxKind["BreakKeyword"] = 67] = "BreakKeyword"; - SyntaxKind[SyntaxKind["CaseKeyword"] = 68] = "CaseKeyword"; - SyntaxKind[SyntaxKind["CatchKeyword"] = 69] = "CatchKeyword"; - SyntaxKind[SyntaxKind["ClassKeyword"] = 70] = "ClassKeyword"; - SyntaxKind[SyntaxKind["ConstKeyword"] = 71] = "ConstKeyword"; - SyntaxKind[SyntaxKind["ContinueKeyword"] = 72] = "ContinueKeyword"; - SyntaxKind[SyntaxKind["DebuggerKeyword"] = 73] = "DebuggerKeyword"; - SyntaxKind[SyntaxKind["DefaultKeyword"] = 74] = "DefaultKeyword"; - SyntaxKind[SyntaxKind["DeleteKeyword"] = 75] = "DeleteKeyword"; - SyntaxKind[SyntaxKind["DoKeyword"] = 76] = "DoKeyword"; - SyntaxKind[SyntaxKind["ElseKeyword"] = 77] = "ElseKeyword"; - SyntaxKind[SyntaxKind["EnumKeyword"] = 78] = "EnumKeyword"; - SyntaxKind[SyntaxKind["ExportKeyword"] = 79] = "ExportKeyword"; - SyntaxKind[SyntaxKind["ExtendsKeyword"] = 80] = "ExtendsKeyword"; - SyntaxKind[SyntaxKind["FalseKeyword"] = 81] = "FalseKeyword"; - SyntaxKind[SyntaxKind["FinallyKeyword"] = 82] = "FinallyKeyword"; - SyntaxKind[SyntaxKind["ForKeyword"] = 83] = "ForKeyword"; - SyntaxKind[SyntaxKind["FunctionKeyword"] = 84] = "FunctionKeyword"; - SyntaxKind[SyntaxKind["IfKeyword"] = 85] = "IfKeyword"; - SyntaxKind[SyntaxKind["ImportKeyword"] = 86] = "ImportKeyword"; - SyntaxKind[SyntaxKind["InKeyword"] = 87] = "InKeyword"; - SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 88] = "InstanceOfKeyword"; - SyntaxKind[SyntaxKind["NewKeyword"] = 89] = "NewKeyword"; - SyntaxKind[SyntaxKind["NullKeyword"] = 90] = "NullKeyword"; - SyntaxKind[SyntaxKind["ReturnKeyword"] = 91] = "ReturnKeyword"; - SyntaxKind[SyntaxKind["SuperKeyword"] = 92] = "SuperKeyword"; - SyntaxKind[SyntaxKind["SwitchKeyword"] = 93] = "SwitchKeyword"; - SyntaxKind[SyntaxKind["ThisKeyword"] = 94] = "ThisKeyword"; - SyntaxKind[SyntaxKind["ThrowKeyword"] = 95] = "ThrowKeyword"; - SyntaxKind[SyntaxKind["TrueKeyword"] = 96] = "TrueKeyword"; - SyntaxKind[SyntaxKind["TryKeyword"] = 97] = "TryKeyword"; - SyntaxKind[SyntaxKind["TypeOfKeyword"] = 98] = "TypeOfKeyword"; - SyntaxKind[SyntaxKind["VarKeyword"] = 99] = "VarKeyword"; - SyntaxKind[SyntaxKind["VoidKeyword"] = 100] = "VoidKeyword"; - SyntaxKind[SyntaxKind["WhileKeyword"] = 101] = "WhileKeyword"; - SyntaxKind[SyntaxKind["WithKeyword"] = 102] = "WithKeyword"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 68] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 69] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 70] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 71] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 72] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 73] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 74] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 75] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 76] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 77] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 78] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 79] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 80] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 81] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 82] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 83] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 84] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 85] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 86] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 87] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 88] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 89] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 90] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 91] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 92] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 93] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 94] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 95] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 96] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 97] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 98] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 99] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 100] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 101] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 102] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 103] = "WithKeyword"; // Strict mode reserved words - SyntaxKind[SyntaxKind["ImplementsKeyword"] = 103] = "ImplementsKeyword"; - SyntaxKind[SyntaxKind["InterfaceKeyword"] = 104] = "InterfaceKeyword"; - SyntaxKind[SyntaxKind["LetKeyword"] = 105] = "LetKeyword"; - SyntaxKind[SyntaxKind["PackageKeyword"] = 106] = "PackageKeyword"; - SyntaxKind[SyntaxKind["PrivateKeyword"] = 107] = "PrivateKeyword"; - SyntaxKind[SyntaxKind["ProtectedKeyword"] = 108] = "ProtectedKeyword"; - SyntaxKind[SyntaxKind["PublicKeyword"] = 109] = "PublicKeyword"; - SyntaxKind[SyntaxKind["StaticKeyword"] = 110] = "StaticKeyword"; - SyntaxKind[SyntaxKind["YieldKeyword"] = 111] = "YieldKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 104] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 105] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 106] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 107] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 108] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 109] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 110] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 111] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 112] = "YieldKeyword"; // Contextual keywords - SyntaxKind[SyntaxKind["AbstractKeyword"] = 112] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 113] = "AsKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 114] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 115] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 116] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 117] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 118] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 119] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 120] = "GetKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 121] = "IsKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 122] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 123] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 124] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 125] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 126] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 127] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 128] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 129] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 130] = "FromKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 131] = "OfKeyword"; + SyntaxKind[SyntaxKind["AbstractKeyword"] = 113] = "AbstractKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 114] = "AsKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 115] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 116] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 117] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 118] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 119] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 120] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 121] = "GetKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 122] = "IsKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 123] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 124] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 125] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 126] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 127] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 128] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 129] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 130] = "TypeKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 131] = "FromKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 132] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 132] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 133] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 133] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 134] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 134] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 135] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 136] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 135] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 136] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 137] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 137] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 138] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 139] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 140] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 141] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 142] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 143] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 144] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 145] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 146] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 138] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 139] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 140] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 141] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 142] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 143] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 144] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 145] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 146] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 147] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 147] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 148] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 149] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 150] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 151] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 152] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 153] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 154] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 155] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 156] = "IntersectionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 157] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 148] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 149] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 150] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 151] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 152] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 153] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 154] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 155] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 156] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 157] = "IntersectionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 158] = "ParenthesizedType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 158] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 159] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 160] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 159] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 160] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 161] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 161] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 162] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 163] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 164] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 165] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 166] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 167] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 168] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 169] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 170] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 171] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 172] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 173] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 174] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 175] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 176] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 177] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 178] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 179] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 180] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 181] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 182] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 183] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 184] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 185] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 186] = "AsExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 162] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 163] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 164] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 165] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 166] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 167] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 168] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 169] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 170] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 171] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 172] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 173] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 174] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 175] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 176] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 177] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 178] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 179] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 180] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 181] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 182] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 183] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 184] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 185] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 186] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 187] = "AsExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 187] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 188] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 188] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 189] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 189] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 190] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 191] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 192] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 193] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 194] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 195] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 196] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 197] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 198] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 199] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 200] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 201] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 202] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 203] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 204] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 205] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 206] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 207] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 208] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 209] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 210] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 211] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 212] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 213] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 214] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 215] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 216] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 217] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 218] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 219] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 220] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 221] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 222] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 223] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 224] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 225] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 226] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 227] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 228] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 190] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 191] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 192] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 193] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 194] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 195] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 196] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 197] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 198] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 199] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 200] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 201] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 202] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 203] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 204] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 205] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 206] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 207] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 208] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 209] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 210] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 211] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 212] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 213] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 214] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 215] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 216] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 217] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 218] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 219] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 220] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 221] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 222] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 223] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 224] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 225] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 226] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 227] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 228] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 229] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 229] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 230] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 230] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 231] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 232] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxText"] = 233] = "JsxText"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 234] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 235] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 236] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 237] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 231] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 232] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 233] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxText"] = 234] = "JsxText"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 235] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 236] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 237] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 238] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 238] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 239] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 240] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 241] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 239] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 240] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 241] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 242] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 242] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 243] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 243] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 244] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 244] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 245] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 245] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 246] = "SourceFile"; // JSDoc nodes. - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 246] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 247] = "JSDocTypeExpression"; // The * type. - SyntaxKind[SyntaxKind["JSDocAllType"] = 247] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 248] = "JSDocAllType"; // The ? type. - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 248] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 249] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 250] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 251] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 252] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 253] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 254] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 255] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 256] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 257] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 258] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 259] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 260] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 261] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 262] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 263] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 264] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 265] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 266] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 267] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 249] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocArrayType"] = 250] = "JSDocArrayType"; + SyntaxKind[SyntaxKind["JSDocUnionType"] = 251] = "JSDocUnionType"; + SyntaxKind[SyntaxKind["JSDocTupleType"] = 252] = "JSDocTupleType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 253] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 254] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocRecordType"] = 255] = "JSDocRecordType"; + SyntaxKind[SyntaxKind["JSDocRecordMember"] = 256] = "JSDocRecordMember"; + SyntaxKind[SyntaxKind["JSDocTypeReference"] = 257] = "JSDocTypeReference"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 258] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 259] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 260] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocConstructorType"] = 261] = "JSDocConstructorType"; + SyntaxKind[SyntaxKind["JSDocThisType"] = 262] = "JSDocThisType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 263] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 264] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 265] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 266] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 267] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 268] = "JSDocTemplateTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 268] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 269] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 269] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 270] = "Count"; // Markers - SyntaxKind[SyntaxKind["FirstAssignment"] = 54] = "FirstAssignment"; - SyntaxKind[SyntaxKind["LastAssignment"] = 65] = "LastAssignment"; - SyntaxKind[SyntaxKind["FirstReservedWord"] = 67] = "FirstReservedWord"; - SyntaxKind[SyntaxKind["LastReservedWord"] = 102] = "LastReservedWord"; - SyntaxKind[SyntaxKind["FirstKeyword"] = 67] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 131] = "LastKeyword"; - SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 103] = "FirstFutureReservedWord"; - SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 111] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 148] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 157] = "LastTypeNode"; - SyntaxKind[SyntaxKind["FirstPunctuation"] = 14] = "FirstPunctuation"; - SyntaxKind[SyntaxKind["LastPunctuation"] = 65] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 55] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 66] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 68] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 103] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 68] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 132] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 104] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 112] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 149] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 158] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstPunctuation"] = 15] = "FirstPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 66] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 131] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 132] = "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"] = 65] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 132] = "FirstNode"; + SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = 11] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = 11] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = 14] = "LastTemplateToken"; + SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 25] = "FirstBinaryOperator"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 66] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 133] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -602,21 +605,27 @@ var ts; TypeFlags[TypeFlags["FromSignature"] = 262144] = "FromSignature"; TypeFlags[TypeFlags["ObjectLiteral"] = 524288] = "ObjectLiteral"; /* @internal */ - TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 1048576] = "ContainsUndefinedOrNull"; + TypeFlags[TypeFlags["FreshObjectLiteral"] = 1048576] = "FreshObjectLiteral"; /* @internal */ - TypeFlags[TypeFlags["ContainsObjectLiteral"] = 2097152] = "ContainsObjectLiteral"; - TypeFlags[TypeFlags["ESSymbol"] = 4194304] = "ESSymbol"; + TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 2097152] = "ContainsUndefinedOrNull"; /* @internal */ - TypeFlags[TypeFlags["Intrinsic"] = 4194431] = "Intrinsic"; + TypeFlags[TypeFlags["ContainsObjectLiteral"] = 4194304] = "ContainsObjectLiteral"; /* @internal */ - TypeFlags[TypeFlags["Primitive"] = 4194814] = "Primitive"; + TypeFlags[TypeFlags["ContainsAnyFunctionType"] = 8388608] = "ContainsAnyFunctionType"; + TypeFlags[TypeFlags["ESSymbol"] = 16777216] = "ESSymbol"; + /* @internal */ + TypeFlags[TypeFlags["Intrinsic"] = 16777343] = "Intrinsic"; + /* @internal */ + TypeFlags[TypeFlags["Primitive"] = 16777726] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = 132] = "NumberLike"; TypeFlags[TypeFlags["ObjectType"] = 80896] = "ObjectType"; TypeFlags[TypeFlags["UnionOrIntersection"] = 49152] = "UnionOrIntersection"; TypeFlags[TypeFlags["StructuredType"] = 130048] = "StructuredType"; /* @internal */ - TypeFlags[TypeFlags["RequiresWidening"] = 3145728] = "RequiresWidening"; + TypeFlags[TypeFlags["RequiresWidening"] = 6291456] = "RequiresWidening"; + /* @internal */ + TypeFlags[TypeFlags["PropagatingFlags"] = 14680064] = "PropagatingFlags"; })(ts.TypeFlags || (ts.TypeFlags = {})); var TypeFlags = ts.TypeFlags; (function (SignatureKind) { @@ -822,6 +831,7 @@ var ts; set: set, contains: contains, remove: remove, + clear: clear, forEachValue: forEachValueInMap }; function set(fileName, value) { @@ -843,6 +853,9 @@ var ts; function normalizeKey(key) { return getCanonicalFileName(normalizeSlashes(key)); } + function clear() { + files = {}; + } } ts.createFileMap = createFileMap; (function (Comparison) { @@ -990,6 +1003,13 @@ var ts; return array[array.length - 1]; } ts.lastOrUndefined = lastOrUndefined; + /** + * Performs a binary search, finding the index at which 'value' occurs in 'array'. + * If no such index is found, returns the 2's-complement of first index at which + * number[index] exceeds number. + * @param array A sorted array whose first element must be no larger than number + * @param number The value to be searched for in the array. + */ function binarySearch(array, value) { var low = 0; var high = array.length - 1; @@ -1293,7 +1313,7 @@ var ts; if (path.lastIndexOf("file:///", 0) === 0) { return "file:///".length; } - var idx = path.indexOf('://'); + var idx = path.indexOf("://"); if (idx !== -1) { return idx + "://".length; } @@ -1470,7 +1490,7 @@ var ts; /** * List of supported extensions in order of file resolution precedence. */ - ts.supportedExtensions = [".tsx", ".ts", ".d.ts"]; + ts.supportedExtensions = [".ts", ".tsx", ".d.ts"]; var extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; function removeFileExtension(path) { for (var _i = 0; _i < extensionsToRemove.length; _i++) { @@ -1699,7 +1719,7 @@ var ts; function getNodeSystem() { var _fs = require("fs"); var _path = require("path"); - var _os = require('os'); + var _os = require("os"); var platform = _os.platform(); // win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; @@ -1734,7 +1754,7 @@ var ts; function writeFile(fileName, data, writeByteOrderMark) { // If a BOM is required, emit one if (writeByteOrderMark) { - data = '\uFEFF' + data; + data = "\uFEFF" + data; } _fs.writeFileSync(fileName, data, "utf8"); } @@ -1775,7 +1795,7 @@ var ts; newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, write: function (s) { - var buffer = new Buffer(s, 'utf8'); + var buffer = new Buffer(s, "utf8"); var offset = 0; var toWrite = buffer.length; var written = 0; @@ -1799,7 +1819,6 @@ var ts; } callback(fileName); } - ; }, resolvePath: function (path) { return _path.resolve(path); @@ -1836,7 +1855,9 @@ var ts; if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { return getWScriptSystem(); } - else if (typeof module !== "undefined" && module.exports) { + else if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof require !== "undefined") { + // process and process.nextTick checks if current environment is node-like + // process.browser check excludes webpack and browserify return getNodeSystem(); } else { @@ -2101,6 +2122,7 @@ var ts; Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, No_best_common_type_exists_among_return_expressions: { code: 2354, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, @@ -2140,7 +2162,7 @@ var ts; Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: "Multiple constructor implementations are not allowed." }, Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: "Duplicate function implementation." }, Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, @@ -2271,6 +2293,8 @@ var ts; JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX element class does not support attributes because it does not have a '{0}' property" }, The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The global type 'JSX.{0}' may not have more than one property" }, Cannot_emit_namespaced_JSX_elements_in_React: { code: 2650, category: ts.DiagnosticCategory.Error, key: "Cannot emit namespaced JSX elements in React" }, + A_member_initializer_in_a_const_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_const_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A member initializer in a 'const' enum declaration cannot reference members declared after it, including members defined in other 'const' enums." }, + Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.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: ts.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: ts.DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -2350,20 +2374,11 @@ var ts; Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: ts.DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: ts.DiagnosticCategory.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: ts.DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, - Option_sourceMap_cannot_be_specified_with_option_isolatedModules: { code: 5043, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'isolatedModules'." }, - Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: ts.DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." }, - Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." }, - Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, - Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, - Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, - Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, + Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, + Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -2414,7 +2429,6 @@ var ts; Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: ts.DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: ts.DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, - Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: ts.DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, @@ -2459,7 +2473,8 @@ var ts; JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX elements cannot have multiple attributes with the same name." }, Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected corresponding JSX closing tag for '{0}'." }, JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX attribute expected." }, - Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." } + Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot use JSX unless the '--jsx' flag is provided." }, + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A constructor cannot contain a 'super' call when its class extends 'null'" } }; })(ts || (ts = {})); /// @@ -2467,123 +2482,123 @@ var ts; var ts; (function (ts) { var textToToken = { - "abstract": 112 /* AbstractKeyword */, - "any": 114 /* AnyKeyword */, - "as": 113 /* AsKeyword */, - "boolean": 117 /* BooleanKeyword */, - "break": 67 /* BreakKeyword */, - "case": 68 /* CaseKeyword */, - "catch": 69 /* CatchKeyword */, - "class": 70 /* ClassKeyword */, - "continue": 72 /* ContinueKeyword */, - "const": 71 /* ConstKeyword */, - "constructor": 118 /* ConstructorKeyword */, - "debugger": 73 /* DebuggerKeyword */, - "declare": 119 /* DeclareKeyword */, - "default": 74 /* DefaultKeyword */, - "delete": 75 /* DeleteKeyword */, - "do": 76 /* DoKeyword */, - "else": 77 /* ElseKeyword */, - "enum": 78 /* EnumKeyword */, - "export": 79 /* ExportKeyword */, - "extends": 80 /* ExtendsKeyword */, - "false": 81 /* FalseKeyword */, - "finally": 82 /* FinallyKeyword */, - "for": 83 /* ForKeyword */, - "from": 130 /* FromKeyword */, - "function": 84 /* FunctionKeyword */, - "get": 120 /* GetKeyword */, - "if": 85 /* IfKeyword */, - "implements": 103 /* ImplementsKeyword */, - "import": 86 /* ImportKeyword */, - "in": 87 /* InKeyword */, - "instanceof": 88 /* InstanceOfKeyword */, - "interface": 104 /* InterfaceKeyword */, - "is": 121 /* IsKeyword */, - "let": 105 /* LetKeyword */, - "module": 122 /* ModuleKeyword */, - "namespace": 123 /* NamespaceKeyword */, - "new": 89 /* NewKeyword */, - "null": 90 /* NullKeyword */, - "number": 125 /* NumberKeyword */, - "package": 106 /* PackageKeyword */, - "private": 107 /* PrivateKeyword */, - "protected": 108 /* ProtectedKeyword */, - "public": 109 /* PublicKeyword */, - "require": 124 /* RequireKeyword */, - "return": 91 /* ReturnKeyword */, - "set": 126 /* SetKeyword */, - "static": 110 /* StaticKeyword */, - "string": 127 /* StringKeyword */, - "super": 92 /* SuperKeyword */, - "switch": 93 /* SwitchKeyword */, - "symbol": 128 /* SymbolKeyword */, - "this": 94 /* ThisKeyword */, - "throw": 95 /* ThrowKeyword */, - "true": 96 /* TrueKeyword */, - "try": 97 /* TryKeyword */, - "type": 129 /* TypeKeyword */, - "typeof": 98 /* TypeOfKeyword */, - "var": 99 /* VarKeyword */, - "void": 100 /* VoidKeyword */, - "while": 101 /* WhileKeyword */, - "with": 102 /* WithKeyword */, - "yield": 111 /* YieldKeyword */, - "async": 115 /* AsyncKeyword */, - "await": 116 /* AwaitKeyword */, - "of": 131 /* OfKeyword */, - "{": 14 /* OpenBraceToken */, - "}": 15 /* CloseBraceToken */, - "(": 16 /* OpenParenToken */, - ")": 17 /* CloseParenToken */, - "[": 18 /* OpenBracketToken */, - "]": 19 /* CloseBracketToken */, - ".": 20 /* DotToken */, - "...": 21 /* DotDotDotToken */, - ";": 22 /* SemicolonToken */, - ",": 23 /* CommaToken */, - "<": 24 /* LessThanToken */, - ">": 26 /* GreaterThanToken */, - "<=": 27 /* LessThanEqualsToken */, - ">=": 28 /* GreaterThanEqualsToken */, - "==": 29 /* EqualsEqualsToken */, - "!=": 30 /* ExclamationEqualsToken */, - "===": 31 /* EqualsEqualsEqualsToken */, - "!==": 32 /* ExclamationEqualsEqualsToken */, - "=>": 33 /* EqualsGreaterThanToken */, - "+": 34 /* PlusToken */, - "-": 35 /* MinusToken */, - "*": 36 /* AsteriskToken */, - "/": 37 /* SlashToken */, - "%": 38 /* PercentToken */, - "++": 39 /* PlusPlusToken */, - "--": 40 /* MinusMinusToken */, - "<<": 41 /* LessThanLessThanToken */, - ">": 42 /* GreaterThanGreaterThanToken */, - ">>>": 43 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 44 /* AmpersandToken */, - "|": 45 /* BarToken */, - "^": 46 /* CaretToken */, - "!": 47 /* ExclamationToken */, - "~": 48 /* TildeToken */, - "&&": 49 /* AmpersandAmpersandToken */, - "||": 50 /* BarBarToken */, - "?": 51 /* QuestionToken */, - ":": 52 /* ColonToken */, - "=": 54 /* EqualsToken */, - "+=": 55 /* PlusEqualsToken */, - "-=": 56 /* MinusEqualsToken */, - "*=": 57 /* AsteriskEqualsToken */, - "/=": 58 /* SlashEqualsToken */, - "%=": 59 /* PercentEqualsToken */, - "<<=": 60 /* LessThanLessThanEqualsToken */, - ">>=": 61 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 63 /* AmpersandEqualsToken */, - "|=": 64 /* BarEqualsToken */, - "^=": 65 /* CaretEqualsToken */, - "@": 53 /* AtToken */ + "abstract": 113 /* AbstractKeyword */, + "any": 115 /* AnyKeyword */, + "as": 114 /* AsKeyword */, + "boolean": 118 /* BooleanKeyword */, + "break": 68 /* BreakKeyword */, + "case": 69 /* CaseKeyword */, + "catch": 70 /* CatchKeyword */, + "class": 71 /* ClassKeyword */, + "continue": 73 /* ContinueKeyword */, + "const": 72 /* ConstKeyword */, + "constructor": 119 /* ConstructorKeyword */, + "debugger": 74 /* DebuggerKeyword */, + "declare": 120 /* DeclareKeyword */, + "default": 75 /* DefaultKeyword */, + "delete": 76 /* DeleteKeyword */, + "do": 77 /* DoKeyword */, + "else": 78 /* ElseKeyword */, + "enum": 79 /* EnumKeyword */, + "export": 80 /* ExportKeyword */, + "extends": 81 /* ExtendsKeyword */, + "false": 82 /* FalseKeyword */, + "finally": 83 /* FinallyKeyword */, + "for": 84 /* ForKeyword */, + "from": 131 /* FromKeyword */, + "function": 85 /* FunctionKeyword */, + "get": 121 /* GetKeyword */, + "if": 86 /* IfKeyword */, + "implements": 104 /* ImplementsKeyword */, + "import": 87 /* ImportKeyword */, + "in": 88 /* InKeyword */, + "instanceof": 89 /* InstanceOfKeyword */, + "interface": 105 /* InterfaceKeyword */, + "is": 122 /* IsKeyword */, + "let": 106 /* LetKeyword */, + "module": 123 /* ModuleKeyword */, + "namespace": 124 /* NamespaceKeyword */, + "new": 90 /* NewKeyword */, + "null": 91 /* NullKeyword */, + "number": 126 /* NumberKeyword */, + "package": 107 /* PackageKeyword */, + "private": 108 /* PrivateKeyword */, + "protected": 109 /* ProtectedKeyword */, + "public": 110 /* PublicKeyword */, + "require": 125 /* RequireKeyword */, + "return": 92 /* ReturnKeyword */, + "set": 127 /* SetKeyword */, + "static": 111 /* StaticKeyword */, + "string": 128 /* StringKeyword */, + "super": 93 /* SuperKeyword */, + "switch": 94 /* SwitchKeyword */, + "symbol": 129 /* SymbolKeyword */, + "this": 95 /* ThisKeyword */, + "throw": 96 /* ThrowKeyword */, + "true": 97 /* TrueKeyword */, + "try": 98 /* TryKeyword */, + "type": 130 /* TypeKeyword */, + "typeof": 99 /* TypeOfKeyword */, + "var": 100 /* VarKeyword */, + "void": 101 /* VoidKeyword */, + "while": 102 /* WhileKeyword */, + "with": 103 /* WithKeyword */, + "yield": 112 /* YieldKeyword */, + "async": 116 /* AsyncKeyword */, + "await": 117 /* AwaitKeyword */, + "of": 132 /* OfKeyword */, + "{": 15 /* OpenBraceToken */, + "}": 16 /* CloseBraceToken */, + "(": 17 /* OpenParenToken */, + ")": 18 /* CloseParenToken */, + "[": 19 /* OpenBracketToken */, + "]": 20 /* CloseBracketToken */, + ".": 21 /* DotToken */, + "...": 22 /* DotDotDotToken */, + ";": 23 /* SemicolonToken */, + ",": 24 /* CommaToken */, + "<": 25 /* LessThanToken */, + ">": 27 /* GreaterThanToken */, + "<=": 28 /* LessThanEqualsToken */, + ">=": 29 /* GreaterThanEqualsToken */, + "==": 30 /* EqualsEqualsToken */, + "!=": 31 /* ExclamationEqualsToken */, + "===": 32 /* EqualsEqualsEqualsToken */, + "!==": 33 /* ExclamationEqualsEqualsToken */, + "=>": 34 /* EqualsGreaterThanToken */, + "+": 35 /* PlusToken */, + "-": 36 /* MinusToken */, + "*": 37 /* AsteriskToken */, + "/": 38 /* SlashToken */, + "%": 39 /* PercentToken */, + "++": 40 /* PlusPlusToken */, + "--": 41 /* MinusMinusToken */, + "<<": 42 /* LessThanLessThanToken */, + ">": 43 /* GreaterThanGreaterThanToken */, + ">>>": 44 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 45 /* AmpersandToken */, + "|": 46 /* BarToken */, + "^": 47 /* CaretToken */, + "!": 48 /* ExclamationToken */, + "~": 49 /* TildeToken */, + "&&": 50 /* AmpersandAmpersandToken */, + "||": 51 /* BarBarToken */, + "?": 52 /* QuestionToken */, + ":": 53 /* ColonToken */, + "=": 55 /* EqualsToken */, + "+=": 56 /* PlusEqualsToken */, + "-=": 57 /* MinusEqualsToken */, + "*=": 58 /* AsteriskEqualsToken */, + "/=": 59 /* SlashEqualsToken */, + "%=": 60 /* PercentEqualsToken */, + "<<=": 61 /* LessThanLessThanEqualsToken */, + ">>=": 62 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 64 /* AmpersandEqualsToken */, + "|=": 65 /* BarEqualsToken */, + "^=": 66 /* CaretEqualsToken */, + "@": 54 /* AtToken */ }; /* As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers @@ -2730,14 +2745,21 @@ var ts; } ts.getLineStarts = getLineStarts; /* @internal */ + /** + * We assume the first line starts at position 0 and 'position' is non-negative. + */ function computeLineAndCharacterOfPosition(lineStarts, position) { var lineNumber = ts.binarySearch(lineStarts, position); if (lineNumber < 0) { // If the actual position was not found, - // the binary search returns the negative value of the next line start + // the binary search returns the 2's-complement 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 + // then the search will return -2. + // + // We want the index of the previous line start, so we subtract 1. + // Review 2's-complement if this is confusing. lineNumber = ~lineNumber - 1; + ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); } return { line: lineNumber, @@ -2809,6 +2831,9 @@ var ts; case 62 /* greaterThan */: // Starts of conflict marker trivia return true; + case 35 /* hash */: + // Only if its the beginning can we have #! trivia + return pos === 0; default: return ch > 127 /* maxAsciiCharacter */; } @@ -2867,6 +2892,12 @@ var ts; continue; } break; + case 35 /* hash */: + if (pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + continue; + } + break; default: if (ch > 127 /* maxAsciiCharacter */ && (isWhiteSpace(ch) || isLineBreak(ch))) { pos++; @@ -2923,13 +2954,28 @@ var ts; } return pos; } - // Extract comments from the given source text starting at the given position. If trailing is - // false, whitespace is skipped until the first line break and comments between that location - // and the next token are returned.If trailing is true, comments occurring between the given - // position and the next line break are returned.The return value is an array containing a - // TextRange for each comment. Single-line comment ranges include the beginning '//' characters - // but not the ending line break. Multi - line comment ranges include the beginning '/* and - // ending '*/' characters.The return value is undefined if no comments were found. + var shebangTriviaRegex = /^#!.*/; + function isShebangTrivia(text, pos) { + // Shebangs check must only be done at the start of the file + ts.Debug.assert(pos === 0); + return shebangTriviaRegex.test(text); + } + function scanShebangTrivia(text, pos) { + var shebang = shebangTriviaRegex.exec(text)[0]; + pos = pos + shebang.length; + return pos; + } + /** + * Extract comments from text prefixing the token closest following `pos`. + * The return value is an array containing a TextRange for each comment. + * Single-line comment ranges include the beginning '//' characters but not the ending line break. + * Multi - line comment ranges include the beginning '/* and ending '/' characters. + * The return value is undefined if no comments were found. + * @param trailing + * If false, whitespace is skipped until the first line break and comments between that location + * and the next token are returned. + * If true, comments occurring between the given position and the next line break are returned. + */ function getCommentRanges(text, pos, trailing) { var result; var collecting = trailing || pos === 0; @@ -3004,13 +3050,20 @@ var ts; } } function getLeadingCommentRanges(text, pos) { - return getCommentRanges(text, pos, false); + return getCommentRanges(text, pos, /*trailing*/ false); } ts.getLeadingCommentRanges = getLeadingCommentRanges; function getTrailingCommentRanges(text, pos) { - return getCommentRanges(text, pos, true); + return getCommentRanges(text, pos, /*trailing*/ true); } ts.getTrailingCommentRanges = getTrailingCommentRanges; + /** Optionally, get the shebang */ + function getShebang(text) { + return shebangTriviaRegex.test(text) + ? shebangTriviaRegex.exec(text)[0] + : undefined; + } + ts.getShebang = getShebang; function isIdentifierStart(ch, languageVersion) { return ch >= 65 /* A */ && ch <= 90 /* Z */ || ch >= 97 /* a */ && ch <= 122 /* z */ || ch === 36 /* $ */ || ch === 95 /* _ */ || @@ -3023,7 +3076,6 @@ var ts; ch > 127 /* maxAsciiCharacter */ && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; - /* @internal */ // Creates a scanner over a (possibly unspecified) range of a piece of text. function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { if (languageVariant === void 0) { languageVariant = 0 /* Standard */; } @@ -3050,8 +3102,8 @@ var ts; getTokenValue: function () { return tokenValue; }, hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 66 /* Identifier */ || token > 102 /* LastReservedWord */; }, - isReservedWord: function () { return token >= 67 /* FirstReservedWord */ && token <= 102 /* LastReservedWord */; }, + isIdentifier: function () { return token === 67 /* Identifier */ || token > 103 /* LastReservedWord */; }, + isReservedWord: function () { return token >= 68 /* FirstReservedWord */ && token <= 103 /* LastReservedWord */; }, isUnterminated: function () { return tokenIsUnterminated; }, reScanGreaterToken: reScanGreaterToken, reScanSlashToken: reScanSlashToken, @@ -3121,14 +3173,14 @@ var ts; * returning -1 if the given number is unavailable. */ function scanExactNumberOfHexDigits(count) { - return scanHexDigits(count, false); + return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ false); } /** * Scans as many hexadecimal digits as are available in the text, * returning -1 if the given number of digits was unavailable. */ function scanMinimumNumberOfHexDigits(count) { - return scanHexDigits(count, true); + return scanHexDigits(/*minCount*/ count, /*scanAsManyAsPossible*/ true); } function scanHexDigits(minCount, scanAsManyAsPossible) { var digits = 0; @@ -3203,7 +3255,7 @@ var ts; contents += text.substring(start, pos); tokenIsUnterminated = true; error(ts.Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 10 /* NoSubstitutionTemplateLiteral */ : 13 /* TemplateTail */; + resultingToken = startedWithBacktick ? 11 /* NoSubstitutionTemplateLiteral */ : 14 /* TemplateTail */; break; } var currChar = text.charCodeAt(pos); @@ -3211,14 +3263,14 @@ var ts; if (currChar === 96 /* backtick */) { contents += text.substring(start, pos); pos++; - resultingToken = startedWithBacktick ? 10 /* NoSubstitutionTemplateLiteral */ : 13 /* TemplateTail */; + resultingToken = startedWithBacktick ? 11 /* NoSubstitutionTemplateLiteral */ : 14 /* TemplateTail */; break; } // '${' if (currChar === 36 /* $ */ && pos + 1 < end && text.charCodeAt(pos + 1) === 123 /* openBrace */) { contents += text.substring(start, pos); pos += 2; - resultingToken = startedWithBacktick ? 11 /* TemplateHead */ : 12 /* TemplateMiddle */; + resultingToken = startedWithBacktick ? 12 /* TemplateHead */ : 13 /* TemplateMiddle */; break; } // Escape character @@ -3280,10 +3332,10 @@ var ts; return scanExtendedUnicodeEscape(); } // '\uDDDD' - return scanHexadecimalEscape(4); + return scanHexadecimalEscape(/*numDigits*/ 4); case 120 /* x */: // '\xDD' - return scanHexadecimalEscape(2); + return scanHexadecimalEscape(/*numDigits*/ 2); // when encountering a LineContinuation (i.e. a backslash and a line terminator sequence), // the line terminator is interpreted to be "the empty code unit sequence". case 13 /* carriageReturn */: @@ -3395,7 +3447,7 @@ var ts; return token = textToToken[tokenValue]; } } - return token = 66 /* Identifier */; + return token = 67 /* Identifier */; } function scanBinaryOrOctalDigits(base) { ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); @@ -3430,6 +3482,16 @@ var ts; return token = 1 /* EndOfFileToken */; } var ch = text.charCodeAt(pos); + // Special handling for shebang + if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia) { + continue; + } + else { + return token = 6 /* ShebangTrivia */; + } + } switch (ch) { case 10 /* lineFeed */: case 13 /* carriageReturn */: @@ -3465,66 +3527,66 @@ var ts; case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 32 /* ExclamationEqualsEqualsToken */; + return pos += 3, token = 33 /* ExclamationEqualsEqualsToken */; } - return pos += 2, token = 30 /* ExclamationEqualsToken */; + return pos += 2, token = 31 /* ExclamationEqualsToken */; } - return pos++, token = 47 /* ExclamationToken */; + return pos++, token = 48 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); - return token = 8 /* StringLiteral */; + return token = 9 /* StringLiteral */; case 96 /* backtick */: return token = scanTemplateAndSetTokenValue(); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 59 /* PercentEqualsToken */; + return pos += 2, token = 60 /* PercentEqualsToken */; } - return pos++, token = 38 /* PercentToken */; + return pos++, token = 39 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { - return pos += 2, token = 49 /* AmpersandAmpersandToken */; + return pos += 2, token = 50 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 63 /* AmpersandEqualsToken */; + return pos += 2, token = 64 /* AmpersandEqualsToken */; } - return pos++, token = 44 /* AmpersandToken */; + return pos++, token = 45 /* AmpersandToken */; case 40 /* openParen */: - return pos++, token = 16 /* OpenParenToken */; + return pos++, token = 17 /* OpenParenToken */; case 41 /* closeParen */: - return pos++, token = 17 /* CloseParenToken */; + return pos++, token = 18 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 57 /* AsteriskEqualsToken */; + return pos += 2, token = 58 /* AsteriskEqualsToken */; } - return pos++, token = 36 /* AsteriskToken */; + return pos++, token = 37 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 39 /* PlusPlusToken */; + return pos += 2, token = 40 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 55 /* PlusEqualsToken */; + return pos += 2, token = 56 /* PlusEqualsToken */; } - return pos++, token = 34 /* PlusToken */; + return pos++, token = 35 /* PlusToken */; case 44 /* comma */: - return pos++, token = 23 /* CommaToken */; + return pos++, token = 24 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 40 /* MinusMinusToken */; + return pos += 2, token = 41 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 56 /* MinusEqualsToken */; + return pos += 2, token = 57 /* MinusEqualsToken */; } - return pos++, token = 35 /* MinusToken */; + return pos++, token = 36 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanNumber(); - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 21 /* DotDotDotToken */; + return pos += 3, token = 22 /* DotDotDotToken */; } - return pos++, token = 20 /* DotToken */; + return pos++, token = 21 /* DotToken */; case 47 /* slash */: // Single-line comment if (text.charCodeAt(pos + 1) === 47 /* slash */) { @@ -3570,9 +3632,9 @@ var ts; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 58 /* SlashEqualsToken */; + return pos += 2, token = 59 /* SlashEqualsToken */; } - return pos++, token = 37 /* SlashToken */; + return pos++, token = 38 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -3582,32 +3644,32 @@ var ts; value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 /* B */ || text.charCodeAt(pos + 1) === 98 /* b */)) { pos += 2; - var value = scanBinaryOrOctalDigits(2); + var value = scanBinaryOrOctalDigits(/* base */ 2); if (value < 0) { error(ts.Diagnostics.Binary_digit_expected); value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 /* O */ || text.charCodeAt(pos + 1) === 111 /* o */)) { pos += 2; - var value = scanBinaryOrOctalDigits(8); + var value = scanBinaryOrOctalDigits(/* base */ 8); if (value < 0) { error(ts.Diagnostics.Octal_digit_expected); value = 0; } tokenValue = "" + value; - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } // Try to parse as an octal if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { tokenValue = "" + scanOctalDigits(); - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; } // This fall-through is a deviation from the EcmaScript grammar. The grammar says that a leading zero // can only be followed by an octal digit, a dot, or the end of the number literal. However, we are being @@ -3622,11 +3684,11 @@ var ts; case 56 /* _8 */: case 57 /* _9 */: tokenValue = "" + scanNumber(); - return token = 7 /* NumericLiteral */; + return token = 8 /* NumericLiteral */; case 58 /* colon */: - return pos++, token = 52 /* ColonToken */; + return pos++, token = 53 /* ColonToken */; case 59 /* semicolon */: - return pos++, token = 22 /* SemicolonToken */; + return pos++, token = 23 /* SemicolonToken */; case 60 /* lessThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3634,22 +3696,22 @@ var ts; continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 7 /* ConflictMarkerTrivia */; } } if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 60 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 61 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 41 /* LessThanLessThanToken */; + return pos += 2, token = 42 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 27 /* LessThanEqualsToken */; + return pos += 2, token = 28 /* LessThanEqualsToken */; } if (text.charCodeAt(pos + 1) === 47 /* slash */ && languageVariant === 1 /* JSX */) { - return pos += 2, token = 25 /* LessThanSlashToken */; + return pos += 2, token = 26 /* LessThanSlashToken */; } - return pos++, token = 24 /* LessThanToken */; + return pos++, token = 25 /* LessThanToken */; case 61 /* equals */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3657,19 +3719,19 @@ var ts; continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 7 /* ConflictMarkerTrivia */; } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 31 /* EqualsEqualsEqualsToken */; + return pos += 3, token = 32 /* EqualsEqualsEqualsToken */; } - return pos += 2, token = 29 /* EqualsEqualsToken */; + return pos += 2, token = 30 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 33 /* EqualsGreaterThanToken */; + return pos += 2, token = 34 /* EqualsGreaterThanToken */; } - return pos++, token = 54 /* EqualsToken */; + return pos++, token = 55 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -3677,37 +3739,37 @@ var ts; continue; } else { - return token = 6 /* ConflictMarkerTrivia */; + return token = 7 /* ConflictMarkerTrivia */; } } - return pos++, token = 26 /* GreaterThanToken */; + return pos++, token = 27 /* GreaterThanToken */; case 63 /* question */: - return pos++, token = 51 /* QuestionToken */; + return pos++, token = 52 /* QuestionToken */; case 91 /* openBracket */: - return pos++, token = 18 /* OpenBracketToken */; + return pos++, token = 19 /* OpenBracketToken */; case 93 /* closeBracket */: - return pos++, token = 19 /* CloseBracketToken */; + return pos++, token = 20 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 65 /* CaretEqualsToken */; + return pos += 2, token = 66 /* CaretEqualsToken */; } - return pos++, token = 46 /* CaretToken */; + return pos++, token = 47 /* CaretToken */; case 123 /* openBrace */: - return pos++, token = 14 /* OpenBraceToken */; + return pos++, token = 15 /* OpenBraceToken */; case 124 /* bar */: if (text.charCodeAt(pos + 1) === 124 /* bar */) { - return pos += 2, token = 50 /* BarBarToken */; + return pos += 2, token = 51 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 64 /* BarEqualsToken */; + return pos += 2, token = 65 /* BarEqualsToken */; } - return pos++, token = 45 /* BarToken */; + return pos++, token = 46 /* BarToken */; case 125 /* closeBrace */: - return pos++, token = 15 /* CloseBraceToken */; + return pos++, token = 16 /* CloseBraceToken */; case 126 /* tilde */: - return pos++, token = 48 /* TildeToken */; + return pos++, token = 49 /* TildeToken */; case 64 /* at */: - return pos++, token = 53 /* AtToken */; + return pos++, token = 54 /* AtToken */; case 92 /* backslash */: var cookedChar = peekUnicodeEscape(); if (cookedChar >= 0 && isIdentifierStart(cookedChar)) { @@ -3743,27 +3805,27 @@ var ts; } } function reScanGreaterToken() { - if (token === 26 /* GreaterThanToken */) { + if (token === 27 /* 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 = 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 43 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 44 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 61 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 62 /* GreaterThanGreaterThanEqualsToken */; } - return pos++, token = 42 /* GreaterThanGreaterThanToken */; + return pos++, token = 43 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { - return pos++, token = 28 /* GreaterThanEqualsToken */; + return pos++, token = 29 /* GreaterThanEqualsToken */; } } return token; } function reScanSlashToken() { - if (token === 37 /* SlashToken */ || token === 58 /* SlashEqualsToken */) { + if (token === 38 /* SlashToken */ || token === 59 /* SlashEqualsToken */) { var p = tokenPos + 1; var inEscape = false; var inCharacterClass = false; @@ -3808,7 +3870,7 @@ var ts; } pos = p; tokenValue = text.substring(tokenPos, pos); - token = 9 /* RegularExpressionLiteral */; + token = 10 /* RegularExpressionLiteral */; } return token; } @@ -3816,7 +3878,7 @@ var ts; * Unconditionally back up and scan a template expression portion. */ function reScanTemplateToken() { - ts.Debug.assert(token === 15 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); + ts.Debug.assert(token === 16 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); pos = tokenPos; return token = scanTemplateAndSetTokenValue(); } @@ -3833,14 +3895,14 @@ var ts; if (char === 60 /* lessThan */) { if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; - return token = 25 /* LessThanSlashToken */; + return token = 26 /* LessThanSlashToken */; } pos++; - return token = 24 /* LessThanToken */; + return token = 25 /* LessThanToken */; } if (char === 123 /* openBrace */) { pos++; - return token = 14 /* OpenBraceToken */; + return token = 15 /* OpenBraceToken */; } while (pos < end) { pos++; @@ -3849,12 +3911,12 @@ var ts; break; } } - return token = 233 /* JsxText */; + return token = 234 /* JsxText */; } // Scans a JSX identifier; these differ from normal identifiers in that // they allow dashes function scanJsxIdentifier() { - if (token === 66 /* Identifier */) { + if (token === 67 /* Identifier */) { var firstCharPosition = pos; while (pos < end) { var ch = text.charCodeAt(pos); @@ -3890,10 +3952,10 @@ var ts; return result; } function lookAhead(callback) { - return speculationHelper(callback, true); + return speculationHelper(callback, /*isLookahead:*/ true); } function tryScan(callback) { - return speculationHelper(callback, false); + return speculationHelper(callback, /*isLookahead:*/ false); } function setText(newText, start, length) { text = newText || ""; @@ -3937,16 +3999,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 212 /* InterfaceDeclaration */ || node.kind === 213 /* TypeAliasDeclaration */) { + if (node.kind === 213 /* InterfaceDeclaration */ || node.kind === 214 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 219 /* ImportDeclaration */ || node.kind === 218 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 220 /* ImportDeclaration */ || node.kind === 219 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 216 /* ModuleBlock */) { + else if (node.kind === 217 /* ModuleBlock */) { var state = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3965,7 +4027,7 @@ var ts; }); return state; } - else if (node.kind === 215 /* ModuleDeclaration */) { + else if (node.kind === 216 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -4043,10 +4105,10 @@ var ts; // unless it is a well known Symbol. function getDeclarationName(node) { if (node.name) { - if (node.kind === 215 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { - return '"' + node.name.text + '"'; + if (node.kind === 216 /* ModuleDeclaration */ && node.name.kind === 9 /* StringLiteral */) { + return "\"" + node.name.text + "\""; } - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -4054,22 +4116,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 141 /* Constructor */: + case 142 /* Constructor */: return "__constructor"; - case 149 /* FunctionType */: - case 144 /* CallSignature */: + case 150 /* FunctionType */: + case 145 /* CallSignature */: return "__call"; - case 150 /* ConstructorType */: - case 145 /* ConstructSignature */: + case 151 /* ConstructorType */: + case 146 /* ConstructSignature */: return "__new"; - case 146 /* IndexSignature */: + case 147 /* IndexSignature */: return "__index"; - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return "__export"; - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 210 /* FunctionDeclaration */: - case 211 /* ClassDeclaration */: + case 211 /* FunctionDeclaration */: + case 212 /* ClassDeclaration */: return node.flags & 1024 /* Default */ ? "default" : undefined; } } @@ -4140,7 +4202,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolFlags & 8388608 /* Alias */) { - if (node.kind === 227 /* ExportSpecifier */ || (node.kind === 218 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 228 /* ExportSpecifier */ || (node.kind === 219 /* ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -4221,37 +4283,37 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 183 /* ClassExpression */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 152 /* TypeLiteral */: - case 162 /* ObjectLiteralExpression */: + case 184 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 153 /* TypeLiteral */: + case 163 /* ObjectLiteralExpression */: return 1 /* IsContainer */; - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 210 /* FunctionDeclaration */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 215 /* ModuleDeclaration */: - case 245 /* SourceFile */: - case 213 /* TypeAliasDeclaration */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 211 /* FunctionDeclaration */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 216 /* ModuleDeclaration */: + case 246 /* SourceFile */: + case 214 /* TypeAliasDeclaration */: return 5 /* IsContainerWithLocals */; - case 241 /* CatchClause */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 217 /* CaseBlock */: + case 242 /* CatchClause */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 218 /* CaseBlock */: return 2 /* IsBlockScopedContainer */; - case 189 /* Block */: + case 190 /* Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Othewise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -4288,38 +4350,38 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 183 /* ClassExpression */: - case 211 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 212 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 152 /* TypeLiteral */: - case 162 /* ObjectLiteralExpression */: - case 212 /* InterfaceDeclaration */: + case 153 /* TypeLiteral */: + case 163 /* ObjectLiteralExpression */: + case 213 /* InterfaceDeclaration */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 213 /* TypeAliasDeclaration */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 214 /* TypeAliasDeclaration */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -4349,11 +4411,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 245 /* SourceFile */ ? node : node.body; - if (body.kind === 245 /* SourceFile */ || body.kind === 216 /* ModuleBlock */) { + var body = node.kind === 246 /* SourceFile */ ? node : node.body; + if (body.kind === 246 /* SourceFile */ || body.kind === 217 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 225 /* ExportDeclaration */ || stat.kind === 224 /* ExportAssignment */) { + if (stat.kind === 226 /* ExportDeclaration */ || stat.kind === 225 /* ExportAssignment */) { return true; } } @@ -4372,7 +4434,7 @@ var ts; } function bindModuleDeclaration(node) { setExportContextFlag(node); - if (node.name.kind === 8 /* StringLiteral */) { + if (node.name.kind === 9 /* StringLiteral */) { declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); } else { @@ -4382,14 +4444,21 @@ var ts; } else { declareSymbolAndAddToSymbolTable(node, 512 /* ValueModule */, 106639 /* ValueModuleExcludes */); - var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */; - if (node.symbol.constEnumOnlyModule === undefined) { - // non-merged case - use the current state - node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + if (node.symbol.flags & (16 /* Function */ | 32 /* Class */ | 256 /* RegularEnum */)) { + // if module was already merged with some function, class or non-const enum + // treat is a non-const-enum-only + node.symbol.constEnumOnlyModule = false; } else { - // merged case: module is const enum only if all its pieces are non-instantiated or const enum - node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + var currentModuleIsConstEnumOnly = state === 2 /* ConstEnumOnly */; + if (node.symbol.constEnumOnlyModule === undefined) { + // non-merged case - use the current state + node.symbol.constEnumOnlyModule = currentModuleIsConstEnumOnly; + } + else { + // merged case: module is const enum only if all its pieces are non-instantiated or const enum + node.symbol.constEnumOnlyModule = node.symbol.constEnumOnlyModule && currentModuleIsConstEnumOnly; + } } } } @@ -4418,7 +4487,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.name.kind !== 66 /* Identifier */) { + if (prop.name.kind !== 67 /* Identifier */) { continue; } var identifier = prop.name; @@ -4430,7 +4499,7 @@ var ts; // c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true. // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields - var currentKind = prop.kind === 242 /* PropertyAssignment */ || prop.kind === 243 /* ShorthandPropertyAssignment */ || prop.kind === 140 /* MethodDeclaration */ + var currentKind = prop.kind === 243 /* PropertyAssignment */ || prop.kind === 244 /* ShorthandPropertyAssignment */ || prop.kind === 141 /* MethodDeclaration */ ? 1 /* Property */ : 2 /* Accessor */; var existingKind = seen[identifier.text]; @@ -4452,10 +4521,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -4476,8 +4545,8 @@ var ts; // check for reserved words used as identifiers in strict mode code. function checkStrictModeIdentifier(node) { if (inStrictMode && - node.originalKeywordKind >= 103 /* FirstFutureReservedWord */ && - node.originalKeywordKind <= 111 /* LastFutureReservedWord */ && + node.originalKeywordKind >= 104 /* FirstFutureReservedWord */ && + node.originalKeywordKind <= 112 /* LastFutureReservedWord */ && !ts.isIdentifierName(node)) { // Report error only if there are no parse errors in file if (!file.parseDiagnostics.length) { @@ -4512,7 +4581,7 @@ var ts; } function checkStrictModeDeleteExpression(node) { // Grammar checking - if (inStrictMode && node.expression.kind === 66 /* Identifier */) { + if (inStrictMode && node.expression.kind === 67 /* Identifier */) { // When a delete operator occurs within strict mode code, a SyntaxError is thrown if its // UnaryExpression is a direct reference to a variable, function argument, or function name var span = ts.getErrorSpanForNode(file, node.expression); @@ -4520,11 +4589,11 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 66 /* Identifier */ && + return node.kind === 67 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 66 /* Identifier */) { + if (name && name.kind === 67 /* Identifier */) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { // We check first if the name is inside class declaration or class expression; if so give explicit message @@ -4568,7 +4637,7 @@ var ts; function checkStrictModePrefixUnaryExpression(node) { // Grammar checking if (inStrictMode) { - if (node.operator === 39 /* PlusPlusToken */ || node.operator === 40 /* MinusMinusToken */) { + if (node.operator === 40 /* PlusPlusToken */ || node.operator === 41 /* MinusMinusToken */) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -4612,17 +4681,17 @@ var ts; } function updateStrictMode(node) { switch (node.kind) { - case 245 /* SourceFile */: - case 216 /* ModuleBlock */: + case 246 /* SourceFile */: + case 217 /* ModuleBlock */: updateStrictModeStatementList(node.statements); return; - case 189 /* Block */: + case 190 /* Block */: if (ts.isFunctionLike(node.parent)) { updateStrictModeStatementList(node.statements); } return; - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return; @@ -4645,103 +4714,103 @@ var ts; var nodeText = ts.getTextOfNodeFromSourceText(file.text, node.expression); // Note: the node text must be exactly "use strict" or 'use strict'. It is not ok for the // string to contain unicode escapes (as per ES5). - return nodeText === '"use strict"' || nodeText === "'use strict'"; + return nodeText === "\"use strict\"" || nodeText === "'use strict'"; } function bindWorker(node) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return checkStrictModeIdentifier(node); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return checkStrictModeBinaryExpression(node); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return checkStrictModeCatchClause(node); - case 172 /* DeleteExpression */: + case 173 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 177 /* PostfixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 202 /* WithStatement */: + case 203 /* WithStatement */: return checkStrictModeWithStatement(node); - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: return declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */); - case 135 /* Parameter */: + case 136 /* Parameter */: return bindParameter(node); - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: return bindVariableDeclarationOrBindingElement(node); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), 107455 /* PropertyExcludes */); - case 242 /* PropertyAssignment */: - case 243 /* ShorthandPropertyAssignment */: + case 243 /* PropertyAssignment */: + case 244 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */); - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */); - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: checkStrictModeFunctionName(node); return declareSymbolAndAddToSymbolTable(node, 16 /* Function */, 106927 /* FunctionExcludes */); - case 141 /* Constructor */: - return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, 0 /* None */); - case 142 /* GetAccessor */: + case 142 /* Constructor */: + return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */); + case 143 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */); - case 143 /* SetAccessor */: + case 144 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: return bindFunctionOrConstructorType(node); - case 152 /* TypeLiteral */: + case 153 /* TypeLiteral */: return bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type"); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: checkStrictModeFunctionName(node); var bindingName = node.name ? node.name.text : "__function"; return bindAnonymousDeclaration(node, 16 /* Function */, bindingName); - case 183 /* ClassExpression */: - case 211 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 212 /* ClassDeclaration */: return bindClassLikeDeclaration(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 792960 /* InterfaceExcludes */); - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return bindModuleDeclaration(node); - case 218 /* ImportEqualsDeclaration */: - case 221 /* NamespaceImport */: - case 223 /* ImportSpecifier */: - case 227 /* ExportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 222 /* NamespaceImport */: + case 224 /* ImportSpecifier */: + case 228 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */); - case 220 /* ImportClause */: + case 221 /* ImportClause */: return bindImportClause(node); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return bindExportDeclaration(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return bindExportAssignment(node); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return bindSourceFileIfExternalModule(); } } function bindSourceFileIfExternalModule() { setExportContextFlag(file); if (ts.isExternalModule(file)) { - bindAnonymousDeclaration(file, 512 /* ValueModule */, '"' + ts.removeFileExtension(file.fileName) + '"'); + bindAnonymousDeclaration(file, 512 /* ValueModule */, "\"" + ts.removeFileExtension(file.fileName) + "\""); } } function bindExportAssignment(node) { @@ -4749,7 +4818,7 @@ var ts; // Export assignment in some sort of block construct bindAnonymousDeclaration(node, 8388608 /* Alias */, getDeclarationName(node)); } - else if (node.expression.kind === 66 /* Identifier */) { + else if (node.expression.kind === 67 /* Identifier */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); } @@ -4774,7 +4843,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899519 /* ClassExcludes */); } else { @@ -4846,7 +4915,7 @@ var ts; // If this is a property-parameter, then also declare the property symbol into the // containing class. if (node.flags & 112 /* AccessibilityModifier */ && - node.parent.kind === 141 /* Constructor */ && + node.parent.kind === 142 /* Constructor */ && ts.isClassLike(node.parent.parent)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); @@ -4912,6 +4981,37 @@ var ts; return node.end - node.pos; } ts.getFullWidth = getFullWidth; + function arrayIsEqualTo(arr1, arr2, comparer) { + if (!arr1 || !arr2) { + return arr1 === arr2; + } + if (arr1.length !== arr2.length) { + return false; + } + for (var i = 0; i < arr1.length; ++i) { + var equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i]; + if (!equals) { + return false; + } + } + return true; + } + ts.arrayIsEqualTo = arrayIsEqualTo; + function hasResolvedModuleName(sourceFile, moduleNameText) { + return sourceFile.resolvedModules && ts.hasProperty(sourceFile.resolvedModules, moduleNameText); + } + ts.hasResolvedModuleName = hasResolvedModuleName; + function getResolvedModuleFileName(sourceFile, moduleNameText) { + return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + } + ts.getResolvedModuleFileName = getResolvedModuleFileName; + function setResolvedModuleName(sourceFile, moduleNameText, resolvedFileName) { + if (!sourceFile.resolvedModules) { + sourceFile.resolvedModules = {}; + } + sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + } + ts.setResolvedModuleName = setResolvedModuleName; // Returns true if this node contains a parse error anywhere underneath it. function containsParseError(node) { aggregateChildData(node); @@ -4936,7 +5036,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 245 /* SourceFile */) { + while (node && node.kind !== 246 /* SourceFile */) { node = node.parent; } return node; @@ -5031,7 +5131,7 @@ var ts; // Make an identifier from an external module name by extracting the string after the last "/" and replacing // all non-alphanumeric characters with underscores function makeIdentifierFromModuleName(moduleName) { - return ts.getBaseFileName(moduleName).replace(/\W/g, "_"); + return ts.getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } ts.makeIdentifierFromModuleName = makeIdentifierFromModuleName; function isBlockOrCatchScoped(declaration) { @@ -5048,15 +5148,15 @@ var ts; return current; } switch (current.kind) { - case 245 /* SourceFile */: - case 217 /* CaseBlock */: - case 241 /* CatchClause */: - case 215 /* ModuleDeclaration */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 246 /* SourceFile */: + case 218 /* CaseBlock */: + case 242 /* CatchClause */: + case 216 /* ModuleDeclaration */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: return current; - case 189 /* Block */: + case 190 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -5069,9 +5169,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 208 /* VariableDeclaration */ && + declaration.kind === 209 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 241 /* CatchClause */; + declaration.parent.kind === 242 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -5101,7 +5201,7 @@ var ts; } ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; function getSpanOfTokenAtPosition(sourceFile, pos) { - var scanner = ts.createScanner(sourceFile.languageVersion, true, sourceFile.languageVariant, sourceFile.text, undefined, pos); + var scanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.languageVariant, sourceFile.text, /*onError:*/ undefined, pos); scanner.scan(); var start = scanner.getTokenPos(); return ts.createTextSpanFromBounds(start, scanner.getTextPos()); @@ -5110,8 +5210,8 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 245 /* SourceFile */: - var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); + case 246 /* SourceFile */: + var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file return ts.createTextSpan(0, 0); @@ -5119,16 +5219,16 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: - case 212 /* InterfaceDeclaration */: - case 215 /* ModuleDeclaration */: - case 214 /* EnumDeclaration */: - case 244 /* EnumMember */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 213 /* InterfaceDeclaration */: + case 216 /* ModuleDeclaration */: + case 215 /* EnumDeclaration */: + case 245 /* EnumMember */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: errorNode = node.name; break; } @@ -5152,11 +5252,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 214 /* EnumDeclaration */ && isConst(node); + return node.kind === 215 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 160 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 161 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -5171,14 +5271,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 208 /* VariableDeclaration */) { + if (node.kind === 209 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 209 /* VariableDeclarationList */) { + if (node && node.kind === 210 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 190 /* VariableStatement */) { + if (node && node.kind === 191 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -5193,25 +5293,18 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 192 /* ExpressionStatement */ && node.expression.kind === 8 /* StringLiteral */; + return node.kind === 193 /* ExpressionStatement */ && node.expression.kind === 9 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { - // If parameter/type parameter, the prev token trailing comments are part of this node too - if (node.kind === 135 /* Parameter */ || node.kind === 134 /* TypeParameter */) { - // e.g. (/** blah */ a, /** blah */ b); - // e.g.: ( - // /** blah */ a, - // /** blah */ b); - return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); - } - else { - return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); - } + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJsDocComments(node, sourceFileOfNode) { - return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); + var commentRanges = (node.kind === 136 /* Parameter */ || node.kind === 135 /* TypeParameter */) ? + ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : + getLeadingCommentRangesOfNode(node, sourceFileOfNode); + return ts.filter(commentRanges, isJsDocComment); function isJsDocComment(comment) { // True if the comment starts with '/**' but not if it is '/**/' return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && @@ -5222,40 +5315,40 @@ var ts; ts.getJsDocComments = getJsDocComments; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; function isTypeNode(node) { - if (148 /* FirstTypeNode */ <= node.kind && node.kind <= 157 /* LastTypeNode */) { + if (149 /* FirstTypeNode */ <= node.kind && node.kind <= 158 /* LastTypeNode */) { return true; } switch (node.kind) { - case 114 /* AnyKeyword */: - case 125 /* NumberKeyword */: - case 127 /* StringKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: + case 115 /* AnyKeyword */: + case 126 /* NumberKeyword */: + case 128 /* StringKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: return true; - case 100 /* VoidKeyword */: - return node.parent.kind !== 174 /* VoidExpression */; - case 8 /* StringLiteral */: + case 101 /* VoidKeyword */: + return node.parent.kind !== 175 /* VoidExpression */; + case 9 /* StringLiteral */: // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === 135 /* Parameter */; - case 185 /* ExpressionWithTypeArguments */: + return node.parent.kind === 136 /* Parameter */; + case 186 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(node); // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container - case 66 /* Identifier */: + case 67 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 132 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 163 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // fall through - case 132 /* QualifiedName */: - case 163 /* PropertyAccessExpression */: + case 133 /* QualifiedName */: + case 164 /* PropertyAccessExpression */: // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 66 /* Identifier */ || node.kind === 132 /* QualifiedName */ || node.kind === 163 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */ || node.kind === 164 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_1 = node.parent; - if (parent_1.kind === 151 /* TypeQuery */) { + if (parent_1.kind === 152 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -5264,38 +5357,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (148 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 157 /* LastTypeNode */) { + if (149 /* FirstTypeNode */ <= parent_1.kind && parent_1.kind <= 158 /* LastTypeNode */) { return true; } switch (parent_1.kind) { - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return !isExpressionWithTypeArgumentsInClassExtendsClause(parent_1); - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: return node === parent_1.constraint; - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 135 /* Parameter */: - case 208 /* VariableDeclaration */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 136 /* Parameter */: + case 209 /* VariableDeclaration */: return node === parent_1.type; - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 141 /* Constructor */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 142 /* Constructor */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return node === parent_1.type; - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: return node === parent_1.type; - case 168 /* TypeAssertionExpression */: + case 169 /* TypeAssertionExpression */: return node === parent_1.type; - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return parent_1.typeArguments && ts.indexOf(parent_1.typeArguments, node) >= 0; - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -5309,23 +5402,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: return visitor(node); - case 217 /* CaseBlock */: - case 189 /* Block */: - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 202 /* WithStatement */: - case 203 /* SwitchStatement */: - case 238 /* CaseClause */: - case 239 /* DefaultClause */: - case 204 /* LabeledStatement */: - case 206 /* TryStatement */: - case 241 /* CatchClause */: + case 218 /* CaseBlock */: + case 190 /* Block */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 203 /* WithStatement */: + case 204 /* SwitchStatement */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: + case 205 /* LabeledStatement */: + case 207 /* TryStatement */: + case 242 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -5335,18 +5428,18 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } - case 214 /* EnumDeclaration */: - case 212 /* InterfaceDeclaration */: - case 215 /* ModuleDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 215 /* EnumDeclaration */: + case 213 /* InterfaceDeclaration */: + case 216 /* ModuleDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, any yield statements contained within them should be // skipped in this traversal. @@ -5354,7 +5447,7 @@ var ts; default: if (isFunctionLike(node)) { var name_5 = node.name; - if (name_5 && name_5.kind === 133 /* ComputedPropertyName */) { + if (name_5 && name_5.kind === 134 /* ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(name_5.expression); @@ -5373,14 +5466,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 160 /* BindingElement */: - case 244 /* EnumMember */: - case 135 /* Parameter */: - case 242 /* PropertyAssignment */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 243 /* ShorthandPropertyAssignment */: - case 208 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 245 /* EnumMember */: + case 136 /* Parameter */: + case 243 /* PropertyAssignment */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 244 /* ShorthandPropertyAssignment */: + case 209 /* VariableDeclaration */: return true; } } @@ -5388,41 +5481,55 @@ var ts; } ts.isVariableLike = isVariableLike; function isAccessor(node) { - return node && (node.kind === 142 /* GetAccessor */ || node.kind === 143 /* SetAccessor */); + return node && (node.kind === 143 /* GetAccessor */ || node.kind === 144 /* SetAccessor */); } ts.isAccessor = isAccessor; function isClassLike(node) { - return node && (node.kind === 211 /* ClassDeclaration */ || node.kind === 183 /* ClassExpression */); + return node && (node.kind === 212 /* ClassDeclaration */ || node.kind === 184 /* ClassExpression */); } ts.isClassLike = isClassLike; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 141 /* Constructor */: - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 142 /* Constructor */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: return true; } } return false; } ts.isFunctionLike = isFunctionLike; + function introducesArgumentsExoticObject(node) { + switch (node.kind) { + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + return true; + } + return false; + } + ts.introducesArgumentsExoticObject = introducesArgumentsExoticObject; function isFunctionBlock(node) { - return node && node.kind === 189 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 190 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 140 /* MethodDeclaration */ && node.parent.kind === 162 /* ObjectLiteralExpression */; + return node && node.kind === 141 /* MethodDeclaration */ && node.parent.kind === 163 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -5450,7 +5557,7 @@ var ts; return undefined; } switch (node.kind) { - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -5465,9 +5572,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 136 /* Decorator */: + case 137 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 135 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 136 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -5478,23 +5585,23 @@ var ts; node = node.parent; } break; - case 171 /* ArrowFunction */: + case 172 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 215 /* ModuleDeclaration */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 214 /* EnumDeclaration */: - case 245 /* SourceFile */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 216 /* ModuleDeclaration */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 215 /* EnumDeclaration */: + case 246 /* SourceFile */: return node; } } @@ -5506,7 +5613,7 @@ var ts; if (!node) return node; switch (node.kind) { - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'super' container. // A computed property name in a class needs to be a super container @@ -5521,9 +5628,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 136 /* Decorator */: + case 137 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 135 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 136 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -5534,19 +5641,19 @@ var ts; node = node.parent; } break; - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: if (!includeFunctions) { continue; } - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return node; } } @@ -5555,12 +5662,12 @@ var ts; function getEntityNameFromTypeNode(node) { if (node) { switch (node.kind) { - case 148 /* TypeReference */: + case 149 /* TypeReference */: return node.typeName; - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return node.expression; - case 66 /* Identifier */: - case 132 /* QualifiedName */: + case 67 /* Identifier */: + case 133 /* QualifiedName */: return node; } } @@ -5568,7 +5675,7 @@ var ts; } ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { - if (node.kind === 167 /* TaggedTemplateExpression */) { + if (node.kind === 168 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression, NewExpression, or Decorator. @@ -5577,44 +5684,44 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: // classes are valid targets return true; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 211 /* ClassDeclaration */; - case 135 /* Parameter */: + return node.parent.kind === 212 /* ClassDeclaration */; + case 136 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; - return node.parent.body && node.parent.parent.kind === 211 /* ClassDeclaration */; - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 140 /* MethodDeclaration */: + return node.parent.body && node.parent.parent.kind === 212 /* ClassDeclaration */; + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 141 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. - return node.body && node.parent.kind === 211 /* ClassDeclaration */; + return node.body && node.parent.kind === 212 /* ClassDeclaration */; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: if (node.decorators) { return true; } return false; - case 138 /* PropertyDeclaration */: - case 135 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 136 /* Parameter */: if (node.decorators) { return true; } return false; - case 142 /* GetAccessor */: + case 143 /* GetAccessor */: if (node.body && node.decorators) { return true; } return false; - case 140 /* MethodDeclaration */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 144 /* SetAccessor */: if (node.body && node.decorators) { return true; } @@ -5625,10 +5732,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 140 /* MethodDeclaration */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 144 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -5640,93 +5747,93 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function isExpression(node) { switch (node.kind) { - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: - case 90 /* NullKeyword */: - case 96 /* TrueKeyword */: - case 81 /* FalseKeyword */: - case 9 /* RegularExpressionLiteral */: - case 161 /* ArrayLiteralExpression */: - case 162 /* ObjectLiteralExpression */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 167 /* TaggedTemplateExpression */: - case 186 /* AsExpression */: - case 168 /* TypeAssertionExpression */: - case 169 /* ParenthesizedExpression */: - case 170 /* FunctionExpression */: - case 183 /* ClassExpression */: - case 171 /* ArrowFunction */: - case 174 /* VoidExpression */: - case 172 /* DeleteExpression */: - case 173 /* TypeOfExpression */: - case 176 /* PrefixUnaryExpression */: - case 177 /* PostfixUnaryExpression */: - case 178 /* BinaryExpression */: - case 179 /* ConditionalExpression */: - case 182 /* SpreadElementExpression */: - case 180 /* TemplateExpression */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 184 /* OmittedExpression */: - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: - case 181 /* YieldExpression */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: + case 91 /* NullKeyword */: + case 97 /* TrueKeyword */: + case 82 /* FalseKeyword */: + case 10 /* RegularExpressionLiteral */: + case 162 /* ArrayLiteralExpression */: + case 163 /* ObjectLiteralExpression */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 168 /* TaggedTemplateExpression */: + case 187 /* AsExpression */: + case 169 /* TypeAssertionExpression */: + case 170 /* ParenthesizedExpression */: + case 171 /* FunctionExpression */: + case 184 /* ClassExpression */: + case 172 /* ArrowFunction */: + case 175 /* VoidExpression */: + case 173 /* DeleteExpression */: + case 174 /* TypeOfExpression */: + case 177 /* PrefixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: + case 179 /* BinaryExpression */: + case 180 /* ConditionalExpression */: + case 183 /* SpreadElementExpression */: + case 181 /* TemplateExpression */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 185 /* OmittedExpression */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: + case 182 /* YieldExpression */: return true; - case 132 /* QualifiedName */: - while (node.parent.kind === 132 /* QualifiedName */) { + case 133 /* QualifiedName */: + while (node.parent.kind === 133 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 151 /* TypeQuery */; - case 66 /* Identifier */: - if (node.parent.kind === 151 /* TypeQuery */) { + return node.parent.kind === 152 /* TypeQuery */; + case 67 /* Identifier */: + if (node.parent.kind === 152 /* TypeQuery */) { return true; } // fall through - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: var parent_2 = node.parent; switch (parent_2.kind) { - case 208 /* VariableDeclaration */: - case 135 /* Parameter */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 244 /* EnumMember */: - case 242 /* PropertyAssignment */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 136 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 245 /* EnumMember */: + case 243 /* PropertyAssignment */: + case 161 /* BindingElement */: return parent_2.initializer === node; - case 192 /* ExpressionStatement */: - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 201 /* ReturnStatement */: - case 202 /* WithStatement */: - case 203 /* SwitchStatement */: - case 238 /* CaseClause */: - case 205 /* ThrowStatement */: - case 203 /* SwitchStatement */: + case 193 /* ExpressionStatement */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 202 /* ReturnStatement */: + case 203 /* WithStatement */: + case 204 /* SwitchStatement */: + case 239 /* CaseClause */: + case 206 /* ThrowStatement */: + case 204 /* SwitchStatement */: return parent_2.expression === node; - case 196 /* ForStatement */: + case 197 /* ForStatement */: var forStatement = parent_2; - return (forStatement.initializer === node && forStatement.initializer.kind !== 209 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 210 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: var forInStatement = parent_2; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 209 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 210 /* VariableDeclarationList */) || forInStatement.expression === node; - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: return node === parent_2.expression; - case 187 /* TemplateSpan */: + case 188 /* TemplateSpan */: return node === parent_2.expression; - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: return node === parent_2.expression; - case 136 /* Decorator */: + case 137 /* Decorator */: return true; - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return parent_2.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent_2); default: if (isExpression(parent_2)) { @@ -5744,7 +5851,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 218 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 229 /* ExternalModuleReference */; + return node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 230 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -5753,20 +5860,20 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 218 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 229 /* ExternalModuleReference */; + return node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 230 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 219 /* ImportDeclaration */) { + if (node.kind === 220 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 218 /* ImportEqualsDeclaration */) { + if (node.kind === 219 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 229 /* ExternalModuleReference */) { + if (reference.kind === 230 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 225 /* ExportDeclaration */) { + if (node.kind === 226 /* ExportDeclaration */) { return node.moduleSpecifier; } } @@ -5774,15 +5881,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 135 /* Parameter */: - return node.questionToken !== undefined; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - return node.questionToken !== undefined; - case 243 /* ShorthandPropertyAssignment */: - case 242 /* PropertyAssignment */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 136 /* Parameter */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 244 /* ShorthandPropertyAssignment */: + case 243 /* PropertyAssignment */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -5790,9 +5895,9 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 258 /* JSDocFunctionType */ && + return node.kind === 259 /* JSDocFunctionType */ && node.parameters.length > 0 && - node.parameters[0].type.kind === 260 /* JSDocConstructorType */; + node.parameters[0].type.kind === 261 /* JSDocConstructorType */; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function getJSDocTag(node, kind) { @@ -5806,26 +5911,26 @@ var ts; } } function getJSDocTypeTag(node) { - return getJSDocTag(node, 266 /* JSDocTypeTag */); + return getJSDocTag(node, 267 /* JSDocTypeTag */); } ts.getJSDocTypeTag = getJSDocTypeTag; function getJSDocReturnTag(node) { - return getJSDocTag(node, 265 /* JSDocReturnTag */); + return getJSDocTag(node, 266 /* JSDocReturnTag */); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocTemplateTag(node) { - return getJSDocTag(node, 267 /* JSDocTemplateTag */); + return getJSDocTag(node, 268 /* JSDocTemplateTag */); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function getCorrespondingJSDocParameterTag(parameter) { - if (parameter.name && parameter.name.kind === 66 /* Identifier */) { + if (parameter.name && parameter.name.kind === 67 /* Identifier */) { // If it's a parameter, see if the parent has a jsdoc comment with an @param // annotation. var parameterName = parameter.name.text; var docComment = parameter.parent.jsDocComment; if (docComment) { return ts.forEach(docComment.tags, function (t) { - if (t.kind === 264 /* JSDocParameterTag */) { + if (t.kind === 265 /* JSDocParameterTag */) { var parameterTag = t; var name_6 = parameterTag.preParameterName || parameterTag.postParameterName; if (name_6.text === parameterName) { @@ -5844,12 +5949,12 @@ var ts; function isRestParameter(node) { if (node) { if (node.parserContextFlags & 32 /* JavaScriptFile */) { - if (node.type && node.type.kind === 259 /* JSDocVariadicType */) { + if (node.type && node.type.kind === 260 /* JSDocVariadicType */) { return true; } var paramTag = getCorrespondingJSDocParameterTag(node); if (paramTag && paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 259 /* JSDocVariadicType */; + return paramTag.typeExpression.type.kind === 260 /* JSDocVariadicType */; } } return node.dotDotDotToken !== undefined; @@ -5858,19 +5963,19 @@ var ts; } ts.isRestParameter = isRestParameter; function isLiteralKind(kind) { - return 7 /* FirstLiteralToken */ <= kind && kind <= 10 /* LastLiteralToken */; + return 8 /* FirstLiteralToken */ <= kind && kind <= 11 /* LastLiteralToken */; } ts.isLiteralKind = isLiteralKind; function isTextualLiteralKind(kind) { - return kind === 8 /* StringLiteral */ || kind === 10 /* NoSubstitutionTemplateLiteral */; + return kind === 9 /* StringLiteral */ || kind === 11 /* NoSubstitutionTemplateLiteral */; } ts.isTextualLiteralKind = isTextualLiteralKind; function isTemplateLiteralKind(kind) { - return 10 /* FirstTemplateToken */ <= kind && kind <= 13 /* LastTemplateToken */; + return 11 /* FirstTemplateToken */ <= kind && kind <= 14 /* LastTemplateToken */; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 159 /* ArrayBindingPattern */ || node.kind === 158 /* ObjectBindingPattern */); + return !!node && (node.kind === 160 /* ArrayBindingPattern */ || node.kind === 159 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -5885,34 +5990,34 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 171 /* ArrowFunction */: - case 160 /* BindingElement */: - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: - case 141 /* Constructor */: - case 214 /* EnumDeclaration */: - case 244 /* EnumMember */: - case 227 /* ExportSpecifier */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 142 /* GetAccessor */: - case 220 /* ImportClause */: - case 218 /* ImportEqualsDeclaration */: - case 223 /* ImportSpecifier */: - case 212 /* InterfaceDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 215 /* ModuleDeclaration */: - case 221 /* NamespaceImport */: - case 135 /* Parameter */: - case 242 /* PropertyAssignment */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 143 /* SetAccessor */: - case 243 /* ShorthandPropertyAssignment */: - case 213 /* TypeAliasDeclaration */: - case 134 /* TypeParameter */: - case 208 /* VariableDeclaration */: + case 172 /* ArrowFunction */: + case 161 /* BindingElement */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 142 /* Constructor */: + case 215 /* EnumDeclaration */: + case 245 /* EnumMember */: + case 228 /* ExportSpecifier */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 143 /* GetAccessor */: + case 221 /* ImportClause */: + case 219 /* ImportEqualsDeclaration */: + case 224 /* ImportSpecifier */: + case 213 /* InterfaceDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 216 /* ModuleDeclaration */: + case 222 /* NamespaceImport */: + case 136 /* Parameter */: + case 243 /* PropertyAssignment */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 144 /* SetAccessor */: + case 244 /* ShorthandPropertyAssignment */: + case 214 /* TypeAliasDeclaration */: + case 135 /* TypeParameter */: + case 209 /* VariableDeclaration */: return true; } return false; @@ -5920,25 +6025,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 200 /* BreakStatement */: - case 199 /* ContinueStatement */: - case 207 /* DebuggerStatement */: - case 194 /* DoStatement */: - case 192 /* ExpressionStatement */: - case 191 /* EmptyStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 196 /* ForStatement */: - case 193 /* IfStatement */: - case 204 /* LabeledStatement */: - case 201 /* ReturnStatement */: - case 203 /* SwitchStatement */: - case 95 /* ThrowKeyword */: - case 206 /* TryStatement */: - case 190 /* VariableStatement */: - case 195 /* WhileStatement */: - case 202 /* WithStatement */: - case 224 /* ExportAssignment */: + case 201 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 208 /* DebuggerStatement */: + case 195 /* DoStatement */: + case 193 /* ExpressionStatement */: + case 192 /* EmptyStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 197 /* ForStatement */: + case 194 /* IfStatement */: + case 205 /* LabeledStatement */: + case 202 /* ReturnStatement */: + case 204 /* SwitchStatement */: + case 96 /* ThrowKeyword */: + case 207 /* TryStatement */: + case 191 /* VariableStatement */: + case 196 /* WhileStatement */: + case 203 /* WithStatement */: + case 225 /* ExportAssignment */: return true; default: return false; @@ -5947,13 +6052,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 141 /* Constructor */: - case 138 /* PropertyDeclaration */: - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 139 /* MethodSignature */: - case 146 /* IndexSignature */: + case 142 /* Constructor */: + case 139 /* PropertyDeclaration */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 140 /* MethodSignature */: + case 147 /* IndexSignature */: return true; default: return false; @@ -5962,11 +6067,11 @@ var ts; ts.isClassElement = isClassElement; // True if the given identifier, string literal, or number literal is the name of a declaration node function isDeclarationName(name) { - if (name.kind !== 66 /* Identifier */ && name.kind !== 8 /* StringLiteral */ && name.kind !== 7 /* NumericLiteral */) { + if (name.kind !== 67 /* Identifier */ && name.kind !== 9 /* StringLiteral */ && name.kind !== 8 /* NumericLiteral */) { return false; } var parent = name.parent; - if (parent.kind === 223 /* ImportSpecifier */ || parent.kind === 227 /* ExportSpecifier */) { + if (parent.kind === 224 /* ImportSpecifier */ || parent.kind === 228 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -5981,31 +6086,31 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 244 /* EnumMember */: - case 242 /* PropertyAssignment */: - case 163 /* PropertyAccessExpression */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 245 /* EnumMember */: + case 243 /* PropertyAssignment */: + case 164 /* PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: // Name on right hand side of dot in a type query if (parent.right === node) { - while (parent.kind === 132 /* QualifiedName */) { + while (parent.kind === 133 /* QualifiedName */) { parent = parent.parent; } - return parent.kind === 151 /* TypeQuery */; + return parent.kind === 152 /* TypeQuery */; } return false; - case 160 /* BindingElement */: - case 223 /* ImportSpecifier */: + case 161 /* BindingElement */: + case 224 /* ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 227 /* ExportSpecifier */: + case 228 /* ExportSpecifier */: // Any name in an export specifier return true; } @@ -6021,26 +6126,26 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 218 /* ImportEqualsDeclaration */ || - node.kind === 220 /* ImportClause */ && !!node.name || - node.kind === 221 /* NamespaceImport */ || - node.kind === 223 /* ImportSpecifier */ || - node.kind === 227 /* ExportSpecifier */ || - node.kind === 224 /* ExportAssignment */ && node.expression.kind === 66 /* Identifier */; + return node.kind === 219 /* ImportEqualsDeclaration */ || + node.kind === 221 /* ImportClause */ && !!node.name || + node.kind === 222 /* NamespaceImport */ || + node.kind === 224 /* ImportSpecifier */ || + node.kind === 228 /* ExportSpecifier */ || + node.kind === 225 /* ExportAssignment */ && node.expression.kind === 67 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 80 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 81 /* ExtendsKeyword */); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; } ts.getClassExtendsHeritageClauseElement = getClassExtendsHeritageClauseElement; function getClassImplementsHeritageClauseElements(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 103 /* ImplementsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 104 /* ImplementsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements; function getInterfaceBaseTypeNodes(node) { - var heritageClause = getHeritageClause(node.heritageClauses, 80 /* ExtendsKeyword */); + var heritageClause = getHeritageClause(node.heritageClauses, 81 /* ExtendsKeyword */); return heritageClause ? heritageClause.types : undefined; } ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; @@ -6109,11 +6214,11 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 67 /* FirstKeyword */ <= token && token <= 131 /* LastKeyword */; + return 68 /* FirstKeyword */ <= token && token <= 132 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { - return 2 /* FirstTriviaToken */ <= token && token <= 6 /* LastTriviaToken */; + return 2 /* FirstTriviaToken */ <= token && token <= 7 /* LastTriviaToken */; } ts.isTrivia = isTrivia; function isAsyncFunctionLike(node) { @@ -6129,7 +6234,7 @@ var ts; */ function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 133 /* ComputedPropertyName */ && + declaration.name.kind === 134 /* ComputedPropertyName */ && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; @@ -6139,14 +6244,14 @@ var ts; * where Symbol is literally the word "Symbol", and name is any identifierName */ function isWellKnownSymbolSyntactically(node) { - return node.kind === 163 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); + return node.kind === 164 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 66 /* Identifier */ || name.kind === 8 /* StringLiteral */ || name.kind === 7 /* NumericLiteral */) { + if (name.kind === 67 /* Identifier */ || name.kind === 9 /* StringLiteral */ || name.kind === 8 /* NumericLiteral */) { return name.text; } - if (name.kind === 133 /* ComputedPropertyName */) { + if (name.kind === 134 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -6164,21 +6269,21 @@ var ts; * Includes the word "Symbol" with unicode escapes */ function isESSymbolIdentifier(node) { - return node.kind === 66 /* Identifier */ && node.text === "Symbol"; + return node.kind === 67 /* Identifier */ && node.text === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { - case 112 /* AbstractKeyword */: - case 115 /* AsyncKeyword */: - case 71 /* ConstKeyword */: - case 119 /* DeclareKeyword */: - case 74 /* DefaultKeyword */: - case 79 /* ExportKeyword */: - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 110 /* StaticKeyword */: + case 113 /* AbstractKeyword */: + case 116 /* AsyncKeyword */: + case 72 /* ConstKeyword */: + case 120 /* DeclareKeyword */: + case 75 /* DefaultKeyword */: + case 80 /* ExportKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 111 /* StaticKeyword */: return true; } return false; @@ -6186,20 +6291,36 @@ var ts; ts.isModifier = isModifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 135 /* Parameter */; + return root.kind === 136 /* Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 160 /* BindingElement */) { + while (node.kind === 161 /* BindingElement */) { node = node.parent.parent; } return node; } ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 215 /* ModuleDeclaration */ || n.kind === 245 /* SourceFile */; + return isFunctionLike(n) || n.kind === 216 /* ModuleDeclaration */ || n.kind === 246 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; + function cloneEntityName(node) { + if (node.kind === 67 /* Identifier */) { + var clone_1 = createSynthesizedNode(67 /* Identifier */); + clone_1.text = node.text; + return clone_1; + } + else { + var clone_2 = createSynthesizedNode(133 /* QualifiedName */); + clone_2.left = cloneEntityName(node.left); + clone_2.left.parent = clone_2; + clone_2.right = cloneEntityName(node.right); + clone_2.right.parent = clone_2; + return clone_2; + } + } + ts.cloneEntityName = cloneEntityName; function nodeIsSynthesized(node) { return node.pos === -1; } @@ -6436,7 +6557,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 141 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 142 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -6448,7 +6569,7 @@ var ts; ts.getSetAccessorTypeAnnotationNode = getSetAccessorTypeAnnotationNode; function shouldEmitToOwnFile(sourceFile, compilerOptions) { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out)) { + if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { // 1. in-browser single file compilation scenario // 2. non .js file return compilerOptions.isolatedModules || !ts.fileExtensionIs(sourceFile.fileName, ".js"); @@ -6465,10 +6586,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 142 /* GetAccessor */) { + if (accessor.kind === 143 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 143 /* SetAccessor */) { + else if (accessor.kind === 144 /* SetAccessor */) { setAccessor = accessor; } else { @@ -6477,7 +6598,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 142 /* GetAccessor */ || member.kind === 143 /* SetAccessor */) + if ((member.kind === 143 /* GetAccessor */ || member.kind === 144 /* SetAccessor */) && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -6488,10 +6609,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 142 /* GetAccessor */ && !getAccessor) { + if (member.kind === 143 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 143 /* SetAccessor */ && !setAccessor) { + if (member.kind === 144 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -6593,7 +6714,7 @@ var ts; } function writeTrimmedCurrentLine(pos, nextLineStart) { var end = Math.min(comment.end, nextLineStart - 1); - var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); + var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ""); if (currentLineText) { // trimmed forward and ending spaces text writer.write(currentLineText); @@ -6624,16 +6745,16 @@ var ts; ts.writeCommentRange = writeCommentRange; function modifierToFlag(token) { switch (token) { - case 110 /* StaticKeyword */: return 128 /* Static */; - case 109 /* PublicKeyword */: return 16 /* Public */; - case 108 /* ProtectedKeyword */: return 64 /* Protected */; - case 107 /* PrivateKeyword */: return 32 /* Private */; - case 112 /* AbstractKeyword */: return 256 /* Abstract */; - case 79 /* ExportKeyword */: return 1 /* Export */; - case 119 /* DeclareKeyword */: return 2 /* Ambient */; - case 71 /* ConstKeyword */: return 32768 /* Const */; - case 74 /* DefaultKeyword */: return 1024 /* Default */; - case 115 /* AsyncKeyword */: return 512 /* Async */; + case 111 /* StaticKeyword */: return 128 /* Static */; + case 110 /* PublicKeyword */: return 16 /* Public */; + case 109 /* ProtectedKeyword */: return 64 /* Protected */; + case 108 /* PrivateKeyword */: return 32 /* Private */; + case 113 /* AbstractKeyword */: return 256 /* Abstract */; + case 80 /* ExportKeyword */: return 1 /* Export */; + case 120 /* DeclareKeyword */: return 2 /* Ambient */; + case 72 /* ConstKeyword */: return 32768 /* Const */; + case 75 /* DefaultKeyword */: return 1024 /* Default */; + case 116 /* AsyncKeyword */: return 512 /* Async */; } return 0; } @@ -6641,29 +6762,29 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 166 /* NewExpression */: - case 165 /* CallExpression */: - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: - case 167 /* TaggedTemplateExpression */: - case 161 /* ArrayLiteralExpression */: - case 169 /* ParenthesizedExpression */: - case 162 /* ObjectLiteralExpression */: - case 183 /* ClassExpression */: - case 170 /* FunctionExpression */: - case 66 /* Identifier */: - case 9 /* RegularExpressionLiteral */: - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 180 /* TemplateExpression */: - case 81 /* FalseKeyword */: - case 90 /* NullKeyword */: - case 94 /* ThisKeyword */: - case 96 /* TrueKeyword */: - case 92 /* SuperKeyword */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 167 /* NewExpression */: + case 166 /* CallExpression */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: + case 168 /* TaggedTemplateExpression */: + case 162 /* ArrayLiteralExpression */: + case 170 /* ParenthesizedExpression */: + case 163 /* ObjectLiteralExpression */: + case 184 /* ClassExpression */: + case 171 /* FunctionExpression */: + case 67 /* Identifier */: + case 10 /* RegularExpressionLiteral */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 181 /* TemplateExpression */: + case 82 /* FalseKeyword */: + case 91 /* NullKeyword */: + case 95 /* ThisKeyword */: + case 97 /* TrueKeyword */: + case 93 /* SuperKeyword */: return true; } } @@ -6671,12 +6792,12 @@ var ts; } ts.isLeftHandSideExpression = isLeftHandSideExpression; function isAssignmentOperator(token) { - return token >= 54 /* FirstAssignment */ && token <= 65 /* LastAssignment */; + return token >= 55 /* FirstAssignment */ && token <= 66 /* LastAssignment */; } ts.isAssignmentOperator = isAssignmentOperator; function isExpressionWithTypeArgumentsInClassExtendsClause(node) { - return node.kind === 185 /* ExpressionWithTypeArguments */ && - node.parent.token === 80 /* ExtendsKeyword */ && + return node.kind === 186 /* ExpressionWithTypeArguments */ && + node.parent.token === 81 /* ExtendsKeyword */ && isClassLike(node.parent.parent); } ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause; @@ -6687,10 +6808,10 @@ var ts; } ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 66 /* Identifier */) { + if (node.kind === 67 /* Identifier */) { return true; } - else if (node.kind === 163 /* PropertyAccessExpression */) { + else if (node.kind === 164 /* PropertyAccessExpression */) { return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { @@ -6698,10 +6819,21 @@ var ts; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 132 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 163 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; + function isEmptyObjectLiteralOrArrayLiteral(expression) { + var kind = expression.kind; + if (kind === 163 /* ObjectLiteralExpression */) { + return expression.properties.length === 0; + } + if (kind === 162 /* ArrayLiteralExpression */) { + return expression.elements.length === 0; + } + return false; + } + ts.isEmptyObjectLiteralOrArrayLiteral = isEmptyObjectLiteralOrArrayLiteral; function getLocalSymbolForExportDefault(symbol) { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 1024 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } @@ -7004,13 +7136,13 @@ var ts; oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); } - return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN); + return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), /*newLength:*/ newEndN - oldStartN); } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 134 /* TypeParameter */) { + if (d && d.kind === 135 /* TypeParameter */) { for (var current = d; current; current = current.parent) { - if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 212 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 213 /* InterfaceDeclaration */) { return current; } } @@ -7022,7 +7154,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(269 /* Count */); + var nodeConstructors = new Array(270 /* Count */); /* @internal */ ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -7067,20 +7199,20 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 135 /* Parameter */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 242 /* PropertyAssignment */: - case 243 /* ShorthandPropertyAssignment */: - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 136 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 243 /* PropertyAssignment */: + case 244 /* ShorthandPropertyAssignment */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -7089,24 +7221,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -7117,290 +7249,290 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 148 /* TypeReference */: + case 149 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 147 /* TypePredicate */: + case 148 /* TypePredicate */: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 152 /* TypeLiteral */: + case 153 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 153 /* ArrayType */: + case 154 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 154 /* TupleType */: + case 155 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 155 /* UnionType */: - case 156 /* IntersectionType */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: return visitNodes(cbNodes, node.types); - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 163 /* PropertyAccessExpression */: + case 164 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 168 /* TypeAssertionExpression */: + case 169 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 172 /* DeleteExpression */: + case 173 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 173 /* TypeOfExpression */: + case 174 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 174 /* VoidExpression */: + case 175 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 175 /* AwaitExpression */: + case 176 /* AwaitExpression */: return visitNode(cbNode, node.expression); - case 177 /* PostfixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 186 /* AsExpression */: + case 187 /* AsExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 182 /* SpreadElementExpression */: + case 183 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 189 /* Block */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 209 /* VariableDeclarationList */: + case 210 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 193 /* IfStatement */: + case 194 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 194 /* DoStatement */: + case 195 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 195 /* WhileStatement */: + case 196 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 196 /* ForStatement */: + case 197 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 197 /* ForInStatement */: + case 198 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 198 /* ForOfStatement */: + case 199 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 199 /* ContinueStatement */: - case 200 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 201 /* BreakStatement */: return visitNode(cbNode, node.label); - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 202 /* WithStatement */: + case 203 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 217 /* CaseBlock */: + case 218 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 238 /* CaseClause */: + case 239 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 239 /* DefaultClause */: + case 240 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 205 /* ThrowStatement */: + case 206 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 206 /* TryStatement */: + case 207 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 136 /* Decorator */: + case 137 /* Decorator */: return visitNode(cbNode, node.expression); - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNode(cbNode, node.type); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 220 /* ImportClause */: + case 221 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 221 /* NamespaceImport */: + case 222 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 222 /* NamedImports */: - case 226 /* NamedExports */: + case 223 /* NamedImports */: + case 227 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 223 /* ImportSpecifier */: - case 227 /* ExportSpecifier */: + case 224 /* ImportSpecifier */: + case 228 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 180 /* TemplateExpression */: + case 181 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 187 /* TemplateSpan */: + case 188 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 240 /* HeritageClause */: + case 241 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 229 /* ExternalModuleReference */: + case 230 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 228 /* MissingDeclaration */: + case 229 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); - case 230 /* JsxElement */: + case 231 /* JsxElement */: return visitNode(cbNode, node.openingElement) || visitNodes(cbNodes, node.children) || visitNode(cbNode, node.closingElement); - case 231 /* JsxSelfClosingElement */: - case 232 /* JsxOpeningElement */: + case 232 /* JsxSelfClosingElement */: + case 233 /* JsxOpeningElement */: return visitNode(cbNode, node.tagName) || visitNodes(cbNodes, node.attributes); - case 235 /* JsxAttribute */: + case 236 /* JsxAttribute */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 236 /* JsxSpreadAttribute */: + case 237 /* JsxSpreadAttribute */: return visitNode(cbNode, node.expression); - case 237 /* JsxExpression */: + case 238 /* JsxExpression */: return visitNode(cbNode, node.expression); - case 234 /* JsxClosingElement */: + case 235 /* JsxClosingElement */: return visitNode(cbNode, node.tagName); - case 246 /* JSDocTypeExpression */: + case 247 /* JSDocTypeExpression */: return visitNode(cbNode, node.type); - case 250 /* JSDocUnionType */: + case 251 /* JSDocUnionType */: return visitNodes(cbNodes, node.types); - case 251 /* JSDocTupleType */: + case 252 /* JSDocTupleType */: return visitNodes(cbNodes, node.types); - case 249 /* JSDocArrayType */: + case 250 /* JSDocArrayType */: return visitNode(cbNode, node.elementType); - case 253 /* JSDocNonNullableType */: + case 254 /* JSDocNonNullableType */: return visitNode(cbNode, node.type); - case 252 /* JSDocNullableType */: + case 253 /* JSDocNullableType */: return visitNode(cbNode, node.type); - case 254 /* JSDocRecordType */: + case 255 /* JSDocRecordType */: return visitNodes(cbNodes, node.members); - case 256 /* JSDocTypeReference */: + case 257 /* JSDocTypeReference */: return visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeArguments); - case 257 /* JSDocOptionalType */: + case 258 /* JSDocOptionalType */: return visitNode(cbNode, node.type); - case 258 /* JSDocFunctionType */: + case 259 /* JSDocFunctionType */: return visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 259 /* JSDocVariadicType */: + case 260 /* JSDocVariadicType */: return visitNode(cbNode, node.type); - case 260 /* JSDocConstructorType */: + case 261 /* JSDocConstructorType */: return visitNode(cbNode, node.type); - case 261 /* JSDocThisType */: + case 262 /* JSDocThisType */: return visitNode(cbNode, node.type); - case 255 /* JSDocRecordMember */: + case 256 /* JSDocRecordMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 262 /* JSDocComment */: + case 263 /* JSDocComment */: return visitNodes(cbNodes, node.tags); - case 264 /* JSDocParameterTag */: + case 265 /* JSDocParameterTag */: return visitNode(cbNode, node.preParameterName) || visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.postParameterName); - case 265 /* JSDocReturnTag */: + case 266 /* JSDocReturnTag */: return visitNode(cbNode, node.typeExpression); - case 266 /* JSDocTypeTag */: + case 267 /* JSDocTypeTag */: return visitNode(cbNode, node.typeExpression); - case 267 /* JSDocTemplateTag */: + case 268 /* JSDocTemplateTag */: return visitNodes(cbNodes, node.typeParameters); } } @@ -7408,7 +7540,7 @@ var ts; function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { if (setParentNodes === void 0) { setParentNodes = false; } var start = new Date().getTime(); - var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes); + var result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes); ts.parseTime += new Date().getTime() - start; return result; } @@ -7444,7 +7576,7 @@ var ts; (function (Parser) { // Share a single scanner across all calls to parse a source file. This helps speed things // up by avoiding the cost of creating/compiling scanners over and over again. - var scanner = ts.createScanner(2 /* Latest */, true); + var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 1 /* DisallowIn */ | 4 /* Decorator */; var sourceFile; var parseDiagnostics; @@ -7595,9 +7727,9 @@ var ts; // Add additional cases as necessary depending on how we see JSDoc comments used // in the wild. switch (node.kind) { - case 190 /* VariableStatement */: - case 210 /* FunctionDeclaration */: - case 135 /* Parameter */: + case 191 /* VariableStatement */: + case 211 /* FunctionDeclaration */: + case 136 /* Parameter */: addJSDocComment(node); } forEachChild(node, visit); @@ -7638,7 +7770,7 @@ var ts; } Parser.fixupParentReferences = fixupParentReferences; function createSourceFile(fileName, languageVersion) { - var sourceFile = createNode(245 /* SourceFile */, 0); + var sourceFile = createNode(246 /* SourceFile */, /*pos*/ 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -7792,6 +7924,9 @@ var ts; function scanJsxIdentifier() { return token = scanner.scanJsxIdentifier(); } + function scanJsxText() { + return token = scanner.scanJsxToken(); + } function speculationHelper(callback, isLookAhead) { // Keep track of the state we'll need to rollback to if lookahead fails (or if the // caller asked us to always reset our state). @@ -7823,35 +7958,38 @@ var ts; // was in immediately prior to invoking the callback. The result of invoking the callback // is returned from this function. function lookAhead(callback) { - return speculationHelper(callback, true); + return speculationHelper(callback, /*isLookAhead*/ true); } // Invokes the provided callback. If the callback returns something falsy, then it restores // the parser to the state it was in immediately prior to invoking the callback. If the // callback returns something truthy, then the parser state is not rolled back. The result // of invoking the callback is returned from this function. function tryParse(callback) { - return speculationHelper(callback, false); + return speculationHelper(callback, /*isLookAhead*/ false); } // Ignore strict mode flag because we will report an error in type checker instead. function isIdentifier() { - if (token === 66 /* Identifier */) { + if (token === 67 /* Identifier */) { return true; } // If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is // considered a keyword and is not an identifier. - if (token === 111 /* YieldKeyword */ && inYieldContext()) { + if (token === 112 /* YieldKeyword */ && inYieldContext()) { return false; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token === 116 /* AwaitKeyword */ && inAwaitContext()) { + if (token === 117 /* AwaitKeyword */ && inAwaitContext()) { return false; } - return token > 102 /* LastReservedWord */; + return token > 103 /* LastReservedWord */; } - function parseExpected(kind, diagnosticMessage) { + function parseExpected(kind, diagnosticMessage, shouldAdvance) { + if (shouldAdvance === void 0) { shouldAdvance = true; } if (token === kind) { - nextToken(); + if (shouldAdvance) { + nextToken(); + } return true; } // Report specific message if provided with one. Otherwise, report generic fallback message. @@ -7887,22 +8025,22 @@ var ts; } function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. - if (token === 22 /* SemicolonToken */) { + if (token === 23 /* SemicolonToken */) { return true; } // We can parse out an optional semicolon in ASI cases in the following cases. - return token === 15 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); + return token === 16 /* CloseBraceToken */ || token === 1 /* EndOfFileToken */ || scanner.hasPrecedingLineBreak(); } function parseSemicolon() { if (canParseSemicolon()) { - if (token === 22 /* SemicolonToken */) { + if (token === 23 /* SemicolonToken */) { // consume the semicolon if it was explicitly provided. nextToken(); } return true; } else { - return parseExpected(22 /* SemicolonToken */); + return parseExpected(23 /* SemicolonToken */); } } function createNode(kind, pos) { @@ -7950,16 +8088,16 @@ var ts; function createIdentifier(isIdentifier, diagnosticMessage) { identifierCount++; if (isIdentifier) { - var node = createNode(66 /* Identifier */); + var node = createNode(67 /* Identifier */); // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker - if (token !== 66 /* Identifier */) { + if (token !== 67 /* Identifier */) { node.originalKeywordKind = token; } node.text = internIdentifier(scanner.getTokenValue()); nextToken(); return finishNode(node); } - return createMissingNode(66 /* Identifier */, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + return createMissingNode(67 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected); } function parseIdentifier(diagnosticMessage) { return createIdentifier(isIdentifier(), diagnosticMessage); @@ -7969,56 +8107,56 @@ var ts; } function isLiteralPropertyName() { return isIdentifierOrKeyword() || - token === 8 /* StringLiteral */ || - token === 7 /* NumericLiteral */; + token === 9 /* StringLiteral */ || + token === 8 /* NumericLiteral */; } function parsePropertyNameWorker(allowComputedPropertyNames) { - if (token === 8 /* StringLiteral */ || token === 7 /* NumericLiteral */) { - return parseLiteralNode(true); + if (token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */) { + return parseLiteralNode(/*internName*/ true); } - if (allowComputedPropertyNames && token === 18 /* OpenBracketToken */) { + if (allowComputedPropertyNames && token === 19 /* OpenBracketToken */) { return parseComputedPropertyName(); } return parseIdentifierName(); } function parsePropertyName() { - return parsePropertyNameWorker(true); + return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ true); } function parseSimplePropertyName() { - return parsePropertyNameWorker(false); + return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ false); } function isSimplePropertyName() { - return token === 8 /* StringLiteral */ || token === 7 /* NumericLiteral */ || isIdentifierOrKeyword(); + return token === 9 /* StringLiteral */ || token === 8 /* NumericLiteral */ || isIdentifierOrKeyword(); } function parseComputedPropertyName() { // PropertyName [Yield]: // LiteralPropertyName // ComputedPropertyName[?Yield] - var node = createNode(133 /* ComputedPropertyName */); - parseExpected(18 /* OpenBracketToken */); + var node = createNode(134 /* ComputedPropertyName */); + parseExpected(19 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker // will error if it sees a comma expression. node.expression = allowInAnd(parseExpression); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); return finishNode(node); } function parseContextualModifier(t) { return token === t && tryParse(nextTokenCanFollowModifier); } function nextTokenCanFollowModifier() { - if (token === 71 /* ConstKeyword */) { + if (token === 72 /* ConstKeyword */) { // 'const' is only a modifier if followed by 'enum'. - return nextToken() === 78 /* EnumKeyword */; + return nextToken() === 79 /* EnumKeyword */; } - if (token === 79 /* ExportKeyword */) { + if (token === 80 /* ExportKeyword */) { nextToken(); - if (token === 74 /* DefaultKeyword */) { + if (token === 75 /* DefaultKeyword */) { return lookAhead(nextTokenIsClassOrFunction); } - return token !== 36 /* AsteriskToken */ && token !== 14 /* OpenBraceToken */ && canFollowModifier(); + return token !== 37 /* AsteriskToken */ && token !== 15 /* OpenBraceToken */ && canFollowModifier(); } - if (token === 74 /* DefaultKeyword */) { + if (token === 75 /* DefaultKeyword */) { return nextTokenIsClassOrFunction(); } nextToken(); @@ -8028,14 +8166,14 @@ var ts; return ts.isModifier(token) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { - return token === 18 /* OpenBracketToken */ - || token === 14 /* OpenBraceToken */ - || token === 36 /* AsteriskToken */ + return token === 19 /* OpenBracketToken */ + || token === 15 /* OpenBraceToken */ + || token === 37 /* AsteriskToken */ || isLiteralPropertyName(); } function nextTokenIsClassOrFunction() { nextToken(); - return token === 70 /* ClassKeyword */ || token === 84 /* FunctionKeyword */; + return token === 71 /* ClassKeyword */ || token === 85 /* FunctionKeyword */; } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -8053,9 +8191,9 @@ var ts; // we're parsing. For example, if we have a semicolon in the middle of a class, then // we really don't want to assume the class is over and we're on a statement in the // outer module. We just want to consume and move on. - return !(token === 22 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); + return !(token === 23 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); case 2 /* SwitchClauses */: - return token === 68 /* CaseKeyword */ || token === 74 /* DefaultKeyword */; + return token === 69 /* CaseKeyword */ || token === 75 /* DefaultKeyword */; case 4 /* TypeMembers */: return isStartOfTypeMember(); case 5 /* ClassMembers */: @@ -8063,19 +8201,19 @@ var ts; // not in error recovery. If we're in error recovery, we don't want an errant // semicolon to be treated as a class member (since they're almost always used // for statements. - return lookAhead(isClassMemberStart) || (token === 22 /* SemicolonToken */ && !inErrorRecovery); + return lookAhead(isClassMemberStart) || (token === 23 /* SemicolonToken */ && !inErrorRecovery); case 6 /* EnumMembers */: // Include open bracket computed properties. This technically also lets in indexers, // which would be a candidate for improved error reporting. - return token === 18 /* OpenBracketToken */ || isLiteralPropertyName(); + return token === 19 /* OpenBracketToken */ || isLiteralPropertyName(); case 12 /* ObjectLiteralMembers */: - return token === 18 /* OpenBracketToken */ || token === 36 /* AsteriskToken */ || isLiteralPropertyName(); + return token === 19 /* OpenBracketToken */ || token === 37 /* AsteriskToken */ || isLiteralPropertyName(); case 9 /* ObjectBindingElements */: return isLiteralPropertyName(); case 7 /* HeritageClauseElement */: // If we see { } then only consume it as an expression if it is followed by , or { // That way we won't consume the body of a class in its heritage clause. - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { return lookAhead(isValidHeritageClauseObjectLiteral); } if (!inErrorRecovery) { @@ -8090,23 +8228,23 @@ var ts; case 8 /* VariableDeclarations */: return isIdentifierOrPattern(); case 10 /* ArrayBindingElements */: - return token === 23 /* CommaToken */ || token === 21 /* DotDotDotToken */ || isIdentifierOrPattern(); + return token === 24 /* CommaToken */ || token === 22 /* DotDotDotToken */ || isIdentifierOrPattern(); case 17 /* TypeParameters */: return isIdentifier(); case 11 /* ArgumentExpressions */: case 15 /* ArrayLiteralMembers */: - return token === 23 /* CommaToken */ || token === 21 /* DotDotDotToken */ || isStartOfExpression(); + return token === 24 /* CommaToken */ || token === 22 /* DotDotDotToken */ || isStartOfExpression(); case 16 /* Parameters */: return isStartOfParameter(); case 18 /* TypeArguments */: case 19 /* TupleElementTypes */: - return token === 23 /* CommaToken */ || isStartOfType(); + return token === 24 /* CommaToken */ || isStartOfType(); case 20 /* HeritageClauses */: return isHeritageClause(); case 21 /* ImportOrExportSpecifiers */: return isIdentifierOrKeyword(); case 13 /* JsxAttributes */: - return isIdentifierOrKeyword() || token === 14 /* OpenBraceToken */; + return isIdentifierOrKeyword() || token === 15 /* OpenBraceToken */; case 14 /* JsxChildren */: return true; case 22 /* JSDocFunctionParameters */: @@ -8119,8 +8257,8 @@ var ts; ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } function isValidHeritageClauseObjectLiteral() { - ts.Debug.assert(token === 14 /* OpenBraceToken */); - if (nextToken() === 15 /* CloseBraceToken */) { + ts.Debug.assert(token === 15 /* OpenBraceToken */); + if (nextToken() === 16 /* CloseBraceToken */) { // if we see "extends {}" then only treat the {} as what we're extending (and not // the class body) if we have: // @@ -8129,7 +8267,7 @@ var ts; // extends {} extends // extends {} implements var next = nextToken(); - return next === 23 /* CommaToken */ || next === 14 /* OpenBraceToken */ || next === 80 /* ExtendsKeyword */ || next === 103 /* ImplementsKeyword */; + return next === 24 /* CommaToken */ || next === 15 /* OpenBraceToken */ || next === 81 /* ExtendsKeyword */ || next === 104 /* ImplementsKeyword */; } return true; } @@ -8142,8 +8280,8 @@ var ts; return isIdentifierOrKeyword(); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token === 103 /* ImplementsKeyword */ || - token === 80 /* ExtendsKeyword */) { + if (token === 104 /* ImplementsKeyword */ || + token === 81 /* ExtendsKeyword */) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -8167,43 +8305,43 @@ var ts; case 12 /* ObjectLiteralMembers */: case 9 /* ObjectBindingElements */: case 21 /* ImportOrExportSpecifiers */: - return token === 15 /* CloseBraceToken */; + return token === 16 /* CloseBraceToken */; case 3 /* SwitchClauseStatements */: - return token === 15 /* CloseBraceToken */ || token === 68 /* CaseKeyword */ || token === 74 /* DefaultKeyword */; + return token === 16 /* CloseBraceToken */ || token === 69 /* CaseKeyword */ || token === 75 /* DefaultKeyword */; case 7 /* HeritageClauseElement */: - return token === 14 /* OpenBraceToken */ || token === 80 /* ExtendsKeyword */ || token === 103 /* ImplementsKeyword */; + return token === 15 /* OpenBraceToken */ || token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; case 8 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 17 /* TypeParameters */: // Tokens other than '>' are here for better error recovery - return token === 26 /* GreaterThanToken */ || token === 16 /* OpenParenToken */ || token === 14 /* OpenBraceToken */ || token === 80 /* ExtendsKeyword */ || token === 103 /* ImplementsKeyword */; + return token === 27 /* GreaterThanToken */ || token === 17 /* OpenParenToken */ || token === 15 /* OpenBraceToken */ || token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; case 11 /* ArgumentExpressions */: // Tokens other than ')' are here for better error recovery - return token === 17 /* CloseParenToken */ || token === 22 /* SemicolonToken */; + return token === 18 /* CloseParenToken */ || token === 23 /* SemicolonToken */; case 15 /* ArrayLiteralMembers */: case 19 /* TupleElementTypes */: case 10 /* ArrayBindingElements */: - return token === 19 /* CloseBracketToken */; + return token === 20 /* CloseBracketToken */; case 16 /* Parameters */: // Tokens other than ')' and ']' (the latter for index signatures) are here for better error recovery - return token === 17 /* CloseParenToken */ || token === 19 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/; + return token === 18 /* CloseParenToken */ || token === 20 /* CloseBracketToken */ /*|| token === SyntaxKind.OpenBraceToken*/; case 18 /* TypeArguments */: // Tokens other than '>' are here for better error recovery - return token === 26 /* GreaterThanToken */ || token === 16 /* OpenParenToken */; + return token === 27 /* GreaterThanToken */ || token === 17 /* OpenParenToken */; case 20 /* HeritageClauses */: - return token === 14 /* OpenBraceToken */ || token === 15 /* CloseBraceToken */; + return token === 15 /* OpenBraceToken */ || token === 16 /* CloseBraceToken */; case 13 /* JsxAttributes */: - return token === 26 /* GreaterThanToken */ || token === 37 /* SlashToken */; + return token === 27 /* GreaterThanToken */ || token === 38 /* SlashToken */; case 14 /* JsxChildren */: - return token === 24 /* LessThanToken */ && lookAhead(nextTokenIsSlash); + return token === 25 /* LessThanToken */ && lookAhead(nextTokenIsSlash); case 22 /* JSDocFunctionParameters */: - return token === 17 /* CloseParenToken */ || token === 52 /* ColonToken */ || token === 15 /* CloseBraceToken */; + return token === 18 /* CloseParenToken */ || token === 53 /* ColonToken */ || token === 16 /* CloseBraceToken */; case 23 /* JSDocTypeArguments */: - return token === 26 /* GreaterThanToken */ || token === 15 /* CloseBraceToken */; + return token === 27 /* GreaterThanToken */ || token === 16 /* CloseBraceToken */; case 25 /* JSDocTupleTypes */: - return token === 19 /* CloseBracketToken */ || token === 15 /* CloseBraceToken */; + return token === 20 /* CloseBracketToken */ || token === 16 /* CloseBraceToken */; case 24 /* JSDocRecordMembers */: - return token === 15 /* CloseBraceToken */; + return token === 16 /* CloseBraceToken */; } } function isVariableDeclaratorListTerminator() { @@ -8221,7 +8359,7 @@ var ts; // For better error recovery, if we see an '=>' then we just stop immediately. We've got an // arrow function here and it's going to be very unlikely that we'll resynchronize and get // another variable declaration. - if (token === 33 /* EqualsGreaterThanToken */) { + if (token === 34 /* EqualsGreaterThanToken */) { return true; } // Keep trying to parse out variable declarators. @@ -8231,7 +8369,7 @@ var ts; function isInSomeParsingContext() { for (var kind = 0; kind < 26 /* Count */; kind++) { if (parsingContext & (1 << kind)) { - if (isListElement(kind, true) || isListTerminator(kind)) { + if (isListElement(kind, /* inErrorRecovery */ true) || isListTerminator(kind)) { return true; } } @@ -8245,7 +8383,7 @@ var ts; var result = []; result.pos = getNodePos(); while (!isListTerminator(kind)) { - if (isListElement(kind, false)) { + if (isListElement(kind, /* inErrorRecovery */ false)) { var element = parseListElement(kind, parseElement); result.push(element); continue; @@ -8385,20 +8523,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 141 /* Constructor */: - case 146 /* IndexSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 138 /* PropertyDeclaration */: - case 188 /* SemicolonClassElement */: + case 142 /* Constructor */: + case 147 /* IndexSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 189 /* SemicolonClassElement */: return true; - case 140 /* MethodDeclaration */: + case 141 /* MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; - var nameIsConstructor = methodDeclaration.name.kind === 66 /* Identifier */ && - methodDeclaration.name.originalKeywordKind === 118 /* ConstructorKeyword */; + var nameIsConstructor = methodDeclaration.name.kind === 67 /* Identifier */ && + methodDeclaration.name.originalKeywordKind === 119 /* ConstructorKeyword */; return !nameIsConstructor; } } @@ -8407,8 +8545,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 238 /* CaseClause */: - case 239 /* DefaultClause */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: return true; } } @@ -8417,58 +8555,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 210 /* FunctionDeclaration */: - case 190 /* VariableStatement */: - case 189 /* Block */: - case 193 /* IfStatement */: - case 192 /* ExpressionStatement */: - case 205 /* ThrowStatement */: - case 201 /* ReturnStatement */: - case 203 /* SwitchStatement */: - case 200 /* BreakStatement */: - case 199 /* ContinueStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 196 /* ForStatement */: - case 195 /* WhileStatement */: - case 202 /* WithStatement */: - case 191 /* EmptyStatement */: - case 206 /* TryStatement */: - case 204 /* LabeledStatement */: - case 194 /* DoStatement */: - case 207 /* DebuggerStatement */: - case 219 /* ImportDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 225 /* ExportDeclaration */: - case 224 /* ExportAssignment */: - case 215 /* ModuleDeclaration */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 213 /* TypeAliasDeclaration */: + case 211 /* FunctionDeclaration */: + case 191 /* VariableStatement */: + case 190 /* Block */: + case 194 /* IfStatement */: + case 193 /* ExpressionStatement */: + case 206 /* ThrowStatement */: + case 202 /* ReturnStatement */: + case 204 /* SwitchStatement */: + case 201 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 197 /* ForStatement */: + case 196 /* WhileStatement */: + case 203 /* WithStatement */: + case 192 /* EmptyStatement */: + case 207 /* TryStatement */: + case 205 /* LabeledStatement */: + case 195 /* DoStatement */: + case 208 /* DebuggerStatement */: + case 220 /* ImportDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 226 /* ExportDeclaration */: + case 225 /* ExportAssignment */: + case 216 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 214 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 244 /* EnumMember */; + return node.kind === 245 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 145 /* ConstructSignature */: - case 139 /* MethodSignature */: - case 146 /* IndexSignature */: - case 137 /* PropertySignature */: - case 144 /* CallSignature */: + case 146 /* ConstructSignature */: + case 140 /* MethodSignature */: + case 147 /* IndexSignature */: + case 138 /* PropertySignature */: + case 145 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 208 /* VariableDeclaration */) { + if (node.kind !== 209 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -8489,7 +8627,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 135 /* Parameter */) { + if (node.kind !== 136 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -8544,10 +8682,10 @@ var ts; result.pos = getNodePos(); var commaStart = -1; // Meaning the previous token was not a comma while (true) { - if (isListElement(kind, false)) { + if (isListElement(kind, /* inErrorRecovery */ false)) { result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); - if (parseOptional(23 /* CommaToken */)) { + if (parseOptional(24 /* CommaToken */)) { continue; } commaStart = -1; // Back to the state where the last token was not a comma @@ -8556,13 +8694,13 @@ var ts; } // We didn't get a comma, and the list wasn't terminated, explicitly parse // out a comma so we give a good error message. - parseExpected(23 /* CommaToken */); + parseExpected(24 /* CommaToken */); // If the token was a semicolon, and the caller allows that, then skip it and // continue. This ensures we get back on track and don't result in tons of // parse errors. For example, this can happen when people do things like use // a semicolon to delimit object literal members. Note: we'll have already // reported an error when we called parseExpected above. - if (considerSemicolonAsDelimeter && token === 22 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { + if (considerSemicolonAsDelimeter && token === 23 /* SemicolonToken */ && !scanner.hasPrecedingLineBreak()) { nextToken(); } continue; @@ -8605,8 +8743,8 @@ var ts; // The allowReservedWords parameter controls whether reserved words are permitted after the first dot function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); - while (parseOptional(20 /* DotToken */)) { - var node = createNode(132 /* QualifiedName */, entity.pos); + while (parseOptional(21 /* DotToken */)) { + var node = createNode(133 /* QualifiedName */, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -8639,34 +8777,34 @@ var ts; // Report that we need an identifier. However, report it right after the dot, // and not on the next token. This is because the next token might actually // be an identifier and the error would be quite confusing. - return createMissingNode(66 /* Identifier */, true, ts.Diagnostics.Identifier_expected); + return createMissingNode(67 /* Identifier */, /*reportAtCurrentToken*/ true, ts.Diagnostics.Identifier_expected); } } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(180 /* TemplateExpression */); + var template = createNode(181 /* TemplateExpression */); template.head = parseLiteralNode(); - ts.Debug.assert(template.head.kind === 11 /* TemplateHead */, "Template head has wrong token kind"); + ts.Debug.assert(template.head.kind === 12 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; templateSpans.pos = getNodePos(); do { templateSpans.push(parseTemplateSpan()); - } while (ts.lastOrUndefined(templateSpans).literal.kind === 12 /* TemplateMiddle */); + } while (ts.lastOrUndefined(templateSpans).literal.kind === 13 /* TemplateMiddle */); templateSpans.end = getNodeEnd(); template.templateSpans = templateSpans; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(187 /* TemplateSpan */); + var span = createNode(188 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; - if (token === 15 /* CloseBraceToken */) { + if (token === 16 /* CloseBraceToken */) { reScanTemplateToken(); literal = parseLiteralNode(); } else { - literal = parseExpectedToken(13 /* TemplateTail */, false, ts.Diagnostics._0_expected, ts.tokenToString(15 /* CloseBraceToken */)); + literal = parseExpectedToken(14 /* TemplateTail */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(16 /* CloseBraceToken */)); } span.literal = literal; return finishNode(span); @@ -8690,7 +8828,7 @@ var ts; // never get a token like this. Instead, we would get 00 and 9 as two separate tokens. // We also do not need to check for negatives because any prefix operator would be part of a // parent unary expression. - if (node.kind === 7 /* NumericLiteral */ + if (node.kind === 8 /* NumericLiteral */ && sourceText.charCodeAt(tokenPos) === 48 /* _0 */ && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { node.flags |= 65536 /* OctalLiteral */; @@ -8699,31 +8837,31 @@ var ts; } // TYPES function parseTypeReferenceOrTypePredicate() { - var typeName = parseEntityName(false, ts.Diagnostics.Type_expected); - if (typeName.kind === 66 /* Identifier */ && token === 121 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + var typeName = parseEntityName(/*allowReservedWords*/ false, ts.Diagnostics.Type_expected); + if (typeName.kind === 67 /* Identifier */ && token === 122 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); - var node_1 = createNode(147 /* TypePredicate */, typeName.pos); + var node_1 = createNode(148 /* TypePredicate */, typeName.pos); node_1.parameterName = typeName; node_1.type = parseType(); return finishNode(node_1); } - var node = createNode(148 /* TypeReference */, typeName.pos); + var node = createNode(149 /* TypeReference */, typeName.pos); node.typeName = typeName; - if (!scanner.hasPrecedingLineBreak() && token === 24 /* LessThanToken */) { - node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 24 /* LessThanToken */, 26 /* GreaterThanToken */); + if (!scanner.hasPrecedingLineBreak() && token === 25 /* LessThanToken */) { + node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); } return finishNode(node); } function parseTypeQuery() { - var node = createNode(151 /* TypeQuery */); - parseExpected(98 /* TypeOfKeyword */); - node.exprName = parseEntityName(true); + var node = createNode(152 /* TypeQuery */); + parseExpected(99 /* TypeOfKeyword */); + node.exprName = parseEntityName(/*allowReservedWords*/ true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(134 /* TypeParameter */); + var node = createNode(135 /* TypeParameter */); node.name = parseIdentifier(); - if (parseOptional(80 /* ExtendsKeyword */)) { + if (parseOptional(81 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the // user writes a constraint that is an expression and not an actual type, then parse // it out as an expression (so we can recover well), but report that a type is needed @@ -8745,20 +8883,20 @@ var ts; return finishNode(node); } function parseTypeParameters() { - if (token === 24 /* LessThanToken */) { - return parseBracketedList(17 /* TypeParameters */, parseTypeParameter, 24 /* LessThanToken */, 26 /* GreaterThanToken */); + if (token === 25 /* LessThanToken */) { + return parseBracketedList(17 /* TypeParameters */, parseTypeParameter, 25 /* LessThanToken */, 27 /* GreaterThanToken */); } } function parseParameterType() { - if (parseOptional(52 /* ColonToken */)) { - return token === 8 /* StringLiteral */ - ? parseLiteralNode(true) + if (parseOptional(53 /* ColonToken */)) { + return token === 9 /* StringLiteral */ + ? parseLiteralNode(/*internName*/ true) : parseType(); } return undefined; } function isStartOfParameter() { - return token === 21 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 53 /* AtToken */; + return token === 22 /* DotDotDotToken */ || isIdentifierOrPattern() || ts.isModifier(token) || token === 54 /* AtToken */; } function setModifiers(node, modifiers) { if (modifiers) { @@ -8767,10 +8905,10 @@ var ts; } } function parseParameter() { - var node = createNode(135 /* Parameter */); + var node = createNode(136 /* Parameter */); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); - node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); + node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); // FormalParameter [Yield,Await]: // BindingElement[?Yield,?Await] node.name = parseIdentifierOrPattern(); @@ -8785,9 +8923,9 @@ var ts; // to avoid this we'll advance cursor to the next token. nextToken(); } - node.questionToken = parseOptionalToken(51 /* QuestionToken */); + node.questionToken = parseOptionalToken(52 /* QuestionToken */); node.type = parseParameterType(); - node.initializer = parseBindingElementInitializer(true); + node.initializer = parseBindingElementInitializer(/*inParameter*/ true); // Do not check for initializers in an ambient context for parameters. This is not // a grammar error because the grammar allows arbitrary call signatures in // an ambient context. @@ -8802,10 +8940,10 @@ var ts; return inParameter ? parseParameterInitializer() : parseNonParameterInitializer(); } function parseParameterInitializer() { - return parseInitializer(true); + return parseInitializer(/*inParameter*/ true); } function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) { - var returnTokenRequired = returnToken === 33 /* EqualsGreaterThanToken */; + var returnTokenRequired = returnToken === 34 /* EqualsGreaterThanToken */; signature.typeParameters = parseTypeParameters(); signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { @@ -8830,7 +8968,7 @@ var ts; // // SingleNameBinding [Yield,Await]: // BindingIdentifier[?Yield,?Await]Initializer [In, ?Yield,?Await] opt - if (parseExpected(16 /* OpenParenToken */)) { + if (parseExpected(17 /* OpenParenToken */)) { var savedYieldContext = inYieldContext(); var savedAwaitContext = inAwaitContext(); setYieldContext(yieldContext); @@ -8838,7 +8976,7 @@ var ts; var result = parseDelimitedList(16 /* Parameters */, parseParameter); setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); - if (!parseExpected(17 /* CloseParenToken */) && requireCompleteParameterList) { + if (!parseExpected(18 /* CloseParenToken */) && requireCompleteParameterList) { // Caller insisted that we had to end with a ) We didn't. So just return // undefined here. return undefined; @@ -8853,7 +8991,7 @@ var ts; function parseTypeMemberSemicolon() { // We allow type members to be separated by commas or (possibly ASI) semicolons. // First check if it was a comma. If so, we're done with the member. - if (parseOptional(23 /* CommaToken */)) { + if (parseOptional(24 /* CommaToken */)) { return; } // Didn't have a comma. We must have a (possible ASI) semicolon. @@ -8861,15 +8999,15 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 145 /* ConstructSignature */) { - parseExpected(89 /* NewKeyword */); + if (kind === 146 /* ConstructSignature */) { + parseExpected(90 /* NewKeyword */); } - fillSignature(52 /* ColonToken */, false, false, false, node); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); parseTypeMemberSemicolon(); return finishNode(node); } function isIndexSignature() { - if (token !== 18 /* OpenBracketToken */) { + if (token !== 19 /* OpenBracketToken */) { return false; } return lookAhead(isUnambiguouslyIndexSignature); @@ -8892,7 +9030,7 @@ var ts; // [] // nextToken(); - if (token === 21 /* DotDotDotToken */ || token === 19 /* CloseBracketToken */) { + if (token === 22 /* DotDotDotToken */ || token === 20 /* CloseBracketToken */) { return true; } if (ts.isModifier(token)) { @@ -8911,24 +9049,24 @@ var ts; // A colon signifies a well formed indexer // A comma should be a badly formed indexer because comma expressions are not allowed // in computed properties. - if (token === 52 /* ColonToken */ || token === 23 /* CommaToken */) { + if (token === 53 /* ColonToken */ || token === 24 /* CommaToken */) { return true; } // Question mark could be an indexer with an optional property, // or it could be a conditional expression in a computed property. - if (token !== 51 /* QuestionToken */) { + if (token !== 52 /* QuestionToken */) { return false; } // If any of the following tokens are after the question mark, it cannot // be a conditional expression, so treat it as an indexer. nextToken(); - return token === 52 /* ColonToken */ || token === 23 /* CommaToken */ || token === 19 /* CloseBracketToken */; + return token === 53 /* ColonToken */ || token === 24 /* CommaToken */ || token === 20 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(146 /* IndexSignature */, fullStart); + var node = createNode(147 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); + node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); node.type = parseTypeAnnotation(); parseTypeMemberSemicolon(); return finishNode(node); @@ -8936,19 +9074,19 @@ var ts; function parsePropertyOrMethodSignature() { var fullStart = scanner.getStartPos(); var name = parsePropertyName(); - var questionToken = parseOptionalToken(51 /* QuestionToken */); - if (token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { - var method = createNode(139 /* MethodSignature */, fullStart); + var questionToken = parseOptionalToken(52 /* QuestionToken */); + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { + var method = createNode(140 /* MethodSignature */, fullStart); method.name = name; method.questionToken = questionToken; // Method signatues don't exist in expression contexts. So they have neither // [Yield] nor [Await] - fillSignature(52 /* ColonToken */, false, false, false, method); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, method); parseTypeMemberSemicolon(); return finishNode(method); } else { - var property = createNode(137 /* PropertySignature */, fullStart); + var property = createNode(138 /* PropertySignature */, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -8958,9 +9096,9 @@ var ts; } function isStartOfTypeMember() { switch (token) { - case 16 /* OpenParenToken */: - case 24 /* LessThanToken */: - case 18 /* OpenBracketToken */: + case 17 /* OpenParenToken */: + case 25 /* LessThanToken */: + case 19 /* OpenBracketToken */: return true; default: if (ts.isModifier(token)) { @@ -8980,29 +9118,29 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 /* OpenParenToken */ || - token === 24 /* LessThanToken */ || - token === 51 /* QuestionToken */ || - token === 52 /* ColonToken */ || + return token === 17 /* OpenParenToken */ || + token === 25 /* LessThanToken */ || + token === 52 /* QuestionToken */ || + token === 53 /* ColonToken */ || canParseSemicolon(); } function parseTypeMember() { switch (token) { - case 16 /* OpenParenToken */: - case 24 /* LessThanToken */: - return parseSignatureMember(144 /* CallSignature */); - case 18 /* OpenBracketToken */: + case 17 /* OpenParenToken */: + case 25 /* LessThanToken */: + return parseSignatureMember(145 /* CallSignature */); + case 19 /* OpenBracketToken */: // Indexer or computed property return isIndexSignature() - ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) + ? parseIndexSignatureDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined) : parsePropertyOrMethodSignature(); - case 89 /* NewKeyword */: + case 90 /* NewKeyword */: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(145 /* ConstructSignature */); + return parseSignatureMember(146 /* ConstructSignature */); } // fall through. - case 8 /* StringLiteral */: - case 7 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: return parsePropertyOrMethodSignature(); default: // Index declaration as allowed as a type member. But as per the grammar, @@ -9032,18 +9170,18 @@ var ts; } function isStartOfConstructSignature() { nextToken(); - return token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */; + return token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(152 /* TypeLiteral */); + var node = createNode(153 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseObjectTypeMembers() { var members; - if (parseExpected(14 /* OpenBraceToken */)) { + if (parseExpected(15 /* OpenBraceToken */)) { members = parseList(4 /* TypeMembers */, parseTypeMember); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { members = createMissingList(); @@ -9051,48 +9189,48 @@ var ts; return members; } function parseTupleType() { - var node = createNode(154 /* TupleType */); - node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); + var node = createNode(155 /* TupleType */); + node.elementTypes = parseBracketedList(19 /* TupleElementTypes */, parseType, 19 /* OpenBracketToken */, 20 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(157 /* ParenthesizedType */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(158 /* ParenthesizedType */); + parseExpected(17 /* OpenParenToken */); node.type = parseType(); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 150 /* ConstructorType */) { - parseExpected(89 /* NewKeyword */); + if (kind === 151 /* ConstructorType */) { + parseExpected(90 /* NewKeyword */); } - fillSignature(33 /* EqualsGreaterThanToken */, false, false, false, node); + fillSignature(34 /* EqualsGreaterThanToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); return finishNode(node); } function parseKeywordAndNoDot() { var node = parseTokenNode(); - return token === 20 /* DotToken */ ? undefined : node; + return token === 21 /* DotToken */ ? undefined : node; } function parseNonArrayType() { switch (token) { - case 114 /* AnyKeyword */: - case 127 /* StringKeyword */: - case 125 /* NumberKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: + case 115 /* AnyKeyword */: + case 128 /* StringKeyword */: + case 126 /* NumberKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReferenceOrTypePredicate(); - case 100 /* VoidKeyword */: + case 101 /* VoidKeyword */: return parseTokenNode(); - case 98 /* TypeOfKeyword */: + case 99 /* TypeOfKeyword */: return parseTypeQuery(); - case 14 /* OpenBraceToken */: + case 15 /* OpenBraceToken */: return parseTypeLiteral(); - case 18 /* OpenBracketToken */: + case 19 /* OpenBracketToken */: return parseTupleType(); - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: return parseParenthesizedType(); default: return parseTypeReferenceOrTypePredicate(); @@ -9100,19 +9238,19 @@ var ts; } function isStartOfType() { switch (token) { - case 114 /* AnyKeyword */: - case 127 /* StringKeyword */: - case 125 /* NumberKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: - case 100 /* VoidKeyword */: - case 98 /* TypeOfKeyword */: - case 14 /* OpenBraceToken */: - case 18 /* OpenBracketToken */: - case 24 /* LessThanToken */: - case 89 /* NewKeyword */: + case 115 /* AnyKeyword */: + case 128 /* StringKeyword */: + case 126 /* NumberKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: + case 101 /* VoidKeyword */: + case 99 /* TypeOfKeyword */: + case 15 /* OpenBraceToken */: + case 19 /* OpenBracketToken */: + case 25 /* LessThanToken */: + case 90 /* NewKeyword */: return true; - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: // Only consider '(' the start of a type if followed by ')', '...', an identifier, a modifier, // or something that starts a type. We don't want to consider things like '(1)' a type. return lookAhead(isStartOfParenthesizedOrFunctionType); @@ -9122,13 +9260,13 @@ var ts; } function isStartOfParenthesizedOrFunctionType() { nextToken(); - return token === 17 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); + return token === 18 /* CloseParenToken */ || isStartOfParameter() || isStartOfType(); } function parseArrayTypeOrHigher() { var type = parseNonArrayType(); - while (!scanner.hasPrecedingLineBreak() && parseOptional(18 /* OpenBracketToken */)) { - parseExpected(19 /* CloseBracketToken */); - var node = createNode(153 /* ArrayType */, type.pos); + while (!scanner.hasPrecedingLineBreak() && parseOptional(19 /* OpenBracketToken */)) { + parseExpected(20 /* CloseBracketToken */); + var node = createNode(154 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -9150,28 +9288,28 @@ var ts; return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(156 /* IntersectionType */, parseArrayTypeOrHigher, 44 /* AmpersandToken */); + return parseUnionOrIntersectionType(157 /* IntersectionType */, parseArrayTypeOrHigher, 45 /* AmpersandToken */); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(155 /* UnionType */, parseIntersectionTypeOrHigher, 45 /* BarToken */); + return parseUnionOrIntersectionType(156 /* UnionType */, parseIntersectionTypeOrHigher, 46 /* BarToken */); } function isStartOfFunctionType() { - if (token === 24 /* LessThanToken */) { + if (token === 25 /* LessThanToken */) { return true; } - return token === 16 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); + return token === 17 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType); } function isUnambiguouslyStartOfFunctionType() { nextToken(); - if (token === 17 /* CloseParenToken */ || token === 21 /* DotDotDotToken */) { + if (token === 18 /* CloseParenToken */ || token === 22 /* DotDotDotToken */) { // ( ) // ( ... return true; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 52 /* ColonToken */ || token === 23 /* CommaToken */ || - token === 51 /* QuestionToken */ || token === 54 /* EqualsToken */ || + if (token === 53 /* ColonToken */ || token === 24 /* CommaToken */ || + token === 52 /* QuestionToken */ || token === 55 /* EqualsToken */ || isIdentifier() || ts.isModifier(token)) { // ( id : // ( id , @@ -9180,9 +9318,9 @@ var ts; // ( modifier id return true; } - if (token === 17 /* CloseParenToken */) { + if (token === 18 /* CloseParenToken */) { nextToken(); - if (token === 33 /* EqualsGreaterThanToken */) { + if (token === 34 /* EqualsGreaterThanToken */) { // ( id ) => return true; } @@ -9197,37 +9335,37 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(149 /* FunctionType */); + return parseFunctionOrConstructorType(150 /* FunctionType */); } - if (token === 89 /* NewKeyword */) { - return parseFunctionOrConstructorType(150 /* ConstructorType */); + if (token === 90 /* NewKeyword */) { + return parseFunctionOrConstructorType(151 /* ConstructorType */); } return parseUnionTypeOrHigher(); } function parseTypeAnnotation() { - return parseOptional(52 /* ColonToken */) ? parseType() : undefined; + return parseOptional(53 /* ColonToken */) ? parseType() : undefined; } // EXPRESSIONS function isStartOfLeftHandSideExpression() { switch (token) { - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: - case 90 /* NullKeyword */: - case 96 /* TrueKeyword */: - case 81 /* FalseKeyword */: - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: - case 11 /* TemplateHead */: - case 16 /* OpenParenToken */: - case 18 /* OpenBracketToken */: - case 14 /* OpenBraceToken */: - case 84 /* FunctionKeyword */: - case 70 /* ClassKeyword */: - case 89 /* NewKeyword */: - case 37 /* SlashToken */: - case 58 /* SlashEqualsToken */: - case 66 /* Identifier */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: + case 91 /* NullKeyword */: + case 97 /* TrueKeyword */: + case 82 /* FalseKeyword */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 12 /* TemplateHead */: + case 17 /* OpenParenToken */: + case 19 /* OpenBracketToken */: + case 15 /* OpenBraceToken */: + case 85 /* FunctionKeyword */: + case 71 /* ClassKeyword */: + case 90 /* NewKeyword */: + case 38 /* SlashToken */: + case 59 /* SlashEqualsToken */: + case 67 /* Identifier */: return true; default: return isIdentifier(); @@ -9238,18 +9376,18 @@ var ts; return true; } switch (token) { - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 48 /* TildeToken */: - case 47 /* ExclamationToken */: - case 75 /* DeleteKeyword */: - case 98 /* TypeOfKeyword */: - case 100 /* VoidKeyword */: - case 39 /* PlusPlusToken */: - case 40 /* MinusMinusToken */: - case 24 /* LessThanToken */: - case 116 /* AwaitKeyword */: - case 111 /* YieldKeyword */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 49 /* TildeToken */: + case 48 /* ExclamationToken */: + case 76 /* DeleteKeyword */: + case 99 /* TypeOfKeyword */: + case 101 /* VoidKeyword */: + case 40 /* PlusPlusToken */: + case 41 /* MinusMinusToken */: + case 25 /* LessThanToken */: + case 117 /* AwaitKeyword */: + case 112 /* YieldKeyword */: // Yield/await always starts an expression. Either it is an identifier (in which case // it is definitely an expression). Or it's a keyword (either because we're in // a generator or async function, or in strict mode (or both)) and it started a yield or await expression. @@ -9267,10 +9405,10 @@ var ts; } function isStartOfExpressionStatement() { // As per the grammar, none of '{' or 'function' or 'class' can start an expression statement. - return token !== 14 /* OpenBraceToken */ && - token !== 84 /* FunctionKeyword */ && - token !== 70 /* ClassKeyword */ && - token !== 53 /* AtToken */ && + return token !== 15 /* OpenBraceToken */ && + token !== 85 /* FunctionKeyword */ && + token !== 71 /* ClassKeyword */ && + token !== 54 /* AtToken */ && isStartOfExpression(); } function allowInAndParseExpression() { @@ -9287,7 +9425,7 @@ var ts; } var expr = parseAssignmentExpressionOrHigher(); var operatorToken; - while ((operatorToken = parseOptionalToken(23 /* CommaToken */))) { + while ((operatorToken = parseOptionalToken(24 /* CommaToken */))) { expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } if (saveDecoratorContext) { @@ -9296,7 +9434,7 @@ var ts; return expr; } function parseInitializer(inParameter) { - if (token !== 54 /* EqualsToken */) { + if (token !== 55 /* EqualsToken */) { // It's not uncommon during typing for the user to miss writing the '=' token. Check if // there is no newline after the last token and if we're on an expression. If so, parse // this as an equals-value clause with a missing equals. @@ -9305,7 +9443,7 @@ var ts; // it's more likely that a { would be a allowed (as an object literal). While this // is also allowed for parameters, the risk is that we consume the { as an object // literal when it really will be for the block following the parameter. - if (scanner.hasPrecedingLineBreak() || (inParameter && token === 14 /* OpenBraceToken */) || !isStartOfExpression()) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 15 /* OpenBraceToken */) || !isStartOfExpression()) { // preceding line break, open brace in a parameter (likely a function body) or current token is not an expression - // do not try to parse initializer return undefined; @@ -9313,7 +9451,7 @@ var ts; } // Initializer[In, Yield] : // = AssignmentExpression[?In, ?Yield] - parseExpected(54 /* EqualsToken */); + parseExpected(55 /* EqualsToken */); return parseAssignmentExpressionOrHigher(); } function parseAssignmentExpressionOrHigher() { @@ -9347,11 +9485,11 @@ var ts; // Otherwise, we try to parse out the conditional expression bit. We want to allow any // binary expression here, so we pass in the 'lowest' precedence here so that it matches // and consumes anything. - var expr = parseBinaryExpressionOrHigher(0); + var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0); // To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized // parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single // identifier and the current token is an arrow. - if (expr.kind === 66 /* Identifier */ && token === 33 /* EqualsGreaterThanToken */) { + if (expr.kind === 67 /* Identifier */ && token === 34 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression(expr); } // Now see if we might be in cases '2' or '3'. @@ -9367,7 +9505,7 @@ var ts; return parseConditionalExpressionRest(expr); } function isYieldExpression() { - if (token === 111 /* YieldKeyword */) { + if (token === 112 /* YieldKeyword */) { // If we have a 'yield' keyword, and htis is a context where yield expressions are // allowed, then definitely parse out a yield expression. if (inYieldContext()) { @@ -9396,15 +9534,15 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(181 /* YieldExpression */); + var node = createNode(182 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] // yield [no LineTerminator here] * [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] nextToken(); if (!scanner.hasPrecedingLineBreak() && - (token === 36 /* AsteriskToken */ || isStartOfExpression())) { - node.asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + (token === 37 /* AsteriskToken */ || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -9415,16 +9553,16 @@ var ts; } } function parseSimpleArrowFunctionExpression(identifier) { - ts.Debug.assert(token === 33 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(171 /* ArrowFunction */, identifier.pos); - var parameter = createNode(135 /* Parameter */, identifier.pos); + ts.Debug.assert(token === 34 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(172 /* ArrowFunction */, identifier.pos); + var parameter = createNode(136 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; node.parameters.pos = parameter.pos; node.parameters.end = parameter.end; - node.equalsGreaterThanToken = parseExpectedToken(33 /* EqualsGreaterThanToken */, false, ts.Diagnostics._0_expected, "=>"); - node.body = parseArrowFunctionExpressionBody(false); + node.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, false, ts.Diagnostics._0_expected, "=>"); + node.body = parseArrowFunctionExpressionBody(/*isAsync*/ false); return finishNode(node); } function tryParseParenthesizedArrowFunctionExpression() { @@ -9438,7 +9576,7 @@ var ts; // it out, but don't allow any ambiguity, and return 'undefined' if this could be an // expression instead. var arrowFunction = triState === 1 /* True */ - ? parseParenthesizedArrowFunctionExpressionHead(true) + ? parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); if (!arrowFunction) { // Didn't appear to actually be a parenthesized arrow function. Just bail out. @@ -9448,8 +9586,8 @@ var ts; // If we have an arrow, then try to parse the body. Even if not, try to parse if we // have an opening brace, just in case we're in an error state. var lastToken = token; - arrowFunction.equalsGreaterThanToken = parseExpectedToken(33 /* EqualsGreaterThanToken */, false, ts.Diagnostics._0_expected, "=>"); - arrowFunction.body = (lastToken === 33 /* EqualsGreaterThanToken */ || lastToken === 14 /* OpenBraceToken */) + arrowFunction.equalsGreaterThanToken = parseExpectedToken(34 /* EqualsGreaterThanToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, "=>"); + arrowFunction.body = (lastToken === 34 /* EqualsGreaterThanToken */ || lastToken === 15 /* OpenBraceToken */) ? parseArrowFunctionExpressionBody(isAsync) : parseIdentifier(); return finishNode(arrowFunction); @@ -9459,10 +9597,10 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */ || token === 115 /* AsyncKeyword */) { + if (token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */ || token === 116 /* AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } - if (token === 33 /* EqualsGreaterThanToken */) { + if (token === 34 /* EqualsGreaterThanToken */) { // ERROR RECOVERY TWEAK: // If we see a standalone => try to parse it as an arrow function expression as that's // likely what the user intended to write. @@ -9472,28 +9610,28 @@ var ts; return 0 /* False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token === 115 /* AsyncKeyword */) { + if (token === 116 /* AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* False */; } - if (token !== 16 /* OpenParenToken */ && token !== 24 /* LessThanToken */) { + if (token !== 17 /* OpenParenToken */ && token !== 25 /* LessThanToken */) { return 0 /* False */; } } var first = token; var second = nextToken(); - if (first === 16 /* OpenParenToken */) { - if (second === 17 /* CloseParenToken */) { + if (first === 17 /* OpenParenToken */) { + if (second === 18 /* CloseParenToken */) { // Simple cases: "() =>", "(): ", and "() {". // This is an arrow function with no parameters. // The last one is not actually an arrow function, // but this is probably what the user intended. var third = nextToken(); switch (third) { - case 33 /* EqualsGreaterThanToken */: - case 52 /* ColonToken */: - case 14 /* OpenBraceToken */: + case 34 /* EqualsGreaterThanToken */: + case 53 /* ColonToken */: + case 15 /* OpenBraceToken */: return 1 /* True */; default: return 0 /* False */; @@ -9505,12 +9643,12 @@ var ts; // ({ x }) => { } // ([ x ]) // ({ x }) - if (second === 18 /* OpenBracketToken */ || second === 14 /* OpenBraceToken */) { + if (second === 19 /* OpenBracketToken */ || second === 15 /* OpenBraceToken */) { return 2 /* Unknown */; } // Simple case: "(..." // This is an arrow function with a rest parameter. - if (second === 21 /* DotDotDotToken */) { + if (second === 22 /* DotDotDotToken */) { return 1 /* True */; } // If we had "(" followed by something that's not an identifier, @@ -9523,7 +9661,7 @@ var ts; } // If we have something like "(a:", then we must have a // type-annotated parameter in an arrow function expression. - if (nextToken() === 52 /* ColonToken */) { + if (nextToken() === 53 /* ColonToken */) { return 1 /* True */; } // This *could* be a parenthesized arrow function. @@ -9531,7 +9669,7 @@ var ts; return 2 /* Unknown */; } else { - ts.Debug.assert(first === 24 /* LessThanToken */); + ts.Debug.assert(first === 25 /* LessThanToken */); // If we have "<" not followed by an identifier, // then this definitely is not an arrow function. if (!isIdentifier()) { @@ -9541,17 +9679,17 @@ var ts; if (sourceFile.languageVariant === 1 /* JSX */) { var isArrowFunctionInJsx = lookAhead(function () { var third = nextToken(); - if (third === 80 /* ExtendsKeyword */) { + if (third === 81 /* ExtendsKeyword */) { var fourth = nextToken(); switch (fourth) { - case 54 /* EqualsToken */: - case 26 /* GreaterThanToken */: + case 55 /* EqualsToken */: + case 27 /* GreaterThanToken */: return false; default: return true; } } - else if (third === 23 /* CommaToken */) { + else if (third === 24 /* CommaToken */) { return true; } return false; @@ -9566,10 +9704,10 @@ var ts; } } function parsePossibleParenthesizedArrowFunctionExpressionHead() { - return parseParenthesizedArrowFunctionExpressionHead(false); + return parseParenthesizedArrowFunctionExpressionHead(/*allowAmbiguity*/ false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(171 /* ArrowFunction */); + var node = createNode(172 /* ArrowFunction */); setModifiers(node, parseModifiersForArrowFunction()); var isAsync = !!(node.flags & 512 /* Async */); // Arrow functions are never generators. @@ -9579,7 +9717,7 @@ var ts; // a => (b => c) // And think that "(b =>" was actually a parenthesized arrow function with a missing // close paren. - fillSignature(52 /* ColonToken */, false, isAsync, !allowAmbiguity, node); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ !allowAmbiguity, node); // If we couldn't get parameters, we definitely could not parse out an arrow function. if (!node.parameters) { return undefined; @@ -9592,19 +9730,19 @@ var ts; // - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation. // // So we need just a bit of lookahead to ensure that it can only be a signature. - if (!allowAmbiguity && token !== 33 /* EqualsGreaterThanToken */ && token !== 14 /* OpenBraceToken */) { + if (!allowAmbiguity && token !== 34 /* EqualsGreaterThanToken */ && token !== 15 /* OpenBraceToken */) { // Returning undefined here will cause our caller to rewind to where we started from. return undefined; } return node; } function parseArrowFunctionExpressionBody(isAsync) { - if (token === 14 /* OpenBraceToken */) { - return parseFunctionBlock(false, isAsync, false); + if (token === 15 /* OpenBraceToken */) { + return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); } - if (token !== 22 /* SemicolonToken */ && - token !== 84 /* FunctionKeyword */ && - token !== 70 /* ClassKeyword */ && + if (token !== 23 /* SemicolonToken */ && + token !== 85 /* FunctionKeyword */ && + token !== 71 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) { // Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations) @@ -9621,7 +9759,7 @@ var ts; // up preemptively closing the containing construct. // // Note: even when 'ignoreMissingOpenBrace' is passed as true, parseBody will still error. - return parseFunctionBlock(false, isAsync, true); + return parseFunctionBlock(/*allowYield*/ false, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ true); } return isAsync ? doInAwaitContext(parseAssignmentExpressionOrHigher) @@ -9629,17 +9767,17 @@ var ts; } function parseConditionalExpressionRest(leftOperand) { // Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher. - var questionToken = parseOptionalToken(51 /* QuestionToken */); + var questionToken = parseOptionalToken(52 /* QuestionToken */); if (!questionToken) { return leftOperand; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(179 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(180 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); - node.colonToken = parseExpectedToken(52 /* ColonToken */, false, ts.Diagnostics._0_expected, ts.tokenToString(52 /* ColonToken */)); + node.colonToken = parseExpectedToken(53 /* ColonToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(53 /* ColonToken */)); node.whenFalse = parseAssignmentExpressionOrHigher(); return finishNode(node); } @@ -9648,7 +9786,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 87 /* InKeyword */ || t === 131 /* OfKeyword */; + return t === 88 /* InKeyword */ || t === 132 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -9660,10 +9798,10 @@ var ts; if (newPrecedence <= precedence) { break; } - if (token === 87 /* InKeyword */ && inDisallowInContext()) { + if (token === 88 /* InKeyword */ && inDisallowInContext()) { break; } - if (token === 113 /* AsKeyword */) { + if (token === 114 /* AsKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -9684,46 +9822,46 @@ var ts; return leftOperand; } function isBinaryOperator() { - if (inDisallowInContext() && token === 87 /* InKeyword */) { + if (inDisallowInContext() && token === 88 /* InKeyword */) { return false; } return getBinaryOperatorPrecedence() > 0; } function getBinaryOperatorPrecedence() { switch (token) { - case 50 /* BarBarToken */: + case 51 /* BarBarToken */: return 1; - case 49 /* AmpersandAmpersandToken */: + case 50 /* AmpersandAmpersandToken */: return 2; - case 45 /* BarToken */: + case 46 /* BarToken */: return 3; - case 46 /* CaretToken */: + case 47 /* CaretToken */: return 4; - case 44 /* AmpersandToken */: + case 45 /* AmpersandToken */: return 5; - case 29 /* EqualsEqualsToken */: - case 30 /* ExclamationEqualsToken */: - case 31 /* EqualsEqualsEqualsToken */: - case 32 /* ExclamationEqualsEqualsToken */: + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: return 6; - case 24 /* LessThanToken */: - case 26 /* GreaterThanToken */: - case 27 /* LessThanEqualsToken */: - case 28 /* GreaterThanEqualsToken */: - case 88 /* InstanceOfKeyword */: - case 87 /* InKeyword */: - case 113 /* AsKeyword */: + case 25 /* LessThanToken */: + case 27 /* GreaterThanToken */: + case 28 /* LessThanEqualsToken */: + case 29 /* GreaterThanEqualsToken */: + case 89 /* InstanceOfKeyword */: + case 88 /* InKeyword */: + case 114 /* AsKeyword */: return 7; - case 41 /* LessThanLessThanToken */: - case 42 /* GreaterThanGreaterThanToken */: - case 43 /* GreaterThanGreaterThanGreaterThanToken */: + case 42 /* LessThanLessThanToken */: + case 43 /* GreaterThanGreaterThanToken */: + case 44 /* GreaterThanGreaterThanGreaterThanToken */: return 8; - case 34 /* PlusToken */: - case 35 /* MinusToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: return 9; - case 36 /* AsteriskToken */: - case 37 /* SlashToken */: - case 38 /* PercentToken */: + case 37 /* AsteriskToken */: + case 38 /* SlashToken */: + case 39 /* PercentToken */: return 10; } // -1 is lower than all other precedences. Returning it will cause binary expression @@ -9731,45 +9869,45 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(178 /* BinaryExpression */, left.pos); + var node = createNode(179 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function makeAsExpression(left, right) { - var node = createNode(186 /* AsExpression */, left.pos); + var node = createNode(187 /* AsExpression */, left.pos); node.expression = left; node.type = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(176 /* PrefixUnaryExpression */); + var node = createNode(177 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(172 /* DeleteExpression */); + var node = createNode(173 /* DeleteExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(173 /* TypeOfExpression */); + var node = createNode(174 /* TypeOfExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(174 /* VoidExpression */); + var node = createNode(175 /* VoidExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function isAwaitExpression() { - if (token === 116 /* AwaitKeyword */) { + if (token === 117 /* AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -9779,7 +9917,7 @@ var ts; return false; } function parseAwaitExpression() { - var node = createNode(175 /* AwaitExpression */); + var node = createNode(176 /* AwaitExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -9789,25 +9927,25 @@ var ts; return parseAwaitExpression(); } switch (token) { - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 48 /* TildeToken */: - case 47 /* ExclamationToken */: - case 39 /* PlusPlusToken */: - case 40 /* MinusMinusToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 49 /* TildeToken */: + case 48 /* ExclamationToken */: + case 40 /* PlusPlusToken */: + case 41 /* MinusMinusToken */: return parsePrefixUnaryExpression(); - case 75 /* DeleteKeyword */: + case 76 /* DeleteKeyword */: return parseDeleteExpression(); - case 98 /* TypeOfKeyword */: + case 99 /* TypeOfKeyword */: return parseTypeOfExpression(); - case 100 /* VoidKeyword */: + case 101 /* VoidKeyword */: return parseVoidExpression(); - case 24 /* LessThanToken */: + case 25 /* LessThanToken */: if (sourceFile.languageVariant !== 1 /* JSX */) { return parseTypeAssertion(); } if (lookAhead(nextTokenIsIdentifierOrKeyword)) { - return parseJsxElementOrSelfClosingElement(); + return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ true); } // Fall through default: @@ -9817,8 +9955,8 @@ var ts; function parsePostfixExpressionOrHigher() { var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); - if ((token === 39 /* PlusPlusToken */ || token === 40 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(177 /* PostfixUnaryExpression */, expression.pos); + if ((token === 40 /* PlusPlusToken */ || token === 41 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(178 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -9857,7 +9995,7 @@ var ts; // the last two CallExpression productions. Or we have a MemberExpression which either // completes the LeftHandSideExpression, or starts the beginning of the first four // CallExpression productions. - var expression = token === 92 /* SuperKeyword */ + var expression = token === 93 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); // Now, we *may* be complete. However, we might have consumed the start of a @@ -9917,47 +10055,47 @@ var ts; } function parseSuperExpression() { var expression = parseTokenNode(); - if (token === 16 /* OpenParenToken */ || token === 20 /* DotToken */) { + if (token === 17 /* OpenParenToken */ || token === 21 /* DotToken */ || token === 19 /* OpenBracketToken */) { return expression; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(163 /* PropertyAccessExpression */, expression.pos); + var node = createNode(164 /* PropertyAccessExpression */, expression.pos); node.expression = expression; - node.dotToken = parseExpectedToken(20 /* DotToken */, false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); - node.name = parseRightSideOfDot(true); + node.dotToken = parseExpectedToken(21 /* DotToken */, /*reportAtCurrentPosition*/ false, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); return finishNode(node); } - function parseJsxElementOrSelfClosingElement() { - var opening = parseJsxOpeningOrSelfClosingElement(); - if (opening.kind === 232 /* JsxOpeningElement */) { - var node = createNode(230 /* JsxElement */, opening.pos); + function parseJsxElementOrSelfClosingElement(inExpressionContext) { + var opening = parseJsxOpeningOrSelfClosingElement(inExpressionContext); + if (opening.kind === 233 /* JsxOpeningElement */) { + var node = createNode(231 /* JsxElement */, opening.pos); node.openingElement = opening; node.children = parseJsxChildren(node.openingElement.tagName); - node.closingElement = parseJsxClosingElement(); + node.closingElement = parseJsxClosingElement(inExpressionContext); return finishNode(node); } else { - ts.Debug.assert(opening.kind === 231 /* JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 232 /* JsxSelfClosingElement */); // Nothing else to do for self-closing elements return opening; } } function parseJsxText() { - var node = createNode(233 /* JsxText */, scanner.getStartPos()); + var node = createNode(234 /* JsxText */, scanner.getStartPos()); token = scanner.scanJsxToken(); return finishNode(node); } function parseJsxChild() { switch (token) { - case 233 /* JsxText */: + case 234 /* JsxText */: return parseJsxText(); - case 14 /* OpenBraceToken */: - return parseJsxExpression(); - case 24 /* LessThanToken */: - return parseJsxElementOrSelfClosingElement(); + case 15 /* OpenBraceToken */: + return parseJsxExpression(/*inExpressionContext*/ false); + case 25 /* LessThanToken */: + return parseJsxElementOrSelfClosingElement(/*inExpressionContext*/ false); } - ts.Debug.fail('Unknown JSX child kind ' + token); + ts.Debug.fail("Unknown JSX child kind " + token); } function parseJsxChildren(openingTagName) { var result = []; @@ -9966,7 +10104,7 @@ var ts; parsingContext |= 1 << 14 /* JsxChildren */; while (true) { token = scanner.reScanJsxToken(); - if (token === 25 /* LessThanSlashToken */) { + if (token === 26 /* LessThanSlashToken */) { break; } else if (token === 1 /* EndOfFileToken */) { @@ -9979,19 +10117,29 @@ var ts; parsingContext = saveParsingContext; return result; } - function parseJsxOpeningOrSelfClosingElement() { + function parseJsxOpeningOrSelfClosingElement(inExpressionContext) { var fullStart = scanner.getStartPos(); - parseExpected(24 /* LessThanToken */); + parseExpected(25 /* LessThanToken */); var tagName = parseJsxElementName(); var attributes = parseList(13 /* JsxAttributes */, parseJsxAttribute); var node; - if (parseOptional(26 /* GreaterThanToken */)) { - node = createNode(232 /* JsxOpeningElement */, fullStart); + if (token === 27 /* GreaterThanToken */) { + // Closing tag, so scan the immediately-following text with the JSX scanning instead + // of regular scanning to avoid treating illegal characters (e.g. '#') as immediate + // scanning errors + node = createNode(233 /* JsxOpeningElement */, fullStart); + scanJsxText(); } else { - parseExpected(37 /* SlashToken */); - parseExpected(26 /* GreaterThanToken */); - node = createNode(231 /* JsxSelfClosingElement */, fullStart); + parseExpected(38 /* SlashToken */); + if (inExpressionContext) { + parseExpected(27 /* GreaterThanToken */); + } + else { + parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); + scanJsxText(); + } + node = createNode(232 /* JsxSelfClosingElement */, fullStart); } node.tagName = tagName; node.attributes = attributes; @@ -10000,98 +10148,110 @@ var ts; function parseJsxElementName() { scanJsxIdentifier(); var elementName = parseIdentifierName(); - while (parseOptional(20 /* DotToken */)) { + while (parseOptional(21 /* DotToken */)) { scanJsxIdentifier(); - var node = createNode(132 /* QualifiedName */, elementName.pos); + var node = createNode(133 /* QualifiedName */, elementName.pos); node.left = elementName; node.right = parseIdentifierName(); elementName = finishNode(node); } return elementName; } - function parseJsxExpression() { - var node = createNode(237 /* JsxExpression */); - parseExpected(14 /* OpenBraceToken */); - if (token !== 15 /* CloseBraceToken */) { + function parseJsxExpression(inExpressionContext) { + var node = createNode(238 /* JsxExpression */); + parseExpected(15 /* OpenBraceToken */); + if (token !== 16 /* CloseBraceToken */) { node.expression = parseExpression(); } - parseExpected(15 /* CloseBraceToken */); + if (inExpressionContext) { + parseExpected(16 /* CloseBraceToken */); + } + else { + parseExpected(16 /* CloseBraceToken */, /*message*/ undefined, /*advance*/ false); + scanJsxText(); + } return finishNode(node); } function parseJsxAttribute() { - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { return parseJsxSpreadAttribute(); } scanJsxIdentifier(); - var node = createNode(235 /* JsxAttribute */); + var node = createNode(236 /* JsxAttribute */); node.name = parseIdentifierName(); - if (parseOptional(54 /* EqualsToken */)) { + if (parseOptional(55 /* EqualsToken */)) { switch (token) { - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: node.initializer = parseLiteralNode(); break; default: - node.initializer = parseJsxExpression(); + node.initializer = parseJsxExpression(/*inExpressionContext*/ true); break; } } return finishNode(node); } function parseJsxSpreadAttribute() { - var node = createNode(236 /* JsxSpreadAttribute */); - parseExpected(14 /* OpenBraceToken */); - parseExpected(21 /* DotDotDotToken */); + var node = createNode(237 /* JsxSpreadAttribute */); + parseExpected(15 /* OpenBraceToken */); + parseExpected(22 /* DotDotDotToken */); node.expression = parseExpression(); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); return finishNode(node); } - function parseJsxClosingElement() { - var node = createNode(234 /* JsxClosingElement */); - parseExpected(25 /* LessThanSlashToken */); + function parseJsxClosingElement(inExpressionContext) { + var node = createNode(235 /* JsxClosingElement */); + parseExpected(26 /* LessThanSlashToken */); node.tagName = parseJsxElementName(); - parseExpected(26 /* GreaterThanToken */); + if (inExpressionContext) { + parseExpected(27 /* GreaterThanToken */); + } + else { + parseExpected(27 /* GreaterThanToken */, /*diagnostic*/ undefined, /*advance*/ false); + scanJsxText(); + } return finishNode(node); } function parseTypeAssertion() { - var node = createNode(168 /* TypeAssertionExpression */); - parseExpected(24 /* LessThanToken */); + var node = createNode(169 /* TypeAssertionExpression */); + parseExpected(25 /* LessThanToken */); node.type = parseType(); - parseExpected(26 /* GreaterThanToken */); + parseExpected(27 /* GreaterThanToken */); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseMemberExpressionRest(expression) { while (true) { - var dotToken = parseOptionalToken(20 /* DotToken */); + var dotToken = parseOptionalToken(21 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(163 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(164 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; - propertyAccess.name = parseRightSideOfDot(true); + propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true); expression = finishNode(propertyAccess); continue; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName - if (!inDecoratorContext() && parseOptional(18 /* OpenBracketToken */)) { - var indexedAccess = createNode(164 /* ElementAccessExpression */, expression.pos); + if (!inDecoratorContext() && parseOptional(19 /* OpenBracketToken */)) { + var indexedAccess = createNode(165 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. - if (token !== 19 /* CloseBracketToken */) { + if (token !== 20 /* CloseBracketToken */) { indexedAccess.argumentExpression = allowInAnd(parseExpression); - if (indexedAccess.argumentExpression.kind === 8 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 7 /* NumericLiteral */) { + if (indexedAccess.argumentExpression.kind === 9 /* StringLiteral */ || indexedAccess.argumentExpression.kind === 8 /* NumericLiteral */) { var literal = indexedAccess.argumentExpression; literal.text = internIdentifier(literal.text); } } - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); expression = finishNode(indexedAccess); continue; } - if (token === 10 /* NoSubstitutionTemplateLiteral */ || token === 11 /* TemplateHead */) { - var tagExpression = createNode(167 /* TaggedTemplateExpression */, expression.pos); + if (token === 11 /* NoSubstitutionTemplateLiteral */ || token === 12 /* TemplateHead */) { + var tagExpression = createNode(168 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; - tagExpression.template = token === 10 /* NoSubstitutionTemplateLiteral */ + tagExpression.template = token === 11 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); @@ -10103,7 +10263,7 @@ var ts; function parseCallExpressionRest(expression) { while (true) { expression = parseMemberExpressionRest(expression); - if (token === 24 /* LessThanToken */) { + if (token === 25 /* LessThanToken */) { // See if this is the start of a generic invocation. If so, consume it and // keep checking for postfix expressions. Otherwise, it's just a '<' that's // part of an arithmetic expression. Break out so we consume it higher in the @@ -10112,15 +10272,15 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(165 /* CallExpression */, expression.pos); + var callExpr = createNode(166 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); continue; } - else if (token === 16 /* OpenParenToken */) { - var callExpr = createNode(165 /* CallExpression */, expression.pos); + else if (token === 17 /* OpenParenToken */) { + var callExpr = createNode(166 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -10130,17 +10290,17 @@ var ts; } } function parseArgumentList() { - parseExpected(16 /* OpenParenToken */); + parseExpected(17 /* OpenParenToken */); var result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return result; } function parseTypeArgumentsInExpression() { - if (!parseOptional(24 /* LessThanToken */)) { + if (!parseOptional(25 /* LessThanToken */)) { return undefined; } var typeArguments = parseDelimitedList(18 /* TypeArguments */, parseType); - if (!parseExpected(26 /* GreaterThanToken */)) { + if (!parseExpected(27 /* GreaterThanToken */)) { // If it doesn't have the closing > then it's definitely not an type argument list. return undefined; } @@ -10152,32 +10312,32 @@ var ts; } function canFollowTypeArgumentsInExpression() { switch (token) { - case 16 /* OpenParenToken */: // foo( + case 17 /* OpenParenToken */: // foo( // this case are the only case where this token can legally follow a type argument // list. So we definitely want to treat this as a type arg list. - case 20 /* DotToken */: // foo. - case 17 /* CloseParenToken */: // foo) - case 19 /* CloseBracketToken */: // foo] - case 52 /* ColonToken */: // foo: - case 22 /* SemicolonToken */: // foo; - case 51 /* QuestionToken */: // foo? - case 29 /* EqualsEqualsToken */: // foo == - case 31 /* EqualsEqualsEqualsToken */: // foo === - case 30 /* ExclamationEqualsToken */: // foo != - case 32 /* ExclamationEqualsEqualsToken */: // foo !== - case 49 /* AmpersandAmpersandToken */: // foo && - case 50 /* BarBarToken */: // foo || - case 46 /* CaretToken */: // foo ^ - case 44 /* AmpersandToken */: // foo & - case 45 /* BarToken */: // foo | - case 15 /* CloseBraceToken */: // foo } + case 21 /* DotToken */: // foo. + case 18 /* CloseParenToken */: // foo) + case 20 /* CloseBracketToken */: // foo] + case 53 /* ColonToken */: // foo: + case 23 /* SemicolonToken */: // foo; + case 52 /* QuestionToken */: // foo? + case 30 /* EqualsEqualsToken */: // foo == + case 32 /* EqualsEqualsEqualsToken */: // foo === + case 31 /* ExclamationEqualsToken */: // foo != + case 33 /* ExclamationEqualsEqualsToken */: // foo !== + case 50 /* AmpersandAmpersandToken */: // foo && + case 51 /* BarBarToken */: // foo || + case 47 /* CaretToken */: // foo ^ + case 45 /* AmpersandToken */: // foo & + case 46 /* BarToken */: // foo | + case 16 /* CloseBraceToken */: // foo } case 1 /* EndOfFileToken */: // these cases can't legally follow a type arg list. However, they're not legal // expressions either. The user is probably in the middle of a generic type. So // treat it as such. return true; - case 23 /* CommaToken */: // foo, - case 14 /* OpenBraceToken */: // foo { + case 24 /* CommaToken */: // foo, + case 15 /* OpenBraceToken */: // foo { // We don't want to treat these as type arguments. Otherwise we'll parse this // as an invocation expression. Instead, we want to parse out the expression // in isolation from the type arguments. @@ -10188,23 +10348,23 @@ var ts; } function parsePrimaryExpression() { switch (token) { - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: return parseLiteralNode(); - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: - case 90 /* NullKeyword */: - case 96 /* TrueKeyword */: - case 81 /* FalseKeyword */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: + case 91 /* NullKeyword */: + case 97 /* TrueKeyword */: + case 82 /* FalseKeyword */: return parseTokenNode(); - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: return parseParenthesizedExpression(); - case 18 /* OpenBracketToken */: + case 19 /* OpenBracketToken */: return parseArrayLiteralExpression(); - case 14 /* OpenBraceToken */: + case 15 /* OpenBraceToken */: return parseObjectLiteralExpression(); - case 115 /* AsyncKeyword */: + case 116 /* AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -10212,59 +10372,59 @@ var ts; break; } return parseFunctionExpression(); - case 70 /* ClassKeyword */: + case 71 /* ClassKeyword */: return parseClassExpression(); - case 84 /* FunctionKeyword */: + case 85 /* FunctionKeyword */: return parseFunctionExpression(); - case 89 /* NewKeyword */: + case 90 /* NewKeyword */: return parseNewExpression(); - case 37 /* SlashToken */: - case 58 /* SlashEqualsToken */: - if (reScanSlashToken() === 9 /* RegularExpressionLiteral */) { + case 38 /* SlashToken */: + case 59 /* SlashEqualsToken */: + if (reScanSlashToken() === 10 /* RegularExpressionLiteral */) { return parseLiteralNode(); } break; - case 11 /* TemplateHead */: + case 12 /* TemplateHead */: return parseTemplateExpression(); } return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(169 /* ParenthesizedExpression */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(170 /* ParenthesizedExpression */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(182 /* SpreadElementExpression */); - parseExpected(21 /* DotDotDotToken */); + var node = createNode(183 /* SpreadElementExpression */); + parseExpected(22 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 /* DotDotDotToken */ ? parseSpreadElement() : - token === 23 /* CommaToken */ ? createNode(184 /* OmittedExpression */) : + return token === 22 /* DotDotDotToken */ ? parseSpreadElement() : + token === 24 /* CommaToken */ ? createNode(185 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(161 /* ArrayLiteralExpression */); - parseExpected(18 /* OpenBracketToken */); + var node = createNode(162 /* ArrayLiteralExpression */); + parseExpected(19 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 2048 /* MultiLine */; node.elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); return finishNode(node); } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { - if (parseContextualModifier(120 /* GetKeyword */)) { - return parseAccessorDeclaration(142 /* GetAccessor */, fullStart, decorators, modifiers); + if (parseContextualModifier(121 /* GetKeyword */)) { + return parseAccessorDeclaration(143 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(126 /* SetKeyword */)) { - return parseAccessorDeclaration(143 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(127 /* SetKeyword */)) { + return parseAccessorDeclaration(144 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -10276,39 +10436,39 @@ var ts; if (accessor) { return accessor; } - var asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + var asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var tokenIsIdentifier = isIdentifier(); var nameToken = token; var propertyName = parsePropertyName(); // Disallowing of optional property assignments happens in the grammar checker. - var questionToken = parseOptionalToken(51 /* QuestionToken */); - if (asteriskToken || token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { + var questionToken = parseOptionalToken(52 /* QuestionToken */); + if (asteriskToken || token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } // Parse to check if it is short-hand property assignment or normal property assignment - if ((token === 23 /* CommaToken */ || token === 15 /* CloseBraceToken */) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(243 /* ShorthandPropertyAssignment */, fullStart); + if ((token === 24 /* CommaToken */ || token === 16 /* CloseBraceToken */) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(244 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(242 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(243 /* PropertyAssignment */, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); return finishNode(propertyAssignment); } } function parseObjectLiteralExpression() { - var node = createNode(162 /* ObjectLiteralExpression */); - parseExpected(14 /* OpenBraceToken */); + var node = createNode(163 /* ObjectLiteralExpression */); + parseExpected(15 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 2048 /* MultiLine */; } - node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, true); - parseExpected(15 /* CloseBraceToken */); + node.properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimeter*/ true); + parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseFunctionExpression() { @@ -10321,10 +10481,10 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(170 /* FunctionExpression */); + var node = createNode(171 /* FunctionExpression */); setModifiers(node, parseModifiers()); - parseExpected(84 /* FunctionKeyword */); - node.asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + parseExpected(85 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512 /* Async */); node.name = @@ -10332,8 +10492,8 @@ var ts; isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(52 /* ColonToken */, isGenerator, isAsync, false, node); - node.body = parseFunctionBlock(isGenerator, isAsync, false); + fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); + node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); if (saveDecoratorContext) { setDecoratorContext(true); } @@ -10343,21 +10503,21 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(166 /* NewExpression */); - parseExpected(89 /* NewKeyword */); + var node = createNode(167 /* NewExpression */); + parseExpected(90 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); - if (node.typeArguments || token === 16 /* OpenParenToken */) { + if (node.typeArguments || token === 17 /* OpenParenToken */) { node.arguments = parseArgumentList(); } return finishNode(node); } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { - var node = createNode(189 /* Block */); - if (parseExpected(14 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { + var node = createNode(190 /* Block */); + if (parseExpected(15 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -10384,84 +10544,84 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(191 /* EmptyStatement */); - parseExpected(22 /* SemicolonToken */); + var node = createNode(192 /* EmptyStatement */); + parseExpected(23 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(193 /* IfStatement */); - parseExpected(85 /* IfKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(194 /* IfStatement */); + parseExpected(86 /* IfKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); node.thenStatement = parseStatement(); - node.elseStatement = parseOptional(77 /* ElseKeyword */) ? parseStatement() : undefined; + node.elseStatement = parseOptional(78 /* ElseKeyword */) ? parseStatement() : undefined; return finishNode(node); } function parseDoStatement() { - var node = createNode(194 /* DoStatement */); - parseExpected(76 /* DoKeyword */); + var node = createNode(195 /* DoStatement */); + parseExpected(77 /* DoKeyword */); node.statement = parseStatement(); - parseExpected(101 /* WhileKeyword */); - parseExpected(16 /* OpenParenToken */); + parseExpected(102 /* WhileKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); // From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html // 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in // spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby // do;while(0)x will have a semicolon inserted before x. - parseOptional(22 /* SemicolonToken */); + parseOptional(23 /* SemicolonToken */); return finishNode(node); } function parseWhileStatement() { - var node = createNode(195 /* WhileStatement */); - parseExpected(101 /* WhileKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(196 /* WhileStatement */); + parseExpected(102 /* WhileKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); node.statement = parseStatement(); return finishNode(node); } function parseForOrForInOrForOfStatement() { var pos = getNodePos(); - parseExpected(83 /* ForKeyword */); - parseExpected(16 /* OpenParenToken */); + parseExpected(84 /* ForKeyword */); + parseExpected(17 /* OpenParenToken */); var initializer = undefined; - if (token !== 22 /* SemicolonToken */) { - if (token === 99 /* VarKeyword */ || token === 105 /* LetKeyword */ || token === 71 /* ConstKeyword */) { - initializer = parseVariableDeclarationList(true); + if (token !== 23 /* SemicolonToken */) { + if (token === 100 /* VarKeyword */ || token === 106 /* LetKeyword */ || token === 72 /* ConstKeyword */) { + initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true); } else { initializer = disallowInAnd(parseExpression); } } var forOrForInOrForOfStatement; - if (parseOptional(87 /* InKeyword */)) { - var forInStatement = createNode(197 /* ForInStatement */, pos); + if (parseOptional(88 /* InKeyword */)) { + var forInStatement = createNode(198 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(131 /* OfKeyword */)) { - var forOfStatement = createNode(198 /* ForOfStatement */, pos); + else if (parseOptional(132 /* OfKeyword */)) { + var forOfStatement = createNode(199 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(196 /* ForStatement */, pos); + var forStatement = createNode(197 /* ForStatement */, pos); forStatement.initializer = initializer; - parseExpected(22 /* SemicolonToken */); - if (token !== 22 /* SemicolonToken */ && token !== 17 /* CloseParenToken */) { + parseExpected(23 /* SemicolonToken */); + if (token !== 23 /* SemicolonToken */ && token !== 18 /* CloseParenToken */) { forStatement.condition = allowInAnd(parseExpression); } - parseExpected(22 /* SemicolonToken */); - if (token !== 17 /* CloseParenToken */) { + parseExpected(23 /* SemicolonToken */); + if (token !== 18 /* CloseParenToken */) { forStatement.incrementor = allowInAnd(parseExpression); } - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); forOrForInOrForOfStatement = forStatement; } forOrForInOrForOfStatement.statement = parseStatement(); @@ -10469,7 +10629,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 200 /* BreakStatement */ ? 67 /* BreakKeyword */ : 72 /* ContinueKeyword */); + parseExpected(kind === 201 /* BreakStatement */ ? 68 /* BreakKeyword */ : 73 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -10477,8 +10637,8 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(201 /* ReturnStatement */); - parseExpected(91 /* ReturnKeyword */); + var node = createNode(202 /* ReturnStatement */); + parseExpected(92 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); } @@ -10486,42 +10646,42 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(202 /* WithStatement */); - parseExpected(102 /* WithKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(203 /* WithStatement */); + parseExpected(103 /* WithKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); node.statement = parseStatement(); return finishNode(node); } function parseCaseClause() { - var node = createNode(238 /* CaseClause */); - parseExpected(68 /* CaseKeyword */); + var node = createNode(239 /* CaseClause */); + parseExpected(69 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseDefaultClause() { - var node = createNode(239 /* DefaultClause */); - parseExpected(74 /* DefaultKeyword */); - parseExpected(52 /* ColonToken */); + var node = createNode(240 /* DefaultClause */); + parseExpected(75 /* DefaultKeyword */); + parseExpected(53 /* ColonToken */); node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(node); } function parseCaseOrDefaultClause() { - return token === 68 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token === 69 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(203 /* SwitchStatement */); - parseExpected(93 /* SwitchKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(204 /* SwitchStatement */); + parseExpected(94 /* SwitchKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); - parseExpected(17 /* CloseParenToken */); - var caseBlock = createNode(217 /* CaseBlock */, scanner.getStartPos()); - parseExpected(14 /* OpenBraceToken */); + parseExpected(18 /* CloseParenToken */); + var caseBlock = createNode(218 /* CaseBlock */, scanner.getStartPos()); + parseExpected(15 /* OpenBraceToken */); caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); node.caseBlock = finishNode(caseBlock); return finishNode(node); } @@ -10533,39 +10693,39 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(205 /* ThrowStatement */); - parseExpected(95 /* ThrowKeyword */); + var node = createNode(206 /* ThrowStatement */); + parseExpected(96 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(206 /* TryStatement */); - parseExpected(97 /* TryKeyword */); - node.tryBlock = parseBlock(false); - node.catchClause = token === 69 /* CatchKeyword */ ? parseCatchClause() : undefined; + var node = createNode(207 /* TryStatement */); + parseExpected(98 /* TryKeyword */); + node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); + node.catchClause = token === 70 /* CatchKeyword */ ? parseCatchClause() : undefined; // If we don't have a catch clause, then we must have a finally clause. Try to parse // one out no matter what. - if (!node.catchClause || token === 82 /* FinallyKeyword */) { - parseExpected(82 /* FinallyKeyword */); - node.finallyBlock = parseBlock(false); + if (!node.catchClause || token === 83 /* FinallyKeyword */) { + parseExpected(83 /* FinallyKeyword */); + node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false); } return finishNode(node); } function parseCatchClause() { - var result = createNode(241 /* CatchClause */); - parseExpected(69 /* CatchKeyword */); - if (parseExpected(16 /* OpenParenToken */)) { + var result = createNode(242 /* CatchClause */); + parseExpected(70 /* CatchKeyword */); + if (parseExpected(17 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); } - parseExpected(17 /* CloseParenToken */); - result.block = parseBlock(false); + parseExpected(18 /* CloseParenToken */); + result.block = parseBlock(/*ignoreMissingOpenBrace*/ false); return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(207 /* DebuggerStatement */); - parseExpected(73 /* DebuggerKeyword */); + var node = createNode(208 /* DebuggerStatement */); + parseExpected(74 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); } @@ -10575,21 +10735,21 @@ var ts; // a colon. var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); - if (expression.kind === 66 /* Identifier */ && parseOptional(52 /* ColonToken */)) { - var labeledStatement = createNode(204 /* LabeledStatement */, fullStart); + if (expression.kind === 67 /* Identifier */ && parseOptional(53 /* ColonToken */)) { + var labeledStatement = createNode(205 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(192 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(193 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); } } function isIdentifierOrKeyword() { - return token >= 66 /* Identifier */; + return token >= 67 /* Identifier */; } function nextTokenIsIdentifierOrKeywordOnSameLine() { nextToken(); @@ -10597,21 +10757,21 @@ var ts; } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token === 84 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); + return token === 85 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { nextToken(); - return (isIdentifierOrKeyword() || token === 7 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak(); + return (isIdentifierOrKeyword() || token === 8 /* NumericLiteral */) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { switch (token) { - case 99 /* VarKeyword */: - case 105 /* LetKeyword */: - case 71 /* ConstKeyword */: - case 84 /* FunctionKeyword */: - case 70 /* ClassKeyword */: - case 78 /* EnumKeyword */: + case 100 /* VarKeyword */: + case 106 /* LetKeyword */: + case 72 /* ConstKeyword */: + case 85 /* FunctionKeyword */: + case 71 /* ClassKeyword */: + case 79 /* EnumKeyword */: return true; // 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers; // however, an identifier cannot be followed by another identifier on the same line. This is what we @@ -10634,36 +10794,36 @@ var ts; // I {} // // could be legal, it would add complexity for very little gain. - case 104 /* InterfaceKeyword */: - case 129 /* TypeKeyword */: + case 105 /* InterfaceKeyword */: + case 130 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 122 /* ModuleKeyword */: - case 123 /* NamespaceKeyword */: + case 123 /* ModuleKeyword */: + case 124 /* NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 115 /* AsyncKeyword */: - case 119 /* DeclareKeyword */: + case 116 /* AsyncKeyword */: + case 120 /* DeclareKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 86 /* ImportKeyword */: + case 87 /* ImportKeyword */: nextToken(); - return token === 8 /* StringLiteral */ || token === 36 /* AsteriskToken */ || - token === 14 /* OpenBraceToken */ || isIdentifierOrKeyword(); - case 79 /* ExportKeyword */: + return token === 9 /* StringLiteral */ || token === 37 /* AsteriskToken */ || + token === 15 /* OpenBraceToken */ || isIdentifierOrKeyword(); + case 80 /* ExportKeyword */: nextToken(); - if (token === 54 /* EqualsToken */ || token === 36 /* AsteriskToken */ || - token === 14 /* OpenBraceToken */ || token === 74 /* DefaultKeyword */) { + if (token === 55 /* EqualsToken */ || token === 37 /* AsteriskToken */ || + token === 15 /* OpenBraceToken */ || token === 75 /* DefaultKeyword */) { return true; } continue; - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 110 /* StaticKeyword */: - case 112 /* AbstractKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 111 /* StaticKeyword */: + case 113 /* AbstractKeyword */: nextToken(); continue; default: @@ -10676,47 +10836,47 @@ var ts; } function isStartOfStatement() { switch (token) { - case 53 /* AtToken */: - case 22 /* SemicolonToken */: - case 14 /* OpenBraceToken */: - case 99 /* VarKeyword */: - case 105 /* LetKeyword */: - case 84 /* FunctionKeyword */: - case 70 /* ClassKeyword */: - case 78 /* EnumKeyword */: - case 85 /* IfKeyword */: - case 76 /* DoKeyword */: - case 101 /* WhileKeyword */: - case 83 /* ForKeyword */: - case 72 /* ContinueKeyword */: - case 67 /* BreakKeyword */: - case 91 /* ReturnKeyword */: - case 102 /* WithKeyword */: - case 93 /* SwitchKeyword */: - case 95 /* ThrowKeyword */: - case 97 /* TryKeyword */: - case 73 /* DebuggerKeyword */: + case 54 /* AtToken */: + case 23 /* SemicolonToken */: + case 15 /* OpenBraceToken */: + case 100 /* VarKeyword */: + case 106 /* LetKeyword */: + case 85 /* FunctionKeyword */: + case 71 /* ClassKeyword */: + case 79 /* EnumKeyword */: + case 86 /* IfKeyword */: + case 77 /* DoKeyword */: + case 102 /* WhileKeyword */: + case 84 /* ForKeyword */: + case 73 /* ContinueKeyword */: + case 68 /* BreakKeyword */: + case 92 /* ReturnKeyword */: + case 103 /* WithKeyword */: + case 94 /* SwitchKeyword */: + case 96 /* ThrowKeyword */: + case 98 /* TryKeyword */: + case 74 /* DebuggerKeyword */: // 'catch' and 'finally' do not actually indicate that the code is part of a statement, // however, we say they are here so that we may gracefully parse them and error later. - case 69 /* CatchKeyword */: - case 82 /* FinallyKeyword */: + case 70 /* CatchKeyword */: + case 83 /* FinallyKeyword */: return true; - case 71 /* ConstKeyword */: - case 79 /* ExportKeyword */: - case 86 /* ImportKeyword */: + case 72 /* ConstKeyword */: + case 80 /* ExportKeyword */: + case 87 /* ImportKeyword */: return isStartOfDeclaration(); - case 115 /* AsyncKeyword */: - case 119 /* DeclareKeyword */: - case 104 /* InterfaceKeyword */: - case 122 /* ModuleKeyword */: - case 123 /* NamespaceKeyword */: - case 129 /* TypeKeyword */: + case 116 /* AsyncKeyword */: + case 120 /* DeclareKeyword */: + case 105 /* InterfaceKeyword */: + case 123 /* ModuleKeyword */: + case 124 /* NamespaceKeyword */: + case 130 /* TypeKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 110 /* StaticKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 111 /* StaticKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -10726,7 +10886,7 @@ var ts; } function nextTokenIsIdentifierOrStartOfDestructuring() { nextToken(); - return isIdentifier() || token === 14 /* OpenBraceToken */ || token === 18 /* OpenBracketToken */; + return isIdentifier() || token === 15 /* OpenBraceToken */ || token === 19 /* OpenBracketToken */; } function isLetDeclaration() { // In ES6 'let' always starts a lexical declaration if followed by an identifier or { @@ -10735,65 +10895,65 @@ var ts; } function parseStatement() { switch (token) { - case 22 /* SemicolonToken */: + case 23 /* SemicolonToken */: return parseEmptyStatement(); - case 14 /* OpenBraceToken */: - return parseBlock(false); - case 99 /* VarKeyword */: - return parseVariableStatement(scanner.getStartPos(), undefined, undefined); - case 105 /* LetKeyword */: + case 15 /* OpenBraceToken */: + return parseBlock(/*ignoreMissingOpenBrace*/ false); + case 100 /* VarKeyword */: + return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); + case 106 /* LetKeyword */: if (isLetDeclaration()) { - return parseVariableStatement(scanner.getStartPos(), undefined, undefined); + return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); } break; - case 84 /* FunctionKeyword */: - return parseFunctionDeclaration(scanner.getStartPos(), undefined, undefined); - case 70 /* ClassKeyword */: - return parseClassDeclaration(scanner.getStartPos(), undefined, undefined); - case 85 /* IfKeyword */: + case 85 /* FunctionKeyword */: + return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); + case 71 /* ClassKeyword */: + return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers*/ undefined); + case 86 /* IfKeyword */: return parseIfStatement(); - case 76 /* DoKeyword */: + case 77 /* DoKeyword */: return parseDoStatement(); - case 101 /* WhileKeyword */: + case 102 /* WhileKeyword */: return parseWhileStatement(); - case 83 /* ForKeyword */: + case 84 /* ForKeyword */: return parseForOrForInOrForOfStatement(); - case 72 /* ContinueKeyword */: - return parseBreakOrContinueStatement(199 /* ContinueStatement */); - case 67 /* BreakKeyword */: - return parseBreakOrContinueStatement(200 /* BreakStatement */); - case 91 /* ReturnKeyword */: + case 73 /* ContinueKeyword */: + return parseBreakOrContinueStatement(200 /* ContinueStatement */); + case 68 /* BreakKeyword */: + return parseBreakOrContinueStatement(201 /* BreakStatement */); + case 92 /* ReturnKeyword */: return parseReturnStatement(); - case 102 /* WithKeyword */: + case 103 /* WithKeyword */: return parseWithStatement(); - case 93 /* SwitchKeyword */: + case 94 /* SwitchKeyword */: return parseSwitchStatement(); - case 95 /* ThrowKeyword */: + case 96 /* ThrowKeyword */: return parseThrowStatement(); - case 97 /* TryKeyword */: + case 98 /* TryKeyword */: // Include 'catch' and 'finally' for error recovery. - case 69 /* CatchKeyword */: - case 82 /* FinallyKeyword */: + case 70 /* CatchKeyword */: + case 83 /* FinallyKeyword */: return parseTryStatement(); - case 73 /* DebuggerKeyword */: + case 74 /* DebuggerKeyword */: return parseDebuggerStatement(); - case 53 /* AtToken */: + case 54 /* AtToken */: return parseDeclaration(); - case 115 /* AsyncKeyword */: - case 104 /* InterfaceKeyword */: - case 129 /* TypeKeyword */: - case 122 /* ModuleKeyword */: - case 123 /* NamespaceKeyword */: - case 119 /* DeclareKeyword */: - case 71 /* ConstKeyword */: - case 78 /* EnumKeyword */: - case 79 /* ExportKeyword */: - case 86 /* ImportKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 109 /* PublicKeyword */: - case 112 /* AbstractKeyword */: - case 110 /* StaticKeyword */: + case 116 /* AsyncKeyword */: + case 105 /* InterfaceKeyword */: + case 130 /* TypeKeyword */: + case 123 /* ModuleKeyword */: + case 124 /* NamespaceKeyword */: + case 120 /* DeclareKeyword */: + case 72 /* ConstKeyword */: + case 79 /* EnumKeyword */: + case 80 /* ExportKeyword */: + case 87 /* ImportKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 110 /* PublicKeyword */: + case 113 /* AbstractKeyword */: + case 111 /* StaticKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -10806,35 +10966,35 @@ var ts; var decorators = parseDecorators(); var modifiers = parseModifiers(); switch (token) { - case 99 /* VarKeyword */: - case 105 /* LetKeyword */: - case 71 /* ConstKeyword */: + case 100 /* VarKeyword */: + case 106 /* LetKeyword */: + case 72 /* ConstKeyword */: return parseVariableStatement(fullStart, decorators, modifiers); - case 84 /* FunctionKeyword */: + case 85 /* FunctionKeyword */: return parseFunctionDeclaration(fullStart, decorators, modifiers); - case 70 /* ClassKeyword */: + case 71 /* ClassKeyword */: return parseClassDeclaration(fullStart, decorators, modifiers); - case 104 /* InterfaceKeyword */: + case 105 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 129 /* TypeKeyword */: + case 130 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); - case 78 /* EnumKeyword */: + case 79 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); - case 122 /* ModuleKeyword */: - case 123 /* NamespaceKeyword */: + case 123 /* ModuleKeyword */: + case 124 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); - case 86 /* ImportKeyword */: + case 87 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); - case 79 /* ExportKeyword */: + case 80 /* ExportKeyword */: nextToken(); - return token === 74 /* DefaultKeyword */ || token === 54 /* EqualsToken */ ? + return token === 75 /* DefaultKeyword */ || token === 55 /* EqualsToken */ ? parseExportAssignment(fullStart, decorators, modifiers) : parseExportDeclaration(fullStart, decorators, modifiers); default: if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(228 /* MissingDeclaration */, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(229 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -10844,86 +11004,86 @@ var ts; } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { nextToken(); - return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 8 /* StringLiteral */); + return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token === 9 /* StringLiteral */); } function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) { - if (token !== 14 /* OpenBraceToken */ && canParseSemicolon()) { + if (token !== 15 /* OpenBraceToken */ && canParseSemicolon()) { parseSemicolon(); return; } - return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage); + return parseFunctionBlock(isGenerator, isAsync, /*ignoreMissingOpenBrace*/ false, diagnosticMessage); } // DECLARATIONS function parseArrayBindingElement() { - if (token === 23 /* CommaToken */) { - return createNode(184 /* OmittedExpression */); + if (token === 24 /* CommaToken */) { + return createNode(185 /* OmittedExpression */); } - var node = createNode(160 /* BindingElement */); - node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); + var node = createNode(161 /* BindingElement */); + node.dotDotDotToken = parseOptionalToken(22 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); - node.initializer = parseBindingElementInitializer(false); + node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(160 /* BindingElement */); + var node = createNode(161 /* BindingElement */); // TODO(andersh): Handle computed properties var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); - if (tokenIsIdentifier && token !== 52 /* ColonToken */) { + if (tokenIsIdentifier && token !== 53 /* ColonToken */) { node.name = propertyName; } else { - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } - node.initializer = parseBindingElementInitializer(false); + node.initializer = parseBindingElementInitializer(/*inParameter*/ false); return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(158 /* ObjectBindingPattern */); - parseExpected(14 /* OpenBraceToken */); + var node = createNode(159 /* ObjectBindingPattern */); + parseExpected(15 /* OpenBraceToken */); node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(159 /* ArrayBindingPattern */); - parseExpected(18 /* OpenBracketToken */); + var node = createNode(160 /* ArrayBindingPattern */); + parseExpected(19 /* OpenBracketToken */); node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); return finishNode(node); } function isIdentifierOrPattern() { - return token === 14 /* OpenBraceToken */ || token === 18 /* OpenBracketToken */ || isIdentifier(); + return token === 15 /* OpenBraceToken */ || token === 19 /* OpenBracketToken */ || isIdentifier(); } function parseIdentifierOrPattern() { - if (token === 18 /* OpenBracketToken */) { + if (token === 19 /* OpenBracketToken */) { return parseArrayBindingPattern(); } - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { return parseObjectBindingPattern(); } return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(208 /* VariableDeclaration */); + var node = createNode(209 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { - node.initializer = parseInitializer(false); + node.initializer = parseInitializer(/*inParameter*/ false); } return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(209 /* VariableDeclarationList */); + var node = createNode(210 /* VariableDeclarationList */); switch (token) { - case 99 /* VarKeyword */: + case 100 /* VarKeyword */: break; - case 105 /* LetKeyword */: + case 106 /* LetKeyword */: node.flags |= 16384 /* Let */; break; - case 71 /* ConstKeyword */: + case 72 /* ConstKeyword */: node.flags |= 32768 /* Const */; break; default: @@ -10939,7 +11099,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token === 131 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 132 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -10951,40 +11111,40 @@ var ts; return finishNode(node); } function canFollowContextualOfKeyword() { - return nextTokenIsIdentifier() && nextToken() === 17 /* CloseParenToken */; + return nextTokenIsIdentifier() && nextToken() === 18 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(190 /* VariableStatement */, fullStart); + var node = createNode(191 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.declarationList = parseVariableDeclarationList(false); + node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(210 /* FunctionDeclaration */, fullStart); + var node = createNode(211 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(84 /* FunctionKeyword */); - node.asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + parseExpected(85 /* FunctionKeyword */); + node.asteriskToken = parseOptionalToken(37 /* AsteriskToken */); node.name = node.flags & 1024 /* Default */ ? parseOptionalIdentifier() : parseIdentifier(); var isGenerator = !!node.asteriskToken; var isAsync = !!(node.flags & 512 /* Async */); - fillSignature(52 /* ColonToken */, isGenerator, isAsync, false, node); + fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node); node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(141 /* Constructor */, pos); + var node = createNode(142 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(118 /* ConstructorKeyword */); - fillSignature(52 /* ColonToken */, false, false, false, node); - node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); + parseExpected(119 /* ConstructorKeyword */); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false, ts.Diagnostics.or_expected); return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(140 /* MethodDeclaration */, fullStart); + var method = createNode(141 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -10992,12 +11152,12 @@ var ts; method.questionToken = questionToken; var isGenerator = !!asteriskToken; var isAsync = !!(method.flags & 512 /* Async */); - fillSignature(52 /* ColonToken */, isGenerator, isAsync, false, method); + fillSignature(53 /* ColonToken */, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, method); method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(138 /* PropertyDeclaration */, fullStart); + var property = createNode(139 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -11019,12 +11179,12 @@ var ts; return finishNode(property); } function parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers) { - var asteriskToken = parseOptionalToken(36 /* AsteriskToken */); + var asteriskToken = parseOptionalToken(37 /* AsteriskToken */); var name = parsePropertyName(); // Note: this is not legal as per the grammar. But we allow it in the parser and // report an error in the grammar checker. - var questionToken = parseOptionalToken(51 /* QuestionToken */); - if (asteriskToken || token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { + var questionToken = parseOptionalToken(52 /* QuestionToken */); + if (asteriskToken || token === 17 /* OpenParenToken */ || token === 25 /* LessThanToken */) { return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { @@ -11032,23 +11192,23 @@ var ts; } } function parseNonParameterInitializer() { - return parseInitializer(false); + return parseInitializer(/*inParameter*/ false); } function parseAccessorDeclaration(kind, fullStart, decorators, modifiers) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parsePropertyName(); - fillSignature(52 /* ColonToken */, false, false, false, node); - node.body = parseFunctionBlockOrSemicolon(false, false); + fillSignature(53 /* ColonToken */, /*yieldContext*/ false, /*awaitContext*/ false, /*requireCompleteParameterList*/ false, node); + node.body = parseFunctionBlockOrSemicolon(/*isGenerator*/ false, /*isAsync*/ false); return finishNode(node); } function isClassMemberModifier(idToken) { switch (idToken) { - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 110 /* StaticKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 111 /* StaticKeyword */: return true; default: return false; @@ -11056,7 +11216,7 @@ var ts; } function isClassMemberStart() { var idToken; - if (token === 53 /* AtToken */) { + if (token === 54 /* AtToken */) { return true; } // Eat up all modifiers, but hold on to the last one in case it is actually an identifier. @@ -11073,7 +11233,7 @@ var ts; } nextToken(); } - if (token === 36 /* AsteriskToken */) { + if (token === 37 /* AsteriskToken */) { return true; } // Try to get the first property-like token following all modifiers. @@ -11083,23 +11243,23 @@ var ts; nextToken(); } // Index signatures and computed properties are class members; we can parse. - if (token === 18 /* OpenBracketToken */) { + if (token === 19 /* OpenBracketToken */) { return true; } // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 126 /* SetKeyword */ || idToken === 120 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 127 /* SetKeyword */ || idToken === 121 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along // to see if it should actually be parsed as a class member. switch (token) { - case 16 /* OpenParenToken */: // Method declaration - case 24 /* LessThanToken */: // Generic Method declaration - case 52 /* ColonToken */: // Type Annotation for declaration - case 54 /* EqualsToken */: // Initializer for declaration - case 51 /* QuestionToken */: + case 17 /* OpenParenToken */: // Method declaration + case 25 /* LessThanToken */: // Generic Method declaration + case 53 /* ColonToken */: // Type Annotation for declaration + case 55 /* EqualsToken */: // Initializer for declaration + case 52 /* QuestionToken */: return true; default: // Covers @@ -11116,14 +11276,14 @@ var ts; var decorators; while (true) { var decoratorStart = getNodePos(); - if (!parseOptional(53 /* AtToken */)) { + if (!parseOptional(54 /* AtToken */)) { break; } if (!decorators) { decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(136 /* Decorator */, decoratorStart); + var decorator = createNode(137 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -11157,7 +11317,7 @@ var ts; function parseModifiersForArrowFunction() { var flags = 0; var modifiers; - if (token === 115 /* AsyncKeyword */) { + if (token === 116 /* AsyncKeyword */) { var modifierStart = scanner.getStartPos(); var modifierKind = token; nextToken(); @@ -11171,8 +11331,8 @@ var ts; return modifiers; } function parseClassElement() { - if (token === 22 /* SemicolonToken */) { - var result = createNode(188 /* SemicolonClassElement */); + if (token === 23 /* SemicolonToken */) { + var result = createNode(189 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -11183,7 +11343,7 @@ var ts; if (accessor) { return accessor; } - if (token === 118 /* ConstructorKeyword */) { + if (token === 119 /* ConstructorKeyword */) { return parseConstructorDeclaration(fullStart, decorators, modifiers); } if (isIndexSignature()) { @@ -11192,16 +11352,16 @@ var ts; // It is very important that we check this *after* checking indexers because // the [ token can start an index signature or a computed property name if (isIdentifierOrKeyword() || - token === 8 /* StringLiteral */ || - token === 7 /* NumericLiteral */ || - token === 36 /* AsteriskToken */ || - token === 18 /* OpenBracketToken */) { + token === 9 /* StringLiteral */ || + token === 8 /* NumericLiteral */ || + token === 37 /* AsteriskToken */ || + token === 19 /* OpenBracketToken */) { return parsePropertyOrMethodDeclaration(fullStart, decorators, modifiers); } if (decorators || modifiers) { // treat this as a property declaration with a missing name. - var name_7 = createMissingNode(66 /* Identifier */, true, ts.Diagnostics.Declaration_expected); - return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, undefined); + var name_7 = createMissingNode(67 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + return parsePropertyDeclaration(fullStart, decorators, modifiers, name_7, /*questionToken*/ undefined); } // 'isClassMemberStart' should have hinted not to attempt parsing. ts.Debug.fail("Should not have attempted to parse class member declaration."); @@ -11210,24 +11370,24 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart*/ scanner.getStartPos(), /*decorators*/ undefined, - /*modifiers*/ undefined, 183 /* ClassExpression */); + /*modifiers*/ undefined, 184 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 211 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 212 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var node = createNode(kind, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(70 /* ClassKeyword */); + parseExpected(71 /* ClassKeyword */); node.name = parseOptionalIdentifier(); node.typeParameters = parseTypeParameters(); - node.heritageClauses = parseHeritageClauses(true); - if (parseExpected(14 /* OpenBraceToken */)) { + node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ true); + if (parseExpected(15 /* OpenBraceToken */)) { // ClassTail[Yield,Await] : (Modified) See 14.5 // ClassHeritage[?Yield,?Await]opt { ClassBody[?Yield,?Await]opt } node.members = parseClassMembers(); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -11246,8 +11406,8 @@ var ts; return parseList(20 /* HeritageClauses */, parseHeritageClause); } function parseHeritageClause() { - if (token === 80 /* ExtendsKeyword */ || token === 103 /* ImplementsKeyword */) { - var node = createNode(240 /* HeritageClause */); + if (token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */) { + var node = createNode(241 /* HeritageClause */); node.token = token; nextToken(); node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); @@ -11256,38 +11416,38 @@ var ts; return undefined; } function parseExpressionWithTypeArguments() { - var node = createNode(185 /* ExpressionWithTypeArguments */); + var node = createNode(186 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); - if (token === 24 /* LessThanToken */) { - node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 24 /* LessThanToken */, 26 /* GreaterThanToken */); + if (token === 25 /* LessThanToken */) { + node.typeArguments = parseBracketedList(18 /* TypeArguments */, parseType, 25 /* LessThanToken */, 27 /* GreaterThanToken */); } return finishNode(node); } function isHeritageClause() { - return token === 80 /* ExtendsKeyword */ || token === 103 /* ImplementsKeyword */; + return token === 81 /* ExtendsKeyword */ || token === 104 /* ImplementsKeyword */; } function parseClassMembers() { return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(212 /* InterfaceDeclaration */, fullStart); + var node = createNode(213 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(104 /* InterfaceKeyword */); + parseExpected(105 /* InterfaceKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - node.heritageClauses = parseHeritageClauses(false); + node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause*/ false); node.members = parseObjectTypeMembers(); return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(213 /* TypeAliasDeclaration */, fullStart); + var node = createNode(214 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(129 /* TypeKeyword */); + parseExpected(130 /* TypeKeyword */); node.name = parseIdentifier(); node.typeParameters = parseTypeParameters(); - parseExpected(54 /* EqualsToken */); + parseExpected(55 /* EqualsToken */); node.type = parseType(); parseSemicolon(); return finishNode(node); @@ -11297,20 +11457,20 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(244 /* EnumMember */, scanner.getStartPos()); + var node = createNode(245 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(214 /* EnumDeclaration */, fullStart); + var node = createNode(215 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(78 /* EnumKeyword */); + parseExpected(79 /* EnumKeyword */); node.name = parseIdentifier(); - if (parseExpected(14 /* OpenBraceToken */)) { + if (parseExpected(15 /* OpenBraceToken */)) { node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { node.members = createMissingList(); @@ -11318,10 +11478,10 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(216 /* ModuleBlock */, scanner.getStartPos()); - if (parseExpected(14 /* OpenBraceToken */)) { + var node = createNode(217 /* ModuleBlock */, scanner.getStartPos()); + if (parseExpected(15 /* OpenBraceToken */)) { node.statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); } else { node.statements = createMissingList(); @@ -11329,84 +11489,84 @@ var ts; return finishNode(node); } function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { - var node = createNode(215 /* ModuleDeclaration */, fullStart); + var node = createNode(216 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); - node.body = parseOptional(20 /* DotToken */) - ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 /* Export */) + node.body = parseOptional(21 /* DotToken */) + ? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers*/ undefined, 1 /* Export */) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215 /* ModuleDeclaration */, fullStart); + var node = createNode(216 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - node.name = parseLiteralNode(true); + node.name = parseLiteralNode(/*internName*/ true); node.body = parseModuleBlock(); return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { var flags = modifiers ? modifiers.flags : 0; - if (parseOptional(123 /* NamespaceKeyword */)) { + if (parseOptional(124 /* NamespaceKeyword */)) { flags |= 131072 /* Namespace */; } else { - parseExpected(122 /* ModuleKeyword */); - if (token === 8 /* StringLiteral */) { + parseExpected(123 /* ModuleKeyword */); + if (token === 9 /* StringLiteral */) { return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); } } return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 124 /* RequireKeyword */ && + return token === 125 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { - return nextToken() === 16 /* OpenParenToken */; + return nextToken() === 17 /* OpenParenToken */; } function nextTokenIsSlash() { - return nextToken() === 37 /* SlashToken */; + return nextToken() === 38 /* SlashToken */; } function nextTokenIsCommaOrFromKeyword() { nextToken(); - return token === 23 /* CommaToken */ || - token === 130 /* FromKeyword */; + return token === 24 /* CommaToken */ || + token === 131 /* FromKeyword */; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { - parseExpected(86 /* ImportKeyword */); + parseExpected(87 /* ImportKeyword */); var afterImportPos = scanner.getStartPos(); var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 23 /* CommaToken */ && token !== 130 /* FromKeyword */) { + if (token !== 24 /* CommaToken */ && token !== 131 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(218 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(219 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; - parseExpected(54 /* EqualsToken */); + parseExpected(55 /* EqualsToken */); importEqualsDeclaration.moduleReference = parseModuleReference(); parseSemicolon(); return finishNode(importEqualsDeclaration); } } // Import statement - var importDeclaration = createNode(219 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(220 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: // import ImportClause from ModuleSpecifier ; // import ModuleSpecifier; if (identifier || - token === 36 /* AsteriskToken */ || - token === 14 /* OpenBraceToken */) { + token === 37 /* AsteriskToken */ || + token === 15 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(130 /* FromKeyword */); + parseExpected(131 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -11419,7 +11579,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(220 /* ImportClause */, fullStart); + var importClause = createNode(221 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -11428,22 +11588,22 @@ var ts; // If there was no default import or if there is comma token after default import // parse namespace or named imports if (!importClause.name || - parseOptional(23 /* CommaToken */)) { - importClause.namedBindings = token === 36 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(222 /* NamedImports */); + parseOptional(24 /* CommaToken */)) { + importClause.namedBindings = token === 37 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(223 /* NamedImports */); } return finishNode(importClause); } function parseModuleReference() { return isExternalModuleReference() ? parseExternalModuleReference() - : parseEntityName(false); + : parseEntityName(/*allowReservedWords*/ false); } function parseExternalModuleReference() { - var node = createNode(229 /* ExternalModuleReference */); - parseExpected(124 /* RequireKeyword */); - parseExpected(16 /* OpenParenToken */); + var node = createNode(230 /* ExternalModuleReference */); + parseExpected(125 /* RequireKeyword */); + parseExpected(17 /* OpenParenToken */); node.expression = parseModuleSpecifier(); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return finishNode(node); } function parseModuleSpecifier() { @@ -11453,7 +11613,7 @@ var ts; var result = parseExpression(); // Ensure the string being required is in our 'identifier' table. This will ensure // that features like 'find refs' will look inside this file when search for its name. - if (result.kind === 8 /* StringLiteral */) { + if (result.kind === 9 /* StringLiteral */) { internIdentifier(result.text); } return result; @@ -11461,9 +11621,9 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(221 /* NamespaceImport */); - parseExpected(36 /* AsteriskToken */); - parseExpected(113 /* AsKeyword */); + var namespaceImport = createNode(222 /* NamespaceImport */); + parseExpected(37 /* AsteriskToken */); + parseExpected(114 /* AsKeyword */); namespaceImport.name = parseIdentifier(); return finishNode(namespaceImport); } @@ -11476,14 +11636,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 222 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 14 /* OpenBraceToken */, 15 /* CloseBraceToken */); + node.elements = parseBracketedList(21 /* ImportOrExportSpecifiers */, kind === 223 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 15 /* OpenBraceToken */, 16 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(227 /* ExportSpecifier */); + return parseImportOrExportSpecifier(228 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(223 /* ImportSpecifier */); + return parseImportOrExportSpecifier(224 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -11497,9 +11657,9 @@ var ts; var checkIdentifierStart = scanner.getTokenPos(); var checkIdentifierEnd = scanner.getTextPos(); var identifierName = parseIdentifierName(); - if (token === 113 /* AsKeyword */) { + if (token === 114 /* AsKeyword */) { node.propertyName = identifierName; - parseExpected(113 /* AsKeyword */); + parseExpected(114 /* AsKeyword */); checkIdentifierIsKeyword = ts.isKeyword(token) && !isIdentifier(); checkIdentifierStart = scanner.getTokenPos(); checkIdentifierEnd = scanner.getTextPos(); @@ -11508,27 +11668,27 @@ var ts; else { node.name = identifierName; } - if (kind === 223 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 224 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(225 /* ExportDeclaration */, fullStart); + var node = createNode(226 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(36 /* AsteriskToken */)) { - parseExpected(130 /* FromKeyword */); + if (parseOptional(37 /* AsteriskToken */)) { + parseExpected(131 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(226 /* NamedExports */); + node.exportClause = parseNamedImportsOrExports(227 /* NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token === 130 /* FromKeyword */ || (token === 8 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(130 /* FromKeyword */); + if (token === 131 /* FromKeyword */ || (token === 9 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(131 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } } @@ -11536,21 +11696,21 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(224 /* ExportAssignment */, fullStart); + var node = createNode(225 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - if (parseOptional(54 /* EqualsToken */)) { + if (parseOptional(55 /* EqualsToken */)) { node.isExportEquals = true; } else { - parseExpected(74 /* DefaultKeyword */); + parseExpected(75 /* DefaultKeyword */); } node.expression = parseAssignmentExpressionOrHigher(); parseSemicolon(); return finishNode(node); } function processReferenceComments(sourceFile) { - var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, 0 /* Standard */, sourceText); + var triviaScanner = ts.createScanner(sourceFile.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText); var referencedFiles = []; var amdDependencies = []; var amdModuleName; @@ -11609,10 +11769,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 /* Export */ - || node.kind === 218 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 229 /* ExternalModuleReference */ - || node.kind === 219 /* ImportDeclaration */ - || node.kind === 224 /* ExportAssignment */ - || node.kind === 225 /* ExportDeclaration */ + || node.kind === 219 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 230 /* ExternalModuleReference */ + || node.kind === 220 /* ImportDeclaration */ + || node.kind === 225 /* ExportAssignment */ + || node.kind === 226 /* ExportDeclaration */ ? node : undefined; }); @@ -11657,23 +11817,23 @@ var ts; (function (JSDocParser) { function isJSDocType() { switch (token) { - case 36 /* AsteriskToken */: - case 51 /* QuestionToken */: - case 16 /* OpenParenToken */: - case 18 /* OpenBracketToken */: - case 47 /* ExclamationToken */: - case 14 /* OpenBraceToken */: - case 84 /* FunctionKeyword */: - case 21 /* DotDotDotToken */: - case 89 /* NewKeyword */: - case 94 /* ThisKeyword */: + case 37 /* AsteriskToken */: + case 52 /* QuestionToken */: + case 17 /* OpenParenToken */: + case 19 /* OpenBracketToken */: + case 48 /* ExclamationToken */: + case 15 /* OpenBraceToken */: + case 85 /* FunctionKeyword */: + case 22 /* DotDotDotToken */: + case 90 /* NewKeyword */: + case 95 /* ThisKeyword */: return true; } return isIdentifierOrKeyword(); } JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, undefined); + initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); var jsDocTypeExpression = parseJSDocTypeExpression(start, length); var diagnostics = parseDiagnostics; clearState(); @@ -11687,23 +11847,23 @@ var ts; scanner.setText(sourceText, start, length); // Prime the first token for us to start processing. token = nextToken(); - var result = createNode(246 /* JSDocTypeExpression */); - parseExpected(14 /* OpenBraceToken */); + var result = createNode(247 /* JSDocTypeExpression */); + parseExpected(15 /* OpenBraceToken */); result.type = parseJSDocTopLevelType(); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); fixupParentReferences(result); return finishNode(result); } JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocTopLevelType() { var type = parseJSDocType(); - if (token === 45 /* BarToken */) { - var unionType = createNode(250 /* JSDocUnionType */, type.pos); + if (token === 46 /* BarToken */) { + var unionType = createNode(251 /* JSDocUnionType */, type.pos); unionType.types = parseJSDocTypeList(type); type = finishNode(unionType); } - if (token === 54 /* EqualsToken */) { - var optionalType = createNode(257 /* JSDocOptionalType */, type.pos); + if (token === 55 /* EqualsToken */) { + var optionalType = createNode(258 /* JSDocOptionalType */, type.pos); nextToken(); optionalType.type = type; type = finishNode(optionalType); @@ -11713,21 +11873,21 @@ var ts; function parseJSDocType() { var type = parseBasicTypeExpression(); while (true) { - if (token === 18 /* OpenBracketToken */) { - var arrayType = createNode(249 /* JSDocArrayType */, type.pos); + if (token === 19 /* OpenBracketToken */) { + var arrayType = createNode(250 /* JSDocArrayType */, type.pos); arrayType.elementType = type; nextToken(); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); type = finishNode(arrayType); } - else if (token === 51 /* QuestionToken */) { - var nullableType = createNode(252 /* JSDocNullableType */, type.pos); + else if (token === 52 /* QuestionToken */) { + var nullableType = createNode(253 /* JSDocNullableType */, type.pos); nullableType.type = type; nextToken(); type = finishNode(nullableType); } - else if (token === 47 /* ExclamationToken */) { - var nonNullableType = createNode(253 /* JSDocNonNullableType */, type.pos); + else if (token === 48 /* ExclamationToken */) { + var nonNullableType = createNode(254 /* JSDocNonNullableType */, type.pos); nonNullableType.type = type; nextToken(); type = finishNode(nonNullableType); @@ -11740,85 +11900,85 @@ var ts; } function parseBasicTypeExpression() { switch (token) { - case 36 /* AsteriskToken */: + case 37 /* AsteriskToken */: return parseJSDocAllType(); - case 51 /* QuestionToken */: + case 52 /* QuestionToken */: return parseJSDocUnknownOrNullableType(); - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: return parseJSDocUnionType(); - case 18 /* OpenBracketToken */: + case 19 /* OpenBracketToken */: return parseJSDocTupleType(); - case 47 /* ExclamationToken */: + case 48 /* ExclamationToken */: return parseJSDocNonNullableType(); - case 14 /* OpenBraceToken */: + case 15 /* OpenBraceToken */: return parseJSDocRecordType(); - case 84 /* FunctionKeyword */: + case 85 /* FunctionKeyword */: return parseJSDocFunctionType(); - case 21 /* DotDotDotToken */: + case 22 /* DotDotDotToken */: return parseJSDocVariadicType(); - case 89 /* NewKeyword */: + case 90 /* NewKeyword */: return parseJSDocConstructorType(); - case 94 /* ThisKeyword */: + case 95 /* ThisKeyword */: return parseJSDocThisType(); - case 114 /* AnyKeyword */: - case 127 /* StringKeyword */: - case 125 /* NumberKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: - case 100 /* VoidKeyword */: + case 115 /* AnyKeyword */: + case 128 /* StringKeyword */: + case 126 /* NumberKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: + case 101 /* VoidKeyword */: return parseTokenNode(); } return parseJSDocTypeReference(); } function parseJSDocThisType() { - var result = createNode(261 /* JSDocThisType */); + var result = createNode(262 /* JSDocThisType */); nextToken(); - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocConstructorType() { - var result = createNode(260 /* JSDocConstructorType */); + var result = createNode(261 /* JSDocConstructorType */); nextToken(); - parseExpected(52 /* ColonToken */); + parseExpected(53 /* ColonToken */); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocVariadicType() { - var result = createNode(259 /* JSDocVariadicType */); + var result = createNode(260 /* JSDocVariadicType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocFunctionType() { - var result = createNode(258 /* JSDocFunctionType */); + var result = createNode(259 /* JSDocFunctionType */); nextToken(); - parseExpected(16 /* OpenParenToken */); + parseExpected(17 /* OpenParenToken */); result.parameters = parseDelimitedList(22 /* JSDocFunctionParameters */, parseJSDocParameter); checkForTrailingComma(result.parameters); - parseExpected(17 /* CloseParenToken */); - if (token === 52 /* ColonToken */) { + parseExpected(18 /* CloseParenToken */); + if (token === 53 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocParameter() { - var parameter = createNode(135 /* Parameter */); + var parameter = createNode(136 /* Parameter */); parameter.type = parseJSDocType(); return finishNode(parameter); } function parseJSDocOptionalType(type) { - var result = createNode(257 /* JSDocOptionalType */, type.pos); + var result = createNode(258 /* JSDocOptionalType */, type.pos); nextToken(); result.type = type; return finishNode(result); } function parseJSDocTypeReference() { - var result = createNode(256 /* JSDocTypeReference */); + var result = createNode(257 /* JSDocTypeReference */); result.name = parseSimplePropertyName(); - while (parseOptional(20 /* DotToken */)) { - if (token === 24 /* LessThanToken */) { + while (parseOptional(21 /* DotToken */)) { + if (token === 25 /* LessThanToken */) { result.typeArguments = parseTypeArguments(); break; } @@ -11834,7 +11994,7 @@ var ts; var typeArguments = parseDelimitedList(23 /* JSDocTypeArguments */, parseJSDocType); checkForTrailingComma(typeArguments); checkForEmptyTypeArgumentList(typeArguments); - parseExpected(26 /* GreaterThanToken */); + parseExpected(27 /* GreaterThanToken */); return typeArguments; } function checkForEmptyTypeArgumentList(typeArguments) { @@ -11845,40 +12005,40 @@ var ts; } } function parseQualifiedName(left) { - var result = createNode(132 /* QualifiedName */, left.pos); + var result = createNode(133 /* QualifiedName */, left.pos); result.left = left; result.right = parseIdentifierName(); return finishNode(result); } function parseJSDocRecordType() { - var result = createNode(254 /* JSDocRecordType */); + var result = createNode(255 /* JSDocRecordType */); nextToken(); result.members = parseDelimitedList(24 /* JSDocRecordMembers */, parseJSDocRecordMember); checkForTrailingComma(result.members); - parseExpected(15 /* CloseBraceToken */); + parseExpected(16 /* CloseBraceToken */); return finishNode(result); } function parseJSDocRecordMember() { - var result = createNode(255 /* JSDocRecordMember */); + var result = createNode(256 /* JSDocRecordMember */); result.name = parseSimplePropertyName(); - if (token === 52 /* ColonToken */) { + if (token === 53 /* ColonToken */) { nextToken(); result.type = parseJSDocType(); } return finishNode(result); } function parseJSDocNonNullableType() { - var result = createNode(253 /* JSDocNonNullableType */); + var result = createNode(254 /* JSDocNonNullableType */); nextToken(); result.type = parseJSDocType(); return finishNode(result); } function parseJSDocTupleType() { - var result = createNode(251 /* JSDocTupleType */); + var result = createNode(252 /* JSDocTupleType */); nextToken(); result.types = parseDelimitedList(25 /* JSDocTupleTypes */, parseJSDocType); checkForTrailingComma(result.types); - parseExpected(19 /* CloseBracketToken */); + parseExpected(20 /* CloseBracketToken */); return finishNode(result); } function checkForTrailingComma(list) { @@ -11888,10 +12048,10 @@ var ts; } } function parseJSDocUnionType() { - var result = createNode(250 /* JSDocUnionType */); + var result = createNode(251 /* JSDocUnionType */); nextToken(); result.types = parseJSDocTypeList(parseJSDocType()); - parseExpected(17 /* CloseParenToken */); + parseExpected(18 /* CloseParenToken */); return finishNode(result); } function parseJSDocTypeList(firstType) { @@ -11899,14 +12059,14 @@ var ts; var types = []; types.pos = firstType.pos; types.push(firstType); - while (parseOptional(45 /* BarToken */)) { + while (parseOptional(46 /* BarToken */)) { types.push(parseJSDocType()); } types.end = scanner.getStartPos(); return types; } function parseJSDocAllType() { - var result = createNode(247 /* JSDocAllType */); + var result = createNode(248 /* JSDocAllType */); nextToken(); return finishNode(result); } @@ -11923,24 +12083,24 @@ var ts; // Foo // Foo(?= // (?| - if (token === 23 /* CommaToken */ || - token === 15 /* CloseBraceToken */ || - token === 17 /* CloseParenToken */ || - token === 26 /* GreaterThanToken */ || - token === 54 /* EqualsToken */ || - token === 45 /* BarToken */) { - var result = createNode(248 /* JSDocUnknownType */, pos); + if (token === 24 /* CommaToken */ || + token === 16 /* CloseBraceToken */ || + token === 18 /* CloseParenToken */ || + token === 27 /* GreaterThanToken */ || + token === 55 /* EqualsToken */ || + token === 46 /* BarToken */) { + var result = createNode(249 /* JSDocUnknownType */, pos); return finishNode(result); } else { - var result = createNode(252 /* JSDocNullableType */, pos); + var result = createNode(253 /* JSDocNullableType */, pos); result.type = parseJSDocType(); return finishNode(result); } } function parseIsolatedJSDocComment(content, start, length) { - initializeState("file.js", content, 2 /* Latest */, undefined); - var jsDocComment = parseJSDocComment(undefined, start, length); + initializeState("file.js", content, 2 /* Latest */, /*_syntaxCursor:*/ undefined); + var jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length); var diagnostics = parseDiagnostics; clearState(); return jsDocComment ? { jsDocComment: jsDocComment, diagnostics: diagnostics } : undefined; @@ -12021,7 +12181,7 @@ var ts; if (!tags) { return undefined; } - var result = createNode(262 /* JSDocComment */, start); + var result = createNode(263 /* JSDocComment */, start); result.tags = tags; return finishNode(result, end); } @@ -12032,7 +12192,7 @@ var ts; } function parseTag() { ts.Debug.assert(content.charCodeAt(pos - 1) === 64 /* at */); - var atToken = createNode(53 /* AtToken */, pos - 1); + var atToken = createNode(54 /* AtToken */, pos - 1); atToken.end = pos; var tagName = scanIdentifier(); if (!tagName) { @@ -12058,7 +12218,7 @@ var ts; return undefined; } function handleUnknownTag(atToken, tagName) { - var result = createNode(263 /* JSDocTag */, atToken.pos); + var result = createNode(264 /* JSDocTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result, pos); @@ -12110,7 +12270,7 @@ var ts; if (!typeExpression) { typeExpression = tryParseTypeExpression(); } - var result = createNode(264 /* JSDocParameterTag */, atToken.pos); + var result = createNode(265 /* JSDocParameterTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.preParameterName = preName; @@ -12120,27 +12280,27 @@ var ts; return finishNode(result, pos); } function handleReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 265 /* JSDocReturnTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 266 /* JSDocReturnTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(265 /* JSDocReturnTag */, atToken.pos); + var result = createNode(266 /* JSDocReturnTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 266 /* JSDocTypeTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 267 /* JSDocTypeTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } - var result = createNode(266 /* JSDocTypeTag */, atToken.pos); + var result = createNode(267 /* JSDocTypeTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result, pos); } function handleTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 267 /* JSDocTemplateTag */; })) { + if (ts.forEach(tags, function (t) { return t.kind === 268 /* JSDocTemplateTag */; })) { parseErrorAtPosition(tagName.pos, pos - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); } var typeParameters = []; @@ -12153,7 +12313,7 @@ var ts; parseErrorAtPosition(startPos, 0, ts.Diagnostics.Identifier_expected); return undefined; } - var typeParameter = createNode(134 /* TypeParameter */, name_8.pos); + var typeParameter = createNode(135 /* TypeParameter */, name_8.pos); typeParameter.name = name_8; finishNode(typeParameter, pos); typeParameters.push(typeParameter); @@ -12164,7 +12324,7 @@ var ts; pos++; } typeParameters.end = pos; - var result = createNode(267 /* JSDocTemplateTag */, atToken.pos); + var result = createNode(268 /* JSDocTemplateTag */, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -12185,7 +12345,7 @@ var ts; if (startPos === pos) { return undefined; } - var result = createNode(66 /* Identifier */, startPos); + var result = createNode(67 /* Identifier */, startPos); result.text = content.substring(startPos, pos); return finishNode(result, pos); } @@ -12205,7 +12365,7 @@ var ts; if (sourceFile.statements.length === 0) { // If we don't have any statements in the current source file, then there's no real // way to incrementally parse. So just do a full parse instead. - return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true); + return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setNodeParents*/ true); } // Make sure we're not trying to incrementally update a source file more than once. Once // we do an update the original source file is considered unusbale from that point onwards. @@ -12261,7 +12421,7 @@ var ts; // inconsistent tree. Setting the parents on the new tree should be very fast. We // will immediately bail out of walking any subtrees when we can see that their parents // are already correct. - var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true); + var result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true); return result; } IncrementalParser.updateSourceFile = updateSourceFile; @@ -12274,7 +12434,7 @@ var ts; } return; function visitNode(node) { - var text = ''; + var text = ""; if (aggressiveChecks && shouldCheckNode(node)) { text = oldText.substring(node.pos, node.end); } @@ -12306,9 +12466,9 @@ var ts; } function shouldCheckNode(node) { switch (node.kind) { - case 8 /* StringLiteral */: - case 7 /* NumericLiteral */: - case 66 /* Identifier */: + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: + case 67 /* Identifier */: return true; } return false; @@ -12400,7 +12560,7 @@ var ts; if (child.pos > changeRangeOldEnd) { // Node is entirely past the change range. We need to move both its pos and // end, forward or backward appropriately. - moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks); + moveElementEntirelyPastChangeRange(child, /*isArray*/ false, delta, oldText, newText, aggressiveChecks); return; } // Check if the element intersects the change range. If it does, then it is not @@ -12424,7 +12584,7 @@ var ts; if (array.pos > changeRangeOldEnd) { // Array is entirely after the change range. We need to move it, and move any of // its children. - moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks); + moveElementEntirelyPastChangeRange(array, /*isArray*/ true, delta, oldText, newText, aggressiveChecks); return; } // Check if the element intersects the change range. If it does, then it is not @@ -12717,17 +12877,20 @@ var ts; isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, getDiagnostics: getDiagnostics, getGlobalDiagnostics: getGlobalDiagnostics, - getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + // The language service will always care about the narrowed type of a symbol, because that is + // the type the language says the symbol should have. + getTypeOfSymbolAtLocation: getNarrowedTypeOfSymbol, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, getPropertyOfType: getPropertyOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, + getBaseTypes: getBaseTypes, getReturnTypeOfSignature: getReturnTypeOfSignature, getSymbolsInScope: getSymbolsInScope, getSymbolAtLocation: getSymbolAtLocation, getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, - getTypeAtLocation: getTypeAtLocation, + getTypeAtLocation: getTypeOfNode, typeToString: typeToString, getSymbolDisplayBuilder: getSymbolDisplayBuilder, symbolToString: symbolToString, @@ -12744,7 +12907,8 @@ var ts; getEmitResolver: getEmitResolver, getExportsOfModule: getExportsOfModuleAsArray, getJsxElementAttributesType: getJsxElementAttributesType, - getJsxIntrinsicTagNames: getJsxIntrinsicTagNames + getJsxIntrinsicTagNames: getJsxIntrinsicTagNames, + isOptionalParameter: isOptionalParameter }; var unknownSymbol = createSymbol(4 /* Property */ | 67108864 /* Transient */, "unknown"); var resolvingSymbol = createSymbol(67108864 /* Transient */, "__resolving__"); @@ -12752,16 +12916,19 @@ var ts; var stringType = createIntrinsicType(2 /* String */, "string"); var numberType = createIntrinsicType(4 /* Number */, "number"); var booleanType = createIntrinsicType(8 /* Boolean */, "boolean"); - var esSymbolType = createIntrinsicType(4194304 /* ESSymbol */, "symbol"); + var esSymbolType = createIntrinsicType(16777216 /* ESSymbol */, "symbol"); var voidType = createIntrinsicType(16 /* Void */, "void"); - var undefinedType = createIntrinsicType(32 /* Undefined */ | 1048576 /* ContainsUndefinedOrNull */, "undefined"); - var nullType = createIntrinsicType(64 /* Null */ | 1048576 /* ContainsUndefinedOrNull */, "null"); + var undefinedType = createIntrinsicType(32 /* Undefined */ | 2097152 /* ContainsUndefinedOrNull */, "undefined"); + var nullType = createIntrinsicType(64 /* Null */ | 2097152 /* ContainsUndefinedOrNull */, "null"); var unknownType = createIntrinsicType(1 /* Any */, "unknown"); var circularType = createIntrinsicType(1 /* Any */, "__circular__"); var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); emptyGenericType.instantiations = {}; var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + // The anyFunctionType contains the anyFunctionType by definition. The flag is further propagated + // in getPropagatingFlagsOfTypes, and it is checked in inferFromTypes. + anyFunctionType.flags |= 8388608 /* ContainsAnyFunctionType */; var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); var anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); @@ -12806,6 +12973,7 @@ var ts; var emitGenerator = false; var resolutionTargets = []; var resolutionResults = []; + var resolutionPropertyNames = []; var mergedSymbols = []; var symbolLinks = []; var nodeLinks = []; @@ -12827,7 +12995,7 @@ var ts; }, "symbol": { type: esSymbolType, - flags: 4194304 /* ESSymbol */ + flags: 16777216 /* ESSymbol */ } }; var JsxNames = { @@ -12840,6 +13008,15 @@ var ts; var subtypeRelation = {}; var assignableRelation = {}; var identityRelation = {}; + // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. + var _displayBuilder; + var TypeSystemPropertyName; + (function (TypeSystemPropertyName) { + TypeSystemPropertyName[TypeSystemPropertyName["Type"] = 0] = "Type"; + TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseConstructorType"] = 1] = "ResolvedBaseConstructorType"; + TypeSystemPropertyName[TypeSystemPropertyName["DeclaredType"] = 2] = "DeclaredType"; + TypeSystemPropertyName[TypeSystemPropertyName["ResolvedReturnType"] = 3] = "ResolvedReturnType"; + })(TypeSystemPropertyName || (TypeSystemPropertyName = {})); initializeTypeChecker(); return checker; function getEmitResolver(sourceFile, cancellationToken) { @@ -12984,10 +13161,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 245 /* SourceFile */); + return ts.getAncestor(node, 246 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 245 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 246 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -13013,7 +13190,7 @@ var ts; if (file1 === file2) { return node1.pos <= node2.pos; } - if (!compilerOptions.out) { + if (!compilerOptions.outFile && !compilerOptions.out) { return true; } var sourceFiles = host.getSourceFiles(); @@ -13044,13 +13221,13 @@ var ts; } } switch (location.kind) { - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: var moduleExports = getSymbolOfNode(location).exports; - if (location.kind === 245 /* SourceFile */ || - (location.kind === 215 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { + if (location.kind === 246 /* SourceFile */ || + (location.kind === 216 /* ModuleDeclaration */ && location.name.kind === 9 /* StringLiteral */)) { // It's an external module. Because of module/namespace merging, a module's exports are in scope, // yet we never want to treat an export specifier as putting a member in scope. Therefore, // if the name we find is purely an export specifier, it is not actually considered in scope. @@ -13064,7 +13241,7 @@ var ts; // which is not the desired behavior. if (ts.hasProperty(moduleExports, name) && moduleExports[name].flags === 8388608 /* Alias */ && - ts.getDeclarationOfKind(moduleExports[name], 227 /* ExportSpecifier */)) { + ts.getDeclarationOfKind(moduleExports[name], 228 /* ExportSpecifier */)) { break; } result = moduleExports["default"]; @@ -13078,13 +13255,13 @@ var ts; break loop; } break; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -13101,9 +13278,9 @@ var ts; } } break; - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 213 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -13114,7 +13291,7 @@ var ts; } break loop; } - if (location.kind === 183 /* ClassExpression */ && meaning & 32 /* Class */) { + if (location.kind === 184 /* ClassExpression */ && meaning & 32 /* Class */) { var className = location.name; if (className && name === className.text) { result = location.symbol; @@ -13130,9 +13307,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 212 /* InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 213 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -13140,19 +13317,19 @@ var ts; } } break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 170 /* FunctionExpression */: + case 171 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -13165,7 +13342,7 @@ var ts; } } break; - case 136 /* Decorator */: + case 137 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -13174,7 +13351,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 135 /* Parameter */) { + if (location.parent && location.parent.kind === 136 /* Parameter */) { location = location.parent; } // @@ -13209,7 +13386,18 @@ 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 */) { + // Only check for block-scoped variable if we are looking for the + // name with variable meaning + // For example, + // declare module foo { + // interface bar {} + // } + // let foo/*1*/: foo/*2*/.bar; + // The foo at /*1*/ and /*2*/ will share same symbol with two meaning + // block - scope variable and namespace module. However, only when we + // try to resolve name in /*1*/ which is used in variable position, + // we want to check for block- scoped + if (meaning & 2 /* BlockScopedVariable */ && result.flags & 2 /* BlockScopedVariable */) { checkResolvedBlockScopedVariable(result, errorLocation); } } @@ -13230,16 +13418,16 @@ var ts; // for (let x in x) // for (let x of x) // climb up to the variable declaration skipping binding patterns - var variableDeclaration = ts.getAncestor(declaration, 208 /* VariableDeclaration */); + var variableDeclaration = ts.getAncestor(declaration, 209 /* VariableDeclaration */); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 190 /* VariableStatement */ || - variableDeclaration.parent.parent.kind === 196 /* ForStatement */) { + if (variableDeclaration.parent.parent.kind === 191 /* VariableStatement */ || + variableDeclaration.parent.parent.kind === 197 /* ForStatement */) { // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 198 /* ForOfStatement */ || - variableDeclaration.parent.parent.kind === 197 /* ForInStatement */) { + else if (variableDeclaration.parent.parent.kind === 199 /* ForOfStatement */ || + variableDeclaration.parent.parent.kind === 198 /* ForInStatement */) { // ForIn/ForOf case - use site should not be used in expression part var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); @@ -13266,10 +13454,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 218 /* ImportEqualsDeclaration */) { + if (node.kind === 219 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 219 /* ImportDeclaration */) { + while (node && node.kind !== 220 /* ImportDeclaration */) { node = node.parent; } return node; @@ -13279,7 +13467,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 229 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 230 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -13386,17 +13574,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 220 /* ImportClause */: + case 221 /* ImportClause */: return getTargetOfImportClause(node); - case 221 /* NamespaceImport */: + case 222 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 223 /* ImportSpecifier */: + case 224 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 227 /* ExportSpecifier */: + case 228 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return getTargetOfExportAssignment(node); } } @@ -13441,11 +13629,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 224 /* ExportAssignment */) { + if (node.kind === 225 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 227 /* ExportSpecifier */) { + else if (node.kind === 228 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -13458,7 +13646,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 218 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 219 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -13467,17 +13655,17 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (entityName.kind === 66 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 67 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 66 /* Identifier */ || entityName.parent.kind === 132 /* QualifiedName */) { + if (entityName.kind === 67 /* Identifier */ || entityName.parent.kind === 133 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 218 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 219 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -13490,16 +13678,16 @@ var ts; return undefined; } var symbol; - if (name.kind === 66 /* Identifier */) { + if (name.kind === 67 /* Identifier */) { var message = meaning === 1536 /* Namespace */ ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; symbol = resolveName(name, name.text, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } } - else if (name.kind === 132 /* QualifiedName */ || name.kind === 163 /* PropertyAccessExpression */) { - var left = name.kind === 132 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 132 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 133 /* QualifiedName */ || name.kind === 164 /* PropertyAccessExpression */) { + var left = name.kind === 133 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 133 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */, ignoreErrors); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -13524,7 +13712,7 @@ var ts; 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 !== 9 /* StringLiteral */) { return; } var moduleReferenceLiteral = moduleReferenceExpression; @@ -13532,29 +13720,18 @@ var ts; // Module names are escaped in our symbol table. However, string literal values aren't. // Escape the name in the "require(...)" clause to ensure we find the right symbol. var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) + if (!moduleName) { return; + } var isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { - var symbol = getSymbol(globals, '"' + moduleName + '"', 512 /* ValueModule */); + var symbol = getSymbol(globals, "\"" + moduleName + "\"", 512 /* ValueModule */); if (symbol) { return symbol; } } - var fileName; - var sourceFile; - while (true) { - fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); - sourceFile = ts.forEach(ts.supportedExtensions, function (extension) { return host.getSourceFile(fileName + extension); }); - if (sourceFile || isRelative) { - break; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } + var fileName = ts.getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); + var sourceFile = fileName && host.getSourceFile(fileName); if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -13662,7 +13839,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 141 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 142 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -13732,17 +13909,17 @@ var ts; } } switch (location_1.kind) { - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (!ts.isExternalModule(location_1)) { break; } - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -13783,7 +13960,7 @@ var ts; return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608 /* Alias */ && symbolFromSymbolTable.name !== "export=" - && !ts.getDeclarationOfKind(symbolFromSymbolTable, 227 /* ExportSpecifier */)) { + && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228 /* ExportSpecifier */)) { if (!useOnlyExternalAliasing || // Is this external alias, then use it to name ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -13820,7 +13997,7 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 227 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 228 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -13836,7 +14013,7 @@ var ts; var meaningToLook = meaning; while (symbol) { // Symbol is accessible if it by itself is accessible - var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false); + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, /*useOnlyExternalAliasing*/ false); if (accessibleSymbolChain) { var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); if (!hasAccessibleDeclarations) { @@ -13893,8 +14070,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 215 /* ModuleDeclaration */ && declaration.name.kind === 8 /* StringLiteral */) || - (declaration.kind === 245 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 216 /* ModuleDeclaration */ && declaration.name.kind === 9 /* StringLiteral */) || + (declaration.kind === 246 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -13930,12 +14107,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 151 /* TypeQuery */) { + if (entityName.parent.kind === 152 /* TypeQuery */) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 132 /* QualifiedName */ || entityName.kind === 163 /* PropertyAccessExpression */ || - entityName.parent.kind === 218 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 133 /* QualifiedName */ || entityName.kind === 164 /* PropertyAccessExpression */ || + entityName.parent.kind === 219 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -13945,7 +14122,7 @@ var ts; meaning = 793056 /* Type */; } var firstIdentifier = getFirstIdentifier(entityName); - var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); + var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); // Verify if the symbol is accessible return (symbol && hasVisibleDeclarations(symbol)) || { accessibility: 1 /* NotAccessible */, @@ -13990,17 +14167,15 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 157 /* ParenthesizedType */) { + while (node.kind === 158 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 213 /* TypeAliasDeclaration */) { + if (node.kind === 214 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } return undefined; } - // This is for caching the result of getSymbolDisplayBuilder. Do not access directly. - var _displayBuilder; function getSymbolDisplayBuilder() { function getNameOfSymbol(symbol) { if (symbol.declarations && symbol.declarations.length) { @@ -14009,10 +14184,10 @@ var ts; return ts.declarationNameToString(declaration.name); } switch (declaration.kind) { - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: return "(Anonymous class)"; - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return "(Anonymous function)"; } } @@ -14042,7 +14217,7 @@ var ts; buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); } } - writePunctuation(writer, 20 /* DotToken */); + writePunctuation(writer, 21 /* DotToken */); } parentSymbol = symbol; appendSymbolNameOnly(symbol, writer); @@ -14098,7 +14273,7 @@ var ts; return writeType(type, globalFlags); function writeType(type, flags) { // Write undefined/null type as any - if (type.flags & 4194431 /* Intrinsic */) { + if (type.flags & 16777343 /* Intrinsic */) { // Special handling for unknown / resolving types, they should show up as any and not unknown or __resolving writer.writeKeyword(!(globalFlags & 16 /* WriteOwnNameForAnyLike */) && isTypeAny(type) ? "any" @@ -14126,23 +14301,23 @@ var ts; else { // Should never get here // { ... } - writePunctuation(writer, 14 /* OpenBraceToken */); + writePunctuation(writer, 15 /* OpenBraceToken */); writeSpace(writer); - writePunctuation(writer, 21 /* DotDotDotToken */); + writePunctuation(writer, 22 /* DotDotDotToken */); writeSpace(writer); - writePunctuation(writer, 15 /* CloseBraceToken */); + writePunctuation(writer, 16 /* CloseBraceToken */); } } function writeTypeList(types, delimiter) { for (var i = 0; i < types.length; i++) { if (i > 0) { - if (delimiter !== 23 /* CommaToken */) { + if (delimiter !== 24 /* CommaToken */) { writeSpace(writer); } writePunctuation(writer, delimiter); writeSpace(writer); } - writeType(types[i], delimiter === 23 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */); + writeType(types[i], delimiter === 24 /* CommaToken */ ? 0 /* None */ : 64 /* InElementType */); } } function writeSymbolTypeReference(symbol, typeArguments, pos, end) { @@ -14152,22 +14327,22 @@ var ts; buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793056 /* Type */); } if (pos < end) { - writePunctuation(writer, 24 /* LessThanToken */); + writePunctuation(writer, 25 /* LessThanToken */); writeType(typeArguments[pos++], 0 /* None */); while (pos < end) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); writeType(typeArguments[pos++], 0 /* None */); } - writePunctuation(writer, 26 /* GreaterThanToken */); + writePunctuation(writer, 27 /* GreaterThanToken */); } } function writeTypeReference(type, flags) { var typeArguments = type.typeArguments; if (type.target === globalArrayType && !(flags & 1 /* WriteArrayAsGenericType */)) { writeType(typeArguments[0], 64 /* InElementType */); - writePunctuation(writer, 18 /* OpenBracketToken */); - writePunctuation(writer, 19 /* CloseBracketToken */); + writePunctuation(writer, 19 /* OpenBracketToken */); + writePunctuation(writer, 20 /* CloseBracketToken */); } else { // Write the type reference in the format f.g.C where A and B are type arguments @@ -14188,7 +14363,7 @@ var ts; // the default outer type arguments), we don't show the group. if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { writeSymbolTypeReference(parent_3, typeArguments, start, i); - writePunctuation(writer, 20 /* DotToken */); + writePunctuation(writer, 21 /* DotToken */); } } } @@ -14196,17 +14371,17 @@ var ts; } } function writeTupleType(type) { - writePunctuation(writer, 18 /* OpenBracketToken */); - writeTypeList(type.elementTypes, 23 /* CommaToken */); - writePunctuation(writer, 19 /* CloseBracketToken */); + writePunctuation(writer, 19 /* OpenBracketToken */); + writeTypeList(type.elementTypes, 24 /* CommaToken */); + writePunctuation(writer, 20 /* CloseBracketToken */); } function writeUnionOrIntersectionType(type, flags) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 17 /* OpenParenToken */); } - writeTypeList(type.types, type.flags & 16384 /* Union */ ? 45 /* BarToken */ : 44 /* AmpersandToken */); + writeTypeList(type.types, type.flags & 16384 /* Union */ ? 46 /* BarToken */ : 45 /* AmpersandToken */); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 18 /* CloseParenToken */); } } function writeAnonymousType(type, flags) { @@ -14228,7 +14403,7 @@ var ts; } else { // Recursive usage, use any - writeKeyword(writer, 114 /* AnyKeyword */); + writeKeyword(writer, 115 /* AnyKeyword */); } } else { @@ -14252,7 +14427,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 245 /* SourceFile */ || declaration.parent.kind === 216 /* ModuleBlock */; + return declaration.parent.kind === 246 /* SourceFile */ || declaration.parent.kind === 217 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -14262,7 +14437,7 @@ var ts; } } function writeTypeofSymbol(type, typeFormatFlags) { - writeKeyword(writer, 98 /* TypeOfKeyword */); + writeKeyword(writer, 99 /* TypeOfKeyword */); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455 /* Value */, 0 /* None */, typeFormatFlags); } @@ -14280,76 +14455,76 @@ var ts; var resolved = resolveStructuredTypeMembers(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, 15 /* OpenBraceToken */); + writePunctuation(writer, 16 /* CloseBraceToken */); return; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 17 /* OpenParenToken */); } buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 18 /* CloseParenToken */); } return; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { if (flags & 64 /* InElementType */) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 17 /* OpenParenToken */); } - writeKeyword(writer, 89 /* NewKeyword */); + writeKeyword(writer, 90 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8 /* WriteArrowStyleSignature */, symbolStack); if (flags & 64 /* InElementType */) { - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 18 /* CloseParenToken */); } return; } } - writePunctuation(writer, 14 /* OpenBraceToken */); + writePunctuation(writer, 15 /* OpenBraceToken */); writer.writeLine(); writer.increaseIndent(); for (var _i = 0, _a = resolved.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } for (var _b = 0, _c = resolved.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; - writeKeyword(writer, 89 /* NewKeyword */); + writeKeyword(writer, 90 /* NewKeyword */); writeSpace(writer); buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } if (resolved.stringIndexType) { // [x: string]: - writePunctuation(writer, 18 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, "x")); - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 19 /* OpenBracketToken */); + writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, /*fallbackName*/ "x")); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 127 /* StringKeyword */); - writePunctuation(writer, 19 /* CloseBracketToken */); - writePunctuation(writer, 52 /* ColonToken */); + writeKeyword(writer, 128 /* StringKeyword */); + writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); writeType(resolved.stringIndexType, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } if (resolved.numberIndexType) { // [x: number]: - writePunctuation(writer, 18 /* OpenBracketToken */); - writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, "x")); - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 19 /* OpenBracketToken */); + writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, /*fallbackName*/ "x")); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 125 /* NumberKeyword */); - writePunctuation(writer, 19 /* CloseBracketToken */); - writePunctuation(writer, 52 /* ColonToken */); + writeKeyword(writer, 126 /* NumberKeyword */); + writePunctuation(writer, 20 /* CloseBracketToken */); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); writeType(resolved.numberIndexType, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { @@ -14361,27 +14536,27 @@ var ts; var signature = signatures[_f]; buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 51 /* QuestionToken */); + writePunctuation(writer, 52 /* QuestionToken */); } buildSignatureDisplay(signature, writer, enclosingDeclaration, globalFlagsToPass, symbolStack); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } } else { buildSymbolDisplay(p, writer); if (p.flags & 536870912 /* Optional */) { - writePunctuation(writer, 51 /* QuestionToken */); + writePunctuation(writer, 52 /* QuestionToken */); } - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); writeType(t, 0 /* None */); - writePunctuation(writer, 22 /* SemicolonToken */); + writePunctuation(writer, 23 /* SemicolonToken */); writer.writeLine(); } } writer.decreaseIndent(); - writePunctuation(writer, 15 /* CloseBraceToken */); + writePunctuation(writer, 16 /* CloseBraceToken */); } } function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { @@ -14395,7 +14570,7 @@ var ts; var constraint = getConstraintOfTypeParameter(tp); if (constraint) { writeSpace(writer); - writeKeyword(writer, 80 /* ExtendsKeyword */); + writeKeyword(writer, 81 /* ExtendsKeyword */); writeSpace(writer); buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, symbolStack); } @@ -14403,67 +14578,67 @@ var ts; function buildParameterDisplay(p, writer, enclosingDeclaration, flags, symbolStack) { var parameterNode = p.valueDeclaration; if (ts.isRestParameter(parameterNode)) { - writePunctuation(writer, 21 /* DotDotDotToken */); + writePunctuation(writer, 22 /* DotDotDotToken */); } appendSymbolNameOnly(p, writer); if (isOptionalParameter(parameterNode)) { - writePunctuation(writer, 51 /* QuestionToken */); + writePunctuation(writer, 52 /* QuestionToken */); } - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 53 /* ColonToken */); writeSpace(writer); buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, symbolStack); } function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24 /* LessThanToken */); + writePunctuation(writer, 25 /* LessThanToken */); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 26 /* GreaterThanToken */); + writePunctuation(writer, 27 /* GreaterThanToken */); } } function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, symbolStack) { if (typeParameters && typeParameters.length) { - writePunctuation(writer, 24 /* LessThanToken */); + writePunctuation(writer, 25 /* LessThanToken */); for (var i = 0; i < typeParameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0 /* None */); } - writePunctuation(writer, 26 /* GreaterThanToken */); + writePunctuation(writer, 27 /* GreaterThanToken */); } } function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, symbolStack) { - writePunctuation(writer, 16 /* OpenParenToken */); + writePunctuation(writer, 17 /* OpenParenToken */); for (var i = 0; i < parameters.length; i++) { if (i > 0) { - writePunctuation(writer, 23 /* CommaToken */); + writePunctuation(writer, 24 /* CommaToken */); writeSpace(writer); } buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, symbolStack); } - writePunctuation(writer, 17 /* CloseParenToken */); + writePunctuation(writer, 18 /* CloseParenToken */); } function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack) { if (flags & 8 /* WriteArrowStyleSignature */) { writeSpace(writer); - writePunctuation(writer, 33 /* EqualsGreaterThanToken */); + writePunctuation(writer, 34 /* EqualsGreaterThanToken */); } else { - writePunctuation(writer, 52 /* ColonToken */); + writePunctuation(writer, 53 /* ColonToken */); } writeSpace(writer); var returnType; if (signature.typePredicate) { writer.writeParameter(signature.typePredicate.parameterName); writeSpace(writer); - writeKeyword(writer, 121 /* IsKeyword */); + writeKeyword(writer, 122 /* IsKeyword */); writeSpace(writer); returnType = signature.typePredicate.type; } @@ -14485,15 +14660,12 @@ var ts; buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, symbolStack); } 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 @@ -14502,12 +14674,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 215 /* ModuleDeclaration */) { - if (node.name.kind === 8 /* StringLiteral */) { + if (node.kind === 216 /* ModuleDeclaration */) { + if (node.name.kind === 9 /* StringLiteral */) { return node; } } - else if (node.kind === 245 /* SourceFile */) { + else if (node.kind === 246 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -14556,70 +14728,70 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 160 /* BindingElement */: + case 161 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 215 /* ModuleDeclaration */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 210 /* FunctionDeclaration */: - case 214 /* EnumDeclaration */: - case 218 /* ImportEqualsDeclaration */: + case 216 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 211 /* FunctionDeclaration */: + case 215 /* EnumDeclaration */: + case 219 /* ImportEqualsDeclaration */: var parent_4 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && - !(node.kind !== 218 /* ImportEqualsDeclaration */ && parent_4.kind !== 245 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { + !(node.kind !== 219 /* ImportEqualsDeclaration */ && parent_4.kind !== 246 /* SourceFile */ && ts.isInAmbientContext(parent_4))) { return isGlobalSourceFile(parent_4); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent_4); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (node.flags & (32 /* Private */ | 64 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so let it fall into next case statement - case 141 /* Constructor */: - case 145 /* ConstructSignature */: - case 144 /* CallSignature */: - case 146 /* IndexSignature */: - case 135 /* Parameter */: - case 216 /* ModuleBlock */: - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 152 /* TypeLiteral */: - case 148 /* TypeReference */: - case 153 /* ArrayType */: - case 154 /* TupleType */: - case 155 /* UnionType */: - case 156 /* IntersectionType */: - case 157 /* ParenthesizedType */: + case 142 /* Constructor */: + case 146 /* ConstructSignature */: + case 145 /* CallSignature */: + case 147 /* IndexSignature */: + case 136 /* Parameter */: + case 217 /* ModuleBlock */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 153 /* TypeLiteral */: + case 149 /* TypeReference */: + case 154 /* ArrayType */: + case 155 /* TupleType */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: + case 158 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 220 /* ImportClause */: - case 221 /* NamespaceImport */: - case 223 /* ImportSpecifier */: + case 221 /* ImportClause */: + case 222 /* NamespaceImport */: + case 224 /* ImportSpecifier */: return false; // Type parameters are always visible - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: // Source file is always visible - case 245 /* SourceFile */: + case 246 /* SourceFile */: return true; // Export assignements do not create name bindings outside the module - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -14635,11 +14807,14 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 224 /* ExportAssignment */) { - exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */, ts.Diagnostics.Cannot_find_name_0, node); + if (node.parent && node.parent.kind === 225 /* ExportAssignment */) { + exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 227 /* ExportSpecifier */) { - exportSymbol = getTargetOfExportSpecifier(node.parent); + else if (node.parent.kind === 228 /* ExportSpecifier */) { + var exportSpecifier = node.parent; + exportSymbol = exportSpecifier.parent.parent.moduleSpecifier ? + getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : + resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } var result = []; if (exportSymbol) { @@ -14663,40 +14838,71 @@ var ts; }); } } - // Push an entry on the type resolution stack. If an entry with the given target is not already on the stack, - // a new entry with that target and an associated result value of true is pushed on the stack, and the value - // true is returned. Otherwise, a circularity has occurred and the result values of the existing entry and - // all entries pushed after it are changed to false, and the value false is returned. The target object provides - // a unique identity for a particular type resolution result: Symbol instances are used to track resolution of - // SymbolLinks.type, SymbolLinks instances are used to track resolution of SymbolLinks.declaredType, and - // Signature instances are used to track resolution of Signature.resolvedReturnType. - function pushTypeResolution(target) { - var i = 0; - var count = resolutionTargets.length; - while (i < count && resolutionTargets[i] !== target) { - i++; - } - if (i < count) { - do { - resolutionResults[i++] = false; - } while (i < count); + /** + * Push an entry on the type resolution stack. If an entry with the given target and the given property name + * is already on the stack, and no entries in between already have a type, then a circularity has occurred. + * In this case, the result values of the existing entry and all entries pushed after it are changed to false, + * and the value false is returned. Otherwise, the new entry is just pushed onto the stack, and true is returned. + * In order to see if the same query has already been done before, the target object and the propertyName both + * must match the one passed in. + * + * @param target The symbol, type, or signature whose type is being queried + * @param propertyName The property name that should be used to query the target for its type + */ + function pushTypeResolution(target, propertyName) { + var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); + if (resolutionCycleStartIndex >= 0) { + // A cycle was found + var length_2 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_2; i++) { + resolutionResults[i] = false; + } return false; } resolutionTargets.push(target); resolutionResults.push(true); + resolutionPropertyNames.push(propertyName); return true; } + function findResolutionCycleStartIndex(target, propertyName) { + for (var i = resolutionTargets.length - 1; i >= 0; i--) { + if (hasType(resolutionTargets[i], resolutionPropertyNames[i])) { + return -1; + } + if (resolutionTargets[i] === target && resolutionPropertyNames[i] === propertyName) { + return i; + } + } + return -1; + } + function hasType(target, propertyName) { + if (propertyName === 0 /* Type */) { + return getSymbolLinks(target).type; + } + if (propertyName === 2 /* DeclaredType */) { + return getSymbolLinks(target).declaredType; + } + if (propertyName === 1 /* ResolvedBaseConstructorType */) { + ts.Debug.assert(!!(target.flags & 1024 /* Class */)); + return target.resolvedBaseConstructorType; + } + if (propertyName === 3 /* ResolvedReturnType */) { + return target.resolvedReturnType; + } + ts.Debug.fail("Unhandled TypeSystemPropertyName " + propertyName); + } // Pop an entry from the type resolution stack and return its associated result value. The result value will // be true if no circularities were detected, or false if a circularity was found. function popTypeResolution() { resolutionTargets.pop(); + resolutionPropertyNames.pop(); return resolutionResults.pop(); } function getDeclarationContainer(node) { node = ts.getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === 208 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + return node.kind === 209 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 @@ -14732,7 +14938,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 158 /* ObjectBindingPattern */) { + if (pattern.kind === 159 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_10 = declaration.propertyName || declaration.name; // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, @@ -14749,11 +14955,8 @@ var ts; // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - var elementType = checkIteratedTypeOrElementType(parentType, pattern, false); + var elementType = checkIteratedTypeOrElementType(parentType, pattern, /*allowStringInput*/ false); if (!declaration.dotDotDotToken) { - if (isTypeAny(elementType)) { - return elementType; - } // Use specific property type when parent is a tuple or numeric index type when parent is an array var propName = "" + ts.indexOf(pattern.elements, declaration); type = isTupleLikeType(parentType) @@ -14779,10 +14982,10 @@ var ts; // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration) { // A variable declared in a for..in statement is always of type any - if (declaration.parent.parent.kind === 197 /* ForInStatement */) { + if (declaration.parent.parent.kind === 198 /* ForInStatement */) { return anyType; } - if (declaration.parent.parent.kind === 198 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 199 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -14796,11 +14999,11 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 135 /* Parameter */) { + if (declaration.kind === 136 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 143 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 142 /* GetAccessor */); + if (func.kind === 144 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 143 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -14816,9 +15019,13 @@ var ts; return checkExpressionCached(declaration.initializer); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 243 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 244 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } + // If the declaration specifies a binding pattern, use the type implied by the binding pattern + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name); + } // No type specified and nothing can be inferred return undefined; } @@ -14851,7 +15058,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 184 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 185 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -14874,7 +15081,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern) { - return pattern.kind === 158 /* ObjectBindingPattern */ + return pattern.kind === 159 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } @@ -14896,19 +15103,14 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - return declaration.kind !== 242 /* PropertyAssignment */ ? getWidenedType(type) : type; - } - // If no type was specified and nothing could be inferred, and if the declaration specifies a binding pattern, use - // the type implied by the binding pattern - if (ts.isBindingPattern(declaration.name)) { - return getTypeFromBindingPattern(declaration.name); + return declaration.kind !== 243 /* PropertyAssignment */ ? getWidenedType(type) : type; } // Rest parameters default to type any[], other parameters default to type any type = declaration.dotDotDotToken ? anyArrayType : anyType; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { var root = ts.getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 135 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 136 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -14923,18 +15125,18 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 241 /* CatchClause */) { + if (declaration.parent.kind === 242 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 224 /* ExportAssignment */) { + if (declaration.kind === 225 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } // Handle variable, parameter or property - if (!pushTypeResolution(symbol)) { + if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); + var type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true); if (!popTypeResolution()) { if (symbol.valueDeclaration.type) { // Variable has type annotation that circularly references the variable itself @@ -14955,7 +15157,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 142 /* GetAccessor */) { + if (accessor.kind === 143 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -14968,11 +15170,11 @@ var ts; function getTypeOfAccessors(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (!pushTypeResolution(symbol)) { + if (!pushTypeResolution(symbol, 0 /* Type */)) { return unknownType; } - var getter = ts.getDeclarationOfKind(symbol, 142 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 143 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 143 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 144 /* SetAccessor */); var type; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); @@ -15001,7 +15203,7 @@ var ts; if (!popTypeResolution()) { type = anyType; if (compilerOptions.noImplicitAny) { - var getter_1 = ts.getDeclarationOfKind(symbol, 142 /* GetAccessor */); + var getter_1 = ts.getDeclarationOfKind(symbol, 143 /* GetAccessor */); error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -15101,9 +15303,9 @@ var ts; if (!node) { return typeParameters; } - if (node.kind === 211 /* ClassDeclaration */ || node.kind === 183 /* ClassExpression */ || - node.kind === 210 /* FunctionDeclaration */ || node.kind === 170 /* FunctionExpression */ || - node.kind === 140 /* MethodDeclaration */ || node.kind === 171 /* ArrowFunction */) { + if (node.kind === 212 /* ClassDeclaration */ || node.kind === 184 /* ClassExpression */ || + node.kind === 211 /* FunctionDeclaration */ || node.kind === 171 /* FunctionExpression */ || + node.kind === 141 /* MethodDeclaration */ || node.kind === 172 /* ArrowFunction */) { var declarations = node.typeParameters; if (declarations) { return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); @@ -15113,7 +15315,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 212 /* InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 213 /* InterfaceDeclaration */); return appendOuterTypeParameters(undefined, declaration); } // The local type parameters are the combined set of type parameters from all declarations of the class, @@ -15122,8 +15324,8 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 212 /* InterfaceDeclaration */ || node.kind === 211 /* ClassDeclaration */ || - node.kind === 183 /* ClassExpression */ || node.kind === 213 /* TypeAliasDeclaration */) { + if (node.kind === 213 /* InterfaceDeclaration */ || node.kind === 212 /* ClassDeclaration */ || + node.kind === 184 /* ClassExpression */ || node.kind === 214 /* TypeAliasDeclaration */) { var declaration = node; if (declaration.typeParameters) { result = appendTypeParameters(result, declaration.typeParameters); @@ -15166,7 +15368,7 @@ var ts; if (!baseTypeNode) { return type.resolvedBaseConstructorType = undefinedType; } - if (!pushTypeResolution(type)) { + if (!pushTypeResolution(type, 1 /* ResolvedBaseConstructorType */)) { return unknownType; } var baseConstructorType = checkExpression(baseTypeNode.expression); @@ -15234,7 +15436,7 @@ var ts; return; } if (type === baseType || hasBaseType(baseType, type)) { - error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1 /* WriteArrayAsGenericType */)); + error(type.symbol.valueDeclaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */)); return; } type.resolvedBaseTypes = [baseType]; @@ -15243,7 +15445,7 @@ var ts; type.resolvedBaseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 212 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 213 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getTypeFromTypeNode(node); @@ -15253,7 +15455,7 @@ var ts; type.resolvedBaseTypes.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, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */)); } } else { @@ -15289,10 +15491,10 @@ var ts; if (!links.declaredType) { // Note that we use the links object as the target here because the symbol object is used as the unique // identity for resolution of the 'type' property in SymbolLinks. - if (!pushTypeResolution(links)) { + if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 213 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 214 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (popTypeResolution()) { links.typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); @@ -15325,7 +15527,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 134 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -15492,43 +15694,70 @@ var ts; 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; + function findMatchingSignature(signatureList, signature, partialMatch, ignoreReturnTypes) { + for (var _i = 0; _i < signatureList.length; _i++) { + var s = signatureList[_i]; + if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { + return s; } } - return true; } - // If the lists of call or construct signatures in the given types are all identical except for return types, - // and if none of the signatures are generic, return a list of signatures that has substitutes a union of the - // return types of the corresponding signatures in each resulting signature. - 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++) { - var signature = signatures[_i]; - if (signature.typeParameters) { - return emptyArray; + function findMatchingSignatures(signatureLists, signature, listIndex) { + if (signature.typeParameters) { + // We require an exact match for generic signatures, so we only return signatures from the first + // signature list and only if they have exact matches in the other signature lists. + if (listIndex > 0) { + return undefined; } - } - for (var i_1 = 1; i_1 < signatureLists.length; i_1++) { - if (!signatureListsIdentical(signatures, signatureLists[i_1])) { - return emptyArray; + for (var i = 1; i < signatureLists.length; i++) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + return undefined; + } } + return [signature]; } - var result = ts.map(signatures, cloneSignature); - for (var i = 0; i < result.length; i++) { - var s = result[i]; - // Clear resolved return type we possibly got from cloneSignature - s.resolvedReturnType = undefined; - s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + // Allow matching non-generic signatures to have excess parameters and different return types + var match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); + if (!match) { + return undefined; + } + if (!ts.contains(result, match)) { + (result || (result = [])).push(match); + } } return result; } + // The signatures of a union type are those signatures that are present in each of the constituent types. + // Generic signatures must match exactly, but non-generic signatures are allowed to have extra optional + // parameters and may differ in return types. When signatures differ in return types, the resulting return + // type is the union of the constituent return types. + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var result = undefined; + for (var i = 0; i < signatureLists.length; i++) { + for (var _i = 0, _a = signatureLists[i]; _i < _a.length; _i++) { + var signature = _a[_i]; + // Only process signatures with parameter lists that aren't already in the result list + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + var unionSignatures = findMatchingSignatures(signatureLists, signature, i); + if (unionSignatures) { + var s = signature; + // Union the result types when more than one signature matches + if (unionSignatures.length > 1) { + s = cloneSignature(signature); + // Clear resolved return type we possibly got from cloneSignature + s.resolvedReturnType = undefined; + s.unionSignatures = unionSignatures; + } + (result || (result = [])).push(s); + } + } + } + } + return result || emptyArray; + } function getUnionIndexType(types, kind) { var indexTypes = []; for (var _i = 0; _i < types.length; _i++) { @@ -15679,9 +15908,6 @@ var ts; * type itself. Note that the apparent type of a union type is the union type itself. */ function getApparentType(type) { - if (type.flags & 16384 /* Union */) { - type = getReducedTypeOfUnionType(type); - } if (type.flags & 512 /* TypeParameter */) { do { type = getConstraintOfTypeParameter(type); @@ -15699,7 +15925,7 @@ var ts; else if (type.flags & 8 /* Boolean */) { type = globalBooleanType; } - else if (type.flags & 4194304 /* ESSymbol */) { + else if (type.flags & 16777216 /* ESSymbol */) { type = globalESSymbolType; } return type; @@ -15784,6 +16010,29 @@ var ts; } return undefined; } + // Check if a property with the given name is known anywhere in the given type. In an object + // type, a property is considered known if the object type is empty, if it has any index + // signatures, or if the property is actually declared in the type. In a union or intersection + // type, a property is considered known if it is known in any constituent type. + function isKnownProperty(type, name) { + if (type.flags & 80896 /* ObjectType */ && type !== globalObjectType) { + var resolved = resolveStructuredTypeMembers(type); + return !!(resolved.properties.length === 0 || + resolved.stringIndexType || + resolved.numberIndexType || + getPropertyOfType(type, name)); + } + if (type.flags & 49152 /* UnionOrIntersection */) { + for (var _i = 0, _a = type.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isKnownProperty(t, name)) { + return true; + } + } + return false; + } + return true; + } function getSignaturesOfStructuredType(type, kind) { if (type.flags & 130048 /* StructuredType */) { var resolved = resolveStructuredTypeMembers(type); @@ -15791,8 +16040,10 @@ var ts; } return emptyArray; } - // Return the signatures of the given kind in the given type. Creates synthetic union signatures when necessary and - // maps primitive types and type parameters are to their apparent types. + /** + * Return the signatures of the given kind in the given type. Creates synthetic union signatures when necessary and + * maps primitive types and type parameters are to their apparent types. + */ function getSignaturesOfType(type, kind) { return getSignaturesOfStructuredType(getApparentType(type), kind); } @@ -15845,12 +16096,22 @@ var ts; return result; } function isOptionalParameter(node) { - return ts.hasQuestionToken(node) || !!node.initializer; + if (ts.hasQuestionToken(node)) { + return true; + } + if (node.initializer) { + var signatureDeclaration = node.parent; + var signature = getSignatureFromDeclaration(signatureDeclaration); + var parameterIndex = signatureDeclaration.parameters.indexOf(node); + ts.Debug.assert(parameterIndex >= 0); + return parameterIndex >= signature.minArgumentCount; + } + return false; } function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 141 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 142 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.localTypeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -15859,14 +16120,18 @@ 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 === 9 /* StringLiteral */) { hasStringLiterals = true; } - if (minArgumentCount < 0) { - if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (param.initializer || param.questionToken || param.dotDotDotToken) { + if (minArgumentCount < 0) { minArgumentCount = i; } } + else { + // If we see any required parameters, it means the prior ones were not in fact optional. + minArgumentCount = -1; + } } if (minArgumentCount < 0) { minArgumentCount = declaration.parameters.length; @@ -15878,7 +16143,7 @@ var ts; } else if (declaration.type) { returnType = getTypeFromTypeNode(declaration.type); - if (declaration.type.kind === 147 /* TypePredicate */) { + if (declaration.type.kind === 148 /* TypePredicate */) { var typePredicateNode = declaration.type; typePredicate = { parameterName: typePredicateNode.parameterName ? typePredicateNode.parameterName.text : undefined, @@ -15890,8 +16155,8 @@ var ts; else { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 142 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 143 /* SetAccessor */); + if (declaration.kind === 143 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 144 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -15909,19 +16174,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -15938,7 +16203,7 @@ var ts; } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { - if (!pushTypeResolution(signature)) { + if (!pushTypeResolution(signature, 3 /* ResolvedReturnType */)) { return unknownType; } var type; @@ -15998,7 +16263,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 141 /* Constructor */ || signature.declaration.kind === 145 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 142 /* Constructor */ || signature.declaration.kind === 146 /* ConstructSignature */; var type = createObjectType(65536 /* Anonymous */ | 262144 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -16012,7 +16277,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 125 /* NumberKeyword */ : 127 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 126 /* NumberKeyword */ : 128 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { @@ -16041,13 +16306,13 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 134 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 135 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 134 /* TypeParameter */).parent); + return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 135 /* TypeParameter */).parent); } function getTypeListId(types) { switch (types.length) { @@ -16066,22 +16331,23 @@ var ts; return result; } } - // This function is used to propagate widening flags when creating new object types references and union types. - // It is only necessary to do so if a constituent type might be the undefined type, the null type, or the type - // of an object literal (since those types have widening related information we need to track). - function getWideningFlagsOfTypes(types) { + // This function is used to propagate certain flags when creating new object type references and union types. + // It is only necessary to do so if a constituent type might be the undefined type, the null type, the type + // of an object literal or the anyFunctionType. This is because there are operations in the type checker + // that care about the presence of such types at arbitrary depth in a containing type. + function getPropagatingFlagsOfTypes(types) { var result = 0; for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; result |= type.flags; } - return result & 3145728 /* RequiresWidening */; + return result & 14680064 /* PropagatingFlags */; } function createTypeReference(target, typeArguments) { var id = getTypeListId(typeArguments); var type = target.instantiations[id]; if (!type) { - var flags = 4096 /* Reference */ | getWideningFlagsOfTypes(typeArguments); + var flags = 4096 /* Reference */ | getPropagatingFlagsOfTypes(typeArguments); type = target.instantiations[id] = createObjectType(flags, target.symbol); type.target = target; type.typeArguments = typeArguments; @@ -16100,16 +16366,16 @@ var ts; currentNode = currentNode.parent; } // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 134 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 135 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 148 /* TypeReference */ && n.typeName.kind === 66 /* Identifier */) { + if (n.kind === 149 /* TypeReference */ && n.typeName.kind === 67 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { - var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, undefined, undefined); + var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); if (symbol && (symbol.flags & 262144 /* TypeParameter */)) { // TypeScript 1.0 spec (April 2014): 3.4.1 // Type parameters declared in a particular type parameter list @@ -16138,7 +16404,7 @@ var ts; var typeParameters = type.localTypeParameters; if (typeParameters) { if (!node.typeArguments || node.typeArguments.length !== typeParameters.length) { - 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, /*enclosingDeclaration*/ undefined, 1 /* WriteArrayAsGenericType */), typeParameters.length); return unknownType; } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -16193,7 +16459,7 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { // We only support expressions that are simple qualified names. For other expressions this produces undefined. - var typeNameOrExpression = node.kind === 148 /* TypeReference */ ? node.typeName : + var typeNameOrExpression = node.kind === 149 /* TypeReference */ ? node.typeName : ts.isSupportedExpressionWithTypeArguments(node) ? node.expression : undefined; var symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, 793056 /* Type */) || unknownSymbol; @@ -16225,9 +16491,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: return declaration; } } @@ -16261,14 +16527,14 @@ var ts; } function tryGetGlobalType(name, arity) { if (arity === void 0) { arity = 0; } - return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056 /* Type */, undefined), arity); + return getTypeOfGlobalSymbol(getGlobalSymbol(name, 793056 /* Type */, /*diagnostic*/ undefined), arity); } /** * Returns a type that is inside a namespace at the global scope, e.g. * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type */ function getExportedTypeFromNamespace(namespace, name) { - var namespaceSymbol = getGlobalSymbol(namespace, 1536 /* Namespace */, undefined); + var namespaceSymbol = getGlobalSymbol(namespace, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, 793056 /* Type */); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } @@ -16310,7 +16576,7 @@ var ts; var id = getTypeListId(elementTypes); var type = tupleTypes[id]; if (!type) { - type = tupleTypes[id] = createObjectType(8192 /* Tuple */ | getWideningFlagsOfTypes(elementTypes)); + type = tupleTypes[id] = createObjectType(8192 /* Tuple */ | getPropagatingFlagsOfTypes(elementTypes)); type.elementTypes = elementTypes; } return type; @@ -16338,20 +16604,71 @@ var ts; addTypeToSet(typeSet, type, typeSetKind); } } - function isSubtypeOfAny(candidate, types) { + function isObjectLiteralTypeDuplicateOf(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return false; + } + for (var _i = 0; _i < sourceProperties.length; _i++) { + var sourceProp = sourceProperties[_i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp || + getDeclarationFlagsFromSymbol(targetProp) & (32 /* Private */ | 64 /* Protected */) || + !isTypeDuplicateOf(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp))) { + return false; + } + } + return true; + } + function isTupleTypeDuplicateOf(source, target) { + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + if (sourceTypes.length !== targetTypes.length) { + return false; + } + for (var i = 0; i < sourceTypes.length; i++) { + if (!isTypeDuplicateOf(sourceTypes[i], targetTypes[i])) { + return false; + } + } + return true; + } + // Returns true if the source type is a duplicate of the target type. A source type is a duplicate of + // a target type if the the two are identical, with the exception that the source type may have null or + // undefined in places where the target type doesn't. This is by design an asymmetric relationship. + function isTypeDuplicateOf(source, target) { + if (source === target) { + return true; + } + if (source.flags & 32 /* Undefined */ || source.flags & 64 /* Null */ && !(target.flags & 32 /* Undefined */)) { + return true; + } + if (source.flags & 524288 /* ObjectLiteral */ && target.flags & 80896 /* ObjectType */) { + return isObjectLiteralTypeDuplicateOf(source, target); + } + if (isArrayType(source) && isArrayType(target)) { + return isTypeDuplicateOf(source.typeArguments[0], target.typeArguments[0]); + } + if (isTupleType(source) && isTupleType(target)) { + return isTupleTypeDuplicateOf(source, target); + } + return isTypeIdenticalTo(source, target); + } + function isTypeDuplicateOfSomeType(candidate, types) { for (var _i = 0; _i < types.length; _i++) { var type = types[_i]; - if (candidate !== type && isTypeSubtypeOf(candidate, type)) { + if (candidate !== type && isTypeDuplicateOf(candidate, type)) { return true; } } return false; } - function removeSubtypes(types) { + function removeDuplicateTypes(types) { var i = types.length; while (i > 0) { i--; - if (isSubtypeOfAny(types[i], types)) { + if (isTypeDuplicateOfSomeType(types[i], types)) { types.splice(i, 1); } } @@ -16374,29 +16691,26 @@ var ts; } } } - function compareTypeIds(type1, type2) { - return type1.id - type2.id; - } - // The noSubtypeReduction flag is there because it isn't possible to always do subtype reduction. The flag - // is true when creating a union type from a type node and when instantiating a union type. In both of those - // cases subtype reduction has to be deferred to properly support recursive union types. For example, a - // type alias of the form "type Item = string | (() => Item)" cannot be reduced during its declaration. - function getUnionType(types, noSubtypeReduction) { + // We always deduplicate the constituent type set based on object identity, but we'll also deduplicate + // based on the structure of the types unless the noDeduplication flag is true, which is the case when + // creating a union type from a type node and when instantiating a union type. In both of those cases, + // structural deduplication has to be deferred to properly support recursive union types. For example, + // a type of the form "type Item = string | (() => Item)" cannot be deduplicated during its declaration. + function getUnionType(types, noDeduplication) { if (types.length === 0) { return emptyObjectType; } var typeSet = []; addTypesToSet(typeSet, types, 16384 /* Union */); - typeSet.sort(compareTypeIds); - if (noSubtypeReduction) { - if (containsTypeAny(typeSet)) { - return anyType; - } + if (containsTypeAny(typeSet)) { + return anyType; + } + if (noDeduplication) { removeAllButLast(typeSet, undefinedType); removeAllButLast(typeSet, nullType); } else { - removeSubtypes(typeSet); + removeDuplicateTypes(typeSet); } if (typeSet.length === 1) { return typeSet[0]; @@ -16404,37 +16718,19 @@ var ts; var id = getTypeListId(typeSet); var type = unionTypes[id]; if (!type) { - type = unionTypes[id] = createObjectType(16384 /* Union */ | getWideningFlagsOfTypes(typeSet)); + type = unionTypes[id] = createObjectType(16384 /* Union */ | getPropagatingFlagsOfTypes(typeSet)); type.types = typeSet; - type.reducedType = noSubtypeReduction ? undefined : type; } return type; } - // Subtype reduction is basically an optimization we do to avoid excessively large union types, which take longer - // to process and look strange in quick info and error messages. Semantically there is no difference between the - // reduced type and the type itself. So, when we detect a circularity we simply say that the reduced type is the - // type itself. - function getReducedTypeOfUnionType(type) { - if (!type.reducedType) { - type.reducedType = circularType; - var reducedType = getUnionType(type.types, false); - if (type.reducedType === circularType) { - type.reducedType = reducedType; - } - } - else if (type.reducedType === circularType) { - type.reducedType = type; - } - return type.reducedType; - } function getTypeFromUnionTypeNode(node) { var links = getNodeLinks(node); if (!links.resolvedType) { - links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), /*noDeduplication*/ true); } return links.resolvedType; } - // We do not perform supertype reduction on intersection types. Intersection types are created only by the & + // We do not perform structural deduplication on intersection types. Intersection types are created only by the & // type operator and we can't reduce those because we want to support recursive intersection types. For example, // a type alias of the form "type List = T & { next: List }" cannot be reduced during its declaration. // Also, unlike union types, the order of the constituent types is preserved in order that overload resolution @@ -16454,7 +16750,7 @@ var ts; var id = getTypeListId(typeSet); var type = intersectionTypes[id]; if (!type) { - type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | getWideningFlagsOfTypes(typeSet)); + type = intersectionTypes[id] = createObjectType(32768 /* Intersection */ | getPropagatingFlagsOfTypes(typeSet)); type.types = typeSet; } return type; @@ -16491,47 +16787,47 @@ var ts; } function getTypeFromTypeNode(node) { switch (node.kind) { - case 114 /* AnyKeyword */: + case 115 /* AnyKeyword */: return anyType; - case 127 /* StringKeyword */: + case 128 /* StringKeyword */: return stringType; - case 125 /* NumberKeyword */: + case 126 /* NumberKeyword */: return numberType; - case 117 /* BooleanKeyword */: + case 118 /* BooleanKeyword */: return booleanType; - case 128 /* SymbolKeyword */: + case 129 /* SymbolKeyword */: return esSymbolType; - case 100 /* VoidKeyword */: + case 101 /* VoidKeyword */: return voidType; - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 148 /* TypeReference */: + case 149 /* TypeReference */: return getTypeFromTypeReference(node); - case 147 /* TypePredicate */: + case 148 /* TypePredicate */: return booleanType; - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 153 /* ArrayType */: + case 154 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 154 /* TupleType */: + case 155 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 155 /* UnionType */: + case 156 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 156 /* IntersectionType */: + case 157 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: return getTypeFromTypeNode(node.type); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 152 /* TypeLiteral */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 153 /* TypeLiteral */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode - case 66 /* Identifier */: - case 132 /* QualifiedName */: - var symbol = getSymbolInfo(node); + case 67 /* Identifier */: + case 133 /* QualifiedName */: + var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: return unknownType; @@ -16590,7 +16886,7 @@ var ts; }; } function createInferenceMapper(context) { - return function (t) { + var mapper = function (t) { for (var i = 0; i < context.typeParameters.length; i++) { if (t === context.typeParameters[i]) { context.inferences[i].isFixed = true; @@ -16599,6 +16895,8 @@ var ts; } return t; }; + mapper.context = context; + return mapper; } function identityMapper(type) { return type; @@ -16689,7 +16987,7 @@ var ts; return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); } if (type.flags & 16384 /* Union */) { - return getUnionType(instantiateList(type.types, mapper, instantiateType), true); + return getUnionType(instantiateList(type.types, mapper, instantiateType), /*noDeduplication*/ true); } if (type.flags & 32768 /* Intersection */) { return getIntersectionType(instantiateList(type.types, mapper, instantiateType)); @@ -16700,27 +16998,27 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 140 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 178 /* BinaryExpression */: - return node.operatorToken.kind === 50 /* BarBarToken */ && + case 179 /* BinaryExpression */: + return node.operatorToken.kind === 51 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 242 /* PropertyAssignment */: + case 243 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; @@ -16744,16 +17042,16 @@ var ts; } // TYPE CHECKING function isTypeIdenticalTo(source, target) { - return checkTypeRelatedTo(source, target, identityRelation, undefined); + return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined); } function compareTypes(source, target) { - return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 /* True */ : 0 /* False */; + return checkTypeRelatedTo(source, target, identityRelation, /*errorNode*/ undefined) ? -1 /* True */ : 0 /* False */; } function isTypeSubtypeOf(source, target) { - return checkTypeSubtypeOf(source, target, undefined); + return checkTypeSubtypeOf(source, target, /*errorNode*/ undefined); } function isTypeAssignableTo(source, target) { - return checkTypeAssignableTo(source, target, undefined); + return checkTypeAssignableTo(source, target, /*errorNode*/ undefined); } function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); @@ -16764,7 +17062,7 @@ var ts; function isSignatureAssignableTo(source, target) { var sourceType = getOrCreateTypeFromSignature(source); var targetType = getOrCreateTypeFromSignature(target); - return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); + return checkTypeRelatedTo(sourceType, targetType, assignableRelation, /*errorNode*/ undefined); } /** * Checks if 'source' is related to 'target' (e.g.: is a assignable to). @@ -16809,6 +17107,15 @@ var ts; function reportError(message, arg0, arg1, arg2) { errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); } + function reportRelationError(message, source, target) { + var sourceType = typeToString(source); + var targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); + targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 128 /* UseFullyQualifiedType */); + } + reportError(message || ts.Diagnostics.Type_0_is_not_assignable_to_type_1, sourceType, targetType); + } // Compare two types and return // Ternary.True if they are related with no assumptions, // Ternary.Maybe if they are related with assumptions of other relationships, or @@ -16818,110 +17125,140 @@ var ts; // both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases if (source === target) return -1 /* True */; - if (relation !== identityRelation) { - if (isTypeAny(target)) - return -1 /* True */; - if (source === undefinedType) - return -1 /* True */; - if (source === nullType && target !== undefinedType) - return -1 /* True */; - if (source.flags & 128 /* Enum */ && target === numberType) + if (relation === identityRelation) { + return isIdenticalTo(source, target); + } + if (isTypeAny(target)) + return -1 /* True */; + if (source === undefinedType) + return -1 /* True */; + 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 */; + if (relation === assignableRelation) { + if (isTypeAny(source)) return -1 /* True */; - if (source.flags & 256 /* StringLiteral */ && target === stringType) + if (source === numberType && target.flags & 128 /* Enum */) return -1 /* True */; - if (relation === assignableRelation) { - if (isTypeAny(source)) - return -1 /* True */; - if (source === numberType && target.flags & 128 /* Enum */) - return -1 /* True */; + } + if (source.flags & 1048576 /* FreshObjectLiteral */) { + if (hasExcessProperties(source, target, reportErrors)) { + if (reportErrors) { + reportRelationError(headMessage, source, target); + } + return 0 /* False */; } + // Above we check for excess properties with respect to the entire target type. When union + // and intersection types are further deconstructed on the target side, we don't want to + // make the check again (as it might fail for a partial target type). Therefore we obtain + // the regular source type and proceed with that. + source = getRegularTypeOfObjectLiteral(source); } var saveErrorInfo = errorInfo; - if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { - // We have type references to same target type, see if relationship holds for all type arguments - if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + // Note that the "each" checks must precede the "some" checks to produce the correct results + if (source.flags & 16384 /* Union */) { + if (result = eachTypeRelatedToType(source, target, reportErrors)) { return result; } } - else if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { - if (result = typeParameterRelatedTo(source, target, reportErrors)) { + else if (target.flags & 32768 /* Intersection */) { + if (result = typeRelatedToEachType(source, target, reportErrors)) { return result; } } - else if (relation !== identityRelation) { - // Note that the "each" checks must precede the "some" checks to produce the correct results - if (source.flags & 16384 /* Union */) { - if (result = eachTypeRelatedToType(source, target, reportErrors)) { + else { + // It is necessary to try "some" checks on both sides because there may be nested "each" checks + // on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or + // A & B = (A & B) | (C & D). + if (source.flags & 32768 /* Intersection */) { + // If target is a union type the following check will report errors so we suppress them here + if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384 /* Union */))) { return result; } } - else if (target.flags & 32768 /* Intersection */) { - if (result = typeRelatedToEachType(source, target, reportErrors)) { + if (target.flags & 16384 /* Union */) { + if (result = typeRelatedToSomeType(source, target, reportErrors)) { return result; } } - else { - // It is necessary to try "each" checks on both sides because there may be nested "some" checks - // on either side that need to be prioritized. For example, A | B = (A | B) & (C | D) or - // A & B = (A & B) | (C & D). - if (source.flags & 32768 /* Intersection */) { - // If target is a union type the following check will report errors so we suppress them here - if (result = someTypeRelatedToType(source, target, reportErrors && !(target.flags & 16384 /* Union */))) { - return result; - } - } - if (target.flags & 16384 /* Union */) { - if (result = typeRelatedToSomeType(source, target, reportErrors)) { - return result; - } - } - } } - else { - if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || - source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { - if (result = eachTypeRelatedToSomeType(source, target)) { - if (result &= eachTypeRelatedToSomeType(target, source)) { - return result; - } - } - } - } - // Even if relationship doesn't hold for unions, type parameters, or generic type references, - // it may hold in a structural comparison. - // Report structural errors only if we haven't reported any errors yet - var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; - // Identity relation does not use apparent type - var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates - // to X. Failing both of those we want to check if the aggregation of A and B's members structurally - // relates to X. Thus, we include intersection types on the source side here. - if (sourceOrApparentType.flags & (80896 /* ObjectType */ | 32768 /* Intersection */) && target.flags & 80896 /* ObjectType */) { - if (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors)) { + if (source.flags & 512 /* TypeParameter */) { + var constraint = getConstraintOfTypeParameter(source); + if (!constraint || constraint.flags & 1 /* Any */) { + constraint = emptyObjectType; + } + // Report constraint errors only if the constraint is not the empty object type + var reportConstraintErrors = reportErrors && constraint !== emptyObjectType; + if (result = isRelatedTo(constraint, target, reportConstraintErrors)) { errorInfo = saveErrorInfo; return result; } } - else if (source.flags & 512 /* TypeParameter */ && sourceOrApparentType.flags & 49152 /* UnionOrIntersection */) { - // We clear the errors first because the following check often gives a better error than - // the union or intersection comparison above if it is applicable. - errorInfo = saveErrorInfo; - if (result = isRelatedTo(sourceOrApparentType, target, reportErrors)) { - return result; + else { + if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + // We have type references to same target type, see if relationship holds for all type arguments + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; + } + } + // Even if relationship doesn't hold for unions, intersections, or generic type references, + // it may hold in a structural comparison. + var apparentType = getApparentType(source); + // In a check of the form X = A & B, we will have previously checked if A relates to X or B relates + // to X. Failing both of those we want to check if the aggregation of A and B's members structurally + // relates to X. Thus, we include intersection types on the source side here. + if (apparentType.flags & (80896 /* ObjectType */ | 32768 /* Intersection */) && target.flags & 80896 /* ObjectType */) { + // Report structural errors only if we haven't reported any errors yet + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; + if (result = objectTypeRelatedTo(apparentType, target, reportStructuralErrors)) { + 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 /* UseFullyQualifiedType */); - targetType = typeToString(target, undefined, 128 /* UseFullyQualifiedType */); + reportRelationError(headMessage, source, target); + } + return 0 /* False */; + } + function isIdenticalTo(source, target) { + var result; + if (source.flags & 80896 /* ObjectType */ && target.flags & 80896 /* ObjectType */) { + if (source.flags & 4096 /* Reference */ && target.flags & 4096 /* Reference */ && source.target === target.target) { + // We have type references to same target type, see if all type arguments are identical + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, /*reportErrors*/ false)) { + return result; + } + } + return objectTypeRelatedTo(source, target, /*reportErrors*/ false); + } + if (source.flags & 512 /* TypeParameter */ && target.flags & 512 /* TypeParameter */) { + return typeParameterIdenticalTo(source, target); + } + if (source.flags & 16384 /* Union */ && target.flags & 16384 /* Union */ || + source.flags & 32768 /* Intersection */ && target.flags & 32768 /* Intersection */) { + if (result = eachTypeRelatedToSomeType(source, target)) { + if (result &= eachTypeRelatedToSomeType(target, source)) { + return result; + } } - reportError(headMessage, sourceType, targetType); } return 0 /* False */; } + function hasExcessProperties(source, target, reportErrors) { + for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { + var prop = _a[_i]; + if (!isKnownProperty(target, prop.name)) { + if (reportErrors) { + reportError(ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(prop), typeToString(target)); + } + return true; + } + } + } function eachTypeRelatedToSomeType(source, target) { var result = -1 /* True */; var sourceTypes = source.types; @@ -16992,31 +17329,18 @@ var ts; } return result; } - function typeParameterRelatedTo(source, target, reportErrors) { - if (relation === identityRelation) { - if (source.symbol.name !== target.symbol.name) { - return 0 /* False */; - } - // covers case when both type parameters does not have constraint (both equal to noConstraintType) - if (source.constraint === target.constraint) { - return -1 /* True */; - } - if (source.constraint === noConstraintType || target.constraint === noConstraintType) { - return 0 /* False */; - } - return isRelatedTo(source.constraint, target.constraint, reportErrors); + function typeParameterIdenticalTo(source, target) { + if (source.symbol.name !== target.symbol.name) { + return 0 /* False */; } - else { - while (true) { - var constraint = getConstraintOfTypeParameter(source); - if (constraint === target) - return -1 /* True */; - if (!(constraint && constraint.flags & 512 /* TypeParameter */)) - break; - source = constraint; - } + // covers case when both type parameters does not have constraint (both equal to noConstraintType) + if (source.constraint === target.constraint) { + return -1 /* True */; + } + if (source.constraint === noConstraintType || target.constraint === noConstraintType) { return 0 /* False */; } + return isIdenticalTo(source.constraint, target.constraint); } // Determine if two object types are related by structure. First, check if the result is already available in the global cache. // Second, check if we have already started a comparison of the given two types in which case we assume the result to be true. @@ -17211,26 +17535,20 @@ var ts; var targetSignatures = getSignaturesOfType(target, kind); var result = -1 /* True */; var saveErrorInfo = errorInfo; - // Because the "abstractness" of a class is the same across all construct signatures - // (internally we are checking the corresponding declaration), it is enough to perform - // the check and report an error once over all pairs of source and target construct signatures. - var sourceSig = sourceSignatures[0]; - // Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds. - var targetSig = targetSignatures[0]; - if (sourceSig && targetSig) { - var sourceErasedSignature = getErasedSignature(sourceSig); - var targetErasedSignature = getErasedSignature(targetSig); - var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); - var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); - var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 211 /* ClassDeclaration */); - var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 211 /* ClassDeclaration */); - var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */; - var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */; - if (sourceIsAbstract && !targetIsAbstract) { - if (reportErrors) { - reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); - } - return 0 /* False */; + if (kind === 1 /* Construct */) { + // Only want to compare the construct signatures for abstractness guarantees. + // Because the "abstractness" of a class is the same across all construct signatures + // (internally we are checking the corresponding declaration), it is enough to perform + // the check and report an error once over all pairs of source and target construct signatures. + // + // sourceSig and targetSig are (possibly) undefined. + // + // Note that in an extends-clause, targetSignatures is stripped, so the check never proceeds. + var sourceSig = sourceSignatures[0]; + var targetSig = targetSignatures[0]; + result &= abstractSignatureRelatedTo(source, sourceSig, target, targetSig); + if (result !== -1 /* True */) { + return result; } } outer: for (var _i = 0; _i < targetSignatures.length; _i++) { @@ -17255,6 +17573,33 @@ var ts; } } return result; + function abstractSignatureRelatedTo(source, sourceSig, target, targetSig) { + if (sourceSig && targetSig) { + var sourceDecl = source.symbol && ts.getDeclarationOfKind(source.symbol, 212 /* ClassDeclaration */); + var targetDecl = target.symbol && ts.getDeclarationOfKind(target.symbol, 212 /* ClassDeclaration */); + if (!sourceDecl) { + // If the source object isn't itself a class declaration, it can be freely assigned, regardless + // of whether the constructed object is abstract or not. + return -1 /* True */; + } + var sourceErasedSignature = getErasedSignature(sourceSig); + var targetErasedSignature = getErasedSignature(targetSig); + var sourceReturnType = sourceErasedSignature && getReturnTypeOfSignature(sourceErasedSignature); + var targetReturnType = targetErasedSignature && getReturnTypeOfSignature(targetErasedSignature); + var sourceReturnDecl = sourceReturnType && sourceReturnType.symbol && ts.getDeclarationOfKind(sourceReturnType.symbol, 212 /* ClassDeclaration */); + var targetReturnDecl = targetReturnType && targetReturnType.symbol && ts.getDeclarationOfKind(targetReturnType.symbol, 212 /* ClassDeclaration */); + var sourceIsAbstract = sourceReturnDecl && sourceReturnDecl.flags & 256 /* Abstract */; + var targetIsAbstract = targetReturnDecl && targetReturnDecl.flags & 256 /* Abstract */; + if (sourceIsAbstract && !(targetIsAbstract && targetDecl)) { + // if target isn't a class-declaration type, then it can be new'd, so we forbid the assignment. + if (reportErrors) { + reportError(ts.Diagnostics.Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type); + } + return 0 /* False */; + } + } + return -1 /* True */; + } } function signatureRelatedTo(source, target, reportErrors) { if (source === target) { @@ -17345,7 +17690,7 @@ var ts; } var result = -1 /* True */; for (var i = 0, len = sourceSignatures.length; i < len; ++i) { - var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return 0 /* False */; } @@ -17358,7 +17703,7 @@ var ts; return indexTypesIdenticalTo(0 /* String */, source, target); } var targetType = getIndexTypeOfType(target, 0 /* String */); - if (targetType) { + if (targetType && !(targetType.flags & 1 /* Any */)) { var sourceType = getIndexTypeOfType(source, 0 /* String */); if (!sourceType) { if (reportErrors) { @@ -17382,7 +17727,7 @@ var ts; return indexTypesIdenticalTo(1 /* Number */, source, target); } var targetType = getIndexTypeOfType(target, 1 /* Number */); - if (targetType) { + if (targetType && !(targetType.flags & 1 /* Any */)) { var sourceStringType = getIndexTypeOfType(source, 0 /* String */); var sourceNumberType = getIndexTypeOfType(source, 1 /* Number */); if (!(sourceStringType || sourceNumberType)) { @@ -17469,14 +17814,18 @@ var ts; } return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } - function compareSignatures(source, target, compareReturnTypes, compareTypes) { + function compareSignatures(source, target, partialMatch, ignoreReturnTypes, compareTypes) { if (source === target) { return -1 /* True */; } if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { - return 0 /* False */; + if (!partialMatch || + source.parameters.length < target.parameters.length && !source.hasRestParameter || + source.minArgumentCount > target.minArgumentCount) { + return 0 /* False */; + } } var result = -1 /* True */; if (source.typeParameters && target.typeParameters) { @@ -17498,16 +17847,18 @@ var ts; // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N 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 sourceLen = source.parameters.length; + var targetLen = target.parameters.length; + for (var i = 0; i < targetLen; i++) { + var s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); var related = compareTypes(s, t); if (!related) { return 0 /* False */; } result &= related; } - if (compareReturnTypes) { + if (!ignoreReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } return result; @@ -17573,6 +17924,23 @@ var ts; function isTupleType(type) { return !!(type.flags & 8192 /* Tuple */); } + function getRegularTypeOfObjectLiteral(type) { + if (type.flags & 1048576 /* FreshObjectLiteral */) { + var regularType = type.regularType; + if (!regularType) { + regularType = createType(type.flags & ~1048576 /* FreshObjectLiteral */); + regularType.symbol = type.symbol; + regularType.members = type.members; + regularType.properties = type.properties; + regularType.callSignatures = type.callSignatures; + regularType.constructSignatures = type.constructSignatures; + regularType.stringIndexType = type.stringIndexType; + regularType.numberIndexType = type.numberIndexType; + } + return regularType; + } + return type; + } function getWidenedTypeOfObjectLiteral(type) { var properties = getPropertiesOfObjectType(type); var members = {}; @@ -17600,7 +17968,7 @@ var ts; return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); } function getWidenedType(type) { - if (type.flags & 3145728 /* RequiresWidening */) { + if (type.flags & 6291456 /* RequiresWidening */) { if (type.flags & (32 /* Undefined */ | 64 /* Null */)) { return anyType; } @@ -17655,7 +18023,7 @@ var ts; for (var _d = 0, _e = getPropertiesOfObjectType(type); _d < _e.length; _d++) { var p = _e[_d]; var t = getTypeOfSymbol(p); - if (t.flags & 1048576 /* ContainsUndefinedOrNull */) { + if (t.flags & 2097152 /* ContainsUndefinedOrNull */) { if (!reportWideningErrorsInType(t)) { error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); } @@ -17669,22 +18037,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 135 /* Parameter */: + case 136 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -17697,7 +18065,7 @@ var ts; error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); } function reportErrorsFromWidening(declaration, type) { - if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 1048576 /* ContainsUndefinedOrNull */) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 2097152 /* ContainsUndefinedOrNull */) { // Report implicit any error within type if possible, otherwise report error on declaration if (!reportWideningErrorsInType(type)) { reportImplicitAnyError(declaration, type); @@ -17734,7 +18102,9 @@ var ts; var inferences = []; for (var _i = 0; _i < typeParameters.length; _i++) { var unused = typeParameters[_i]; - inferences.push({ primary: undefined, secondary: undefined, isFixed: false }); + inferences.push({ + primary: undefined, secondary: undefined, isFixed: false + }); } return { typeParameters: typeParameters, @@ -17758,11 +18128,16 @@ var ts; return false; } function inferFromTypes(source, target) { - if (source === anyFunctionType) { - return; - } if (target.flags & 512 /* TypeParameter */) { - // If target is a type parameter, make an inference + // If target is a type parameter, make an inference, unless the source type contains + // the anyFunctionType (the wildcard type that's used to avoid contextually typing functions). + // Because the anyFunctionType is internal, it should not be exposed to the user by adding + // it as an inference candidate. Hopefully, a better candidate will come along that does + // not contain anyFunctionType when we come back to this argument for its second round + // of inference. + if (source.flags & 8388608 /* ContainsAnyFunctionType */) { + return; + } var typeParameters = context.typeParameters; for (var i = 0; i < typeParameters.length; i++) { if (target === typeParameters[i]) { @@ -17793,6 +18168,14 @@ var ts; inferFromTypes(sourceTypes[i], targetTypes[i]); } } + else if (source.flags & 8192 /* Tuple */ && target.flags & 8192 /* Tuple */ && source.elementTypes.length === target.elementTypes.length) { + // If source and target are tuples of the same size, infer from element types + var sourceTypes = source.elementTypes; + var targetTypes = target.elementTypes; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } else if (target.flags & 49152 /* UnionOrIntersection */) { var targetTypes = target.types; var typeParameterCount = 0; @@ -17959,10 +18342,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return true; - case 66 /* Identifier */: - case 132 /* QualifiedName */: + case 67 /* Identifier */: + case 133 /* QualifiedName */: node = node.parent; continue; default: @@ -18008,12 +18391,12 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operatorToken.kind >= 54 /* FirstAssignment */ && node.operatorToken.kind <= 65 /* LastAssignment */) { + if (node.operatorToken.kind >= 55 /* FirstAssignment */ && node.operatorToken.kind <= 66 /* LastAssignment */) { var n = node.left; - while (n.kind === 169 /* ParenthesizedExpression */) { + while (n.kind === 170 /* ParenthesizedExpression */) { n = n.expression; } - if (n.kind === 66 /* Identifier */ && getResolvedSymbol(n) === symbol) { + if (n.kind === 67 /* Identifier */ && getResolvedSymbol(n) === symbol) { return true; } } @@ -18027,96 +18410,60 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: return isAssignedInVariableDeclaration(node); - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: - case 161 /* ArrayLiteralExpression */: - case 162 /* ObjectLiteralExpression */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: - case 169 /* ParenthesizedExpression */: - case 176 /* PrefixUnaryExpression */: - case 172 /* DeleteExpression */: - case 175 /* AwaitExpression */: - case 173 /* TypeOfExpression */: - case 174 /* VoidExpression */: - case 177 /* PostfixUnaryExpression */: - case 181 /* YieldExpression */: - case 179 /* ConditionalExpression */: - case 182 /* SpreadElementExpression */: - case 189 /* Block */: - case 190 /* VariableStatement */: - case 192 /* ExpressionStatement */: - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 201 /* ReturnStatement */: - case 202 /* WithStatement */: - case 203 /* SwitchStatement */: - case 238 /* CaseClause */: - case 239 /* DefaultClause */: - case 204 /* LabeledStatement */: - case 205 /* ThrowStatement */: - case 206 /* TryStatement */: - case 241 /* CatchClause */: - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: - case 235 /* JsxAttribute */: - case 236 /* JsxSpreadAttribute */: - case 232 /* JsxOpeningElement */: - case 237 /* JsxExpression */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: + case 162 /* ArrayLiteralExpression */: + case 163 /* ObjectLiteralExpression */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: + case 170 /* ParenthesizedExpression */: + case 177 /* PrefixUnaryExpression */: + case 173 /* DeleteExpression */: + case 176 /* AwaitExpression */: + case 174 /* TypeOfExpression */: + case 175 /* VoidExpression */: + case 178 /* PostfixUnaryExpression */: + case 182 /* YieldExpression */: + case 180 /* ConditionalExpression */: + case 183 /* SpreadElementExpression */: + case 190 /* Block */: + case 191 /* VariableStatement */: + case 193 /* ExpressionStatement */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 202 /* ReturnStatement */: + case 203 /* WithStatement */: + case 204 /* SwitchStatement */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: + case 205 /* LabeledStatement */: + case 206 /* ThrowStatement */: + case 207 /* TryStatement */: + case 242 /* CatchClause */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: + case 236 /* JsxAttribute */: + case 237 /* JsxSpreadAttribute */: + case 233 /* JsxOpeningElement */: + case 238 /* JsxExpression */: return ts.forEachChild(node, isAssignedIn); } return false; } } - function resolveLocation(node) { - // Resolve location from top down towards node if it is a context sensitive expression - // That helps in making sure not assigning types as any when resolved out of order - var containerNodes = []; - for (var parent_5 = node.parent; parent_5; parent_5 = parent_5.parent) { - if ((ts.isExpression(parent_5) || ts.isObjectLiteralMethod(node)) && - isContextSensitive(parent_5)) { - containerNodes.unshift(parent_5); - } - } - 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); - // Get the narrowed type of symbol at given location instead of just getting - // the type of the symbol. - // eg. - // function foo(a: string | number) { - // if (typeof a === "string") { - // a/**/ - // } - // } - // getTypeOfSymbol for a would return type of parameter symbol string | number - // Unless we provide location /**/, checker wouldn't know how to narrow the type - // By using getNarrowedTypeOfSymbol would return string since it would be able to narrow - // it by typeguard in the if true condition - return getNarrowedTypeOfSymbol(symbol, node); - } // Get the narrowed type of a given symbol at a given location function getNarrowedTypeOfSymbol(symbol, node) { var type = getTypeOfSymbol(symbol); @@ -18128,37 +18475,37 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 193 /* IfStatement */: + case 194 /* IfStatement */: // In a branch of an if statement, narrow based on controlling expression if (child !== node.expression) { - narrowedType = narrowType(type, node.expression, child === node.thenStatement); + narrowedType = narrowType(type, node.expression, /*assumeTrue*/ child === node.thenStatement); } break; - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: // In a branch of a conditional expression, narrow based on controlling condition if (child !== node.condition) { - narrowedType = narrowType(type, node.condition, child === node.whenTrue); + narrowedType = narrowType(type, node.condition, /*assumeTrue*/ child === node.whenTrue); } break; - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: // In the right operand of an && or ||, narrow based on left operand if (child === node.right) { - if (node.operatorToken.kind === 49 /* AmpersandAmpersandToken */) { - narrowedType = narrowType(type, node.left, true); + if (node.operatorToken.kind === 50 /* AmpersandAmpersandToken */) { + narrowedType = narrowType(type, node.left, /*assumeTrue*/ true); } - else if (node.operatorToken.kind === 50 /* BarBarToken */) { - narrowedType = narrowType(type, node.left, false); + else if (node.operatorToken.kind === 51 /* BarBarToken */) { + narrowedType = narrowType(type, node.left, /*assumeTrue*/ false); } } break; - case 245 /* SourceFile */: - case 215 /* ModuleDeclaration */: - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 141 /* Constructor */: + case 246 /* SourceFile */: + case 216 /* ModuleDeclaration */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 142 /* Constructor */: // Stop at the first containing function or module declaration break loop; } @@ -18175,23 +18522,23 @@ var ts; return type; function narrowTypeByEquality(type, expr, assumeTrue) { // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 173 /* TypeOfExpression */ || expr.right.kind !== 8 /* StringLiteral */) { + if (expr.left.kind !== 174 /* TypeOfExpression */ || expr.right.kind !== 9 /* StringLiteral */) { return type; } var left = expr.left; var right = expr.right; - if (left.expression.kind !== 66 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { + if (left.expression.kind !== 67 /* Identifier */ || getResolvedSymbol(left.expression) !== symbol) { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operatorToken.kind === 32 /* ExclamationEqualsEqualsToken */) { + if (expr.operatorToken.kind === 33 /* 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, 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */ | 4194304 /* ESSymbol */, - /*isOfTypeKind*/ true, false); + return removeTypesFromUnionType(type, /*typeKind*/ 258 /* StringLike */ | 132 /* NumberLike */ | 8 /* Boolean */ | 16777216 /* ESSymbol */, + /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); } // Check was for a primitive type, return that primitive type if it is a subtype if (isTypeSubtypeOf(typeInfo.type, type)) { @@ -18199,12 +18546,12 @@ var ts; } // Otherwise, remove all types that aren't of the primitive type kind. This can happen when the type is // union of enum types and other types. - return removeTypesFromUnionType(type, typeInfo.flags, false, false); + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ false, /*allowEmptyUnionResult*/ false); } else { // Assumed result is false. If check was for a primitive type, remove that primitive type if (typeInfo) { - return removeTypesFromUnionType(type, typeInfo.flags, true, false); + return removeTypesFromUnionType(type, /*typeKind*/ typeInfo.flags, /*isOfTypeKind*/ true, /*allowEmptyUnionResult*/ false); } // Otherwise we don't have enough information to do anything. return type; @@ -18213,14 +18560,14 @@ var ts; function narrowTypeByAnd(type, expr, assumeTrue) { if (assumeTrue) { // The assumed result is true, therefore we narrow assuming each operand to be true. - return narrowType(narrowType(type, expr.left, true), expr.right, true); + return narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ true); } else { // The assumed result is false. This means either the first operand was false, or the first operand was true // and the second operand was false. We narrow with those assumptions and union the two resulting types. return getUnionType([ - narrowType(type, expr.left, false), - narrowType(narrowType(type, expr.left, true), expr.right, false) + narrowType(type, expr.left, /*assumeTrue*/ false), + narrowType(narrowType(type, expr.left, /*assumeTrue*/ true), expr.right, /*assumeTrue*/ false) ]); } } @@ -18229,18 +18576,18 @@ var ts; // The assumed result is true. This means either the first operand was true, or the first operand was false // and the second operand was true. We narrow with those assumptions and union the two resulting types. return getUnionType([ - narrowType(type, expr.left, true), - narrowType(narrowType(type, expr.left, false), expr.right, true) + narrowType(type, expr.left, /*assumeTrue*/ true), + narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ true) ]); } else { // The assumed result is false, therefore we narrow assuming each operand to be false. - return narrowType(narrowType(type, expr.left, false), expr.right, false); + return narrowType(narrowType(type, expr.left, /*assumeTrue*/ false), expr.right, /*assumeTrue*/ false); } } function narrowTypeByInstanceof(type, expr, assumeTrue) { // Check that type is not any, assumed result is true, and we have variable symbol on the left - if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 66 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { + if (isTypeAny(type) || !assumeTrue || expr.left.kind !== 67 /* Identifier */ || getResolvedSymbol(expr.left) !== symbol) { return type; } // Check that right operand is a function type with a prototype property @@ -18276,13 +18623,17 @@ var ts; return type; } function getNarrowedType(originalType, narrowedTypeCandidate) { - // Narrow to the target type if it's a subtype of the current type - if (isTypeSubtypeOf(narrowedTypeCandidate, originalType)) { - return narrowedTypeCandidate; - } - // If the current type is a union type, remove all constituents that aren't subtypes of the target. + // If the current type is a union type, remove all constituents that aren't assignable to target. If that produces + // 0 candidates, fall back to the assignability check if (originalType.flags & 16384 /* Union */) { - return getUnionType(ts.filter(originalType.types, function (t) { return isTypeSubtypeOf(t, narrowedTypeCandidate); })); + var assignableConstituents = ts.filter(originalType.types, function (t) { return isTypeAssignableTo(t, narrowedTypeCandidate); }); + if (assignableConstituents.length) { + return getUnionType(assignableConstituents); + } + } + if (isTypeAssignableTo(narrowedTypeCandidate, originalType)) { + // Narrow to the target type if it's assignable to the current type + return narrowedTypeCandidate; } return originalType; } @@ -18308,27 +18659,27 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 165 /* CallExpression */: + case 166 /* CallExpression */: return narrowTypeByTypePredicate(type, expr, assumeTrue); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: var operator = expr.operatorToken.kind; - if (operator === 31 /* EqualsEqualsEqualsToken */ || operator === 32 /* ExclamationEqualsEqualsToken */) { + if (operator === 32 /* EqualsEqualsEqualsToken */ || operator === 33 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); } - else if (operator === 49 /* AmpersandAmpersandToken */) { + else if (operator === 50 /* AmpersandAmpersandToken */) { return narrowTypeByAnd(type, expr, assumeTrue); } - else if (operator === 50 /* BarBarToken */) { + else if (operator === 51 /* BarBarToken */) { return narrowTypeByOr(type, expr, assumeTrue); } - else if (operator === 88 /* InstanceOfKeyword */) { + else if (operator === 89 /* InstanceOfKeyword */) { return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 176 /* PrefixUnaryExpression */: - if (expr.operator === 47 /* ExclamationToken */) { + case 177 /* PrefixUnaryExpression */: + if (expr.operator === 48 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -18346,7 +18697,7 @@ var ts; // can explicitly bound arguments objects if (symbol === argumentsSymbol) { var container = ts.getContainingFunction(node); - if (container.kind === 171 /* ArrowFunction */) { + if (container.kind === 172 /* ArrowFunction */) { if (languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } @@ -18377,7 +18728,7 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & 2 /* BlockScopedVariable */) === 0 || - symbol.valueDeclaration.parent.kind === 241 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 242 /* CatchClause */) { return; } // - check if binding is used in some function @@ -18386,19 +18737,19 @@ var ts; // nesting structure: // (variable declaration or binding element) -> variable declaration list -> container var container = symbol.valueDeclaration; - while (container.kind !== 209 /* VariableDeclarationList */) { + while (container.kind !== 210 /* VariableDeclarationList */) { container = container.parent; } // get the parent of variable declaration list container = container.parent; - if (container.kind === 190 /* VariableStatement */) { + if (container.kind === 191 /* VariableStatement */) { // if parent is variable statement - get its parent container = container.parent; } var inFunction = isInsideFunction(node.parent, container); var current = container; while (current && !ts.nodeStartsNewLexicalEnvironment(current)) { - if (isIterationStatement(current, false)) { + if (isIterationStatement(current, /*lookInLabeledStatements*/ false)) { if (inFunction) { grammarErrorOnFirstToken(current, ts.Diagnostics.Loop_contains_block_scoped_variable_0_referenced_by_a_function_in_the_loop_This_is_only_supported_in_ECMAScript_6_or_higher, ts.declarationNameToString(node)); } @@ -18411,7 +18762,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 138 /* PropertyDeclaration */ || container.kind === 141 /* Constructor */) { + if (container.kind === 139 /* PropertyDeclaration */ || container.kind === 142 /* Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } @@ -18422,35 +18773,35 @@ var ts; function checkThisExpression(node) { // Stop at the first arrow function so that we can // tell whether 'this' needs to be captured. - var container = ts.getThisContainer(node, true); + var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var needToCaptureLexicalThis = false; // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 171 /* ArrowFunction */) { - container = ts.getThisContainer(container, false); + if (container.kind === 172 /* ArrowFunction */) { + container = ts.getThisContainer(container, /* includeArrowFunctions */ false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); } switch (container.kind) { - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 141 /* Constructor */: + case 142 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -18465,98 +18816,105 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 135 /* Parameter */) { + if (n.kind === 136 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 165 /* CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 166 /* CallExpression */ && node.parent.expression === node; var classDeclaration = ts.getContainingClass(node); var classType = classDeclaration && getDeclaredTypeOfSymbol(getSymbolOfNode(classDeclaration)); var baseClassType = classType && getBaseTypes(classType)[0]; + var container = ts.getSuperContainer(node, /*includeFunctions*/ true); + var needToCaptureLexicalThis = false; + if (!isCallExpression) { + // adjust the container reference in case if super is used inside arrow functions with arbitrary deep nesting + while (container && container.kind === 172 /* ArrowFunction */) { + container = ts.getSuperContainer(container, /*includeFunctions*/ true); + needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; + } + } + var canUseSuperExpression = isLegalUsageOfSuperExpression(container); + var nodeCheckFlag = 0; + // always set NodeCheckFlags for 'super' expression node + if (canUseSuperExpression) { + if ((container.flags & 128 /* Static */) || isCallExpression) { + nodeCheckFlag = 512 /* SuperStatic */; + } + else { + nodeCheckFlag = 256 /* SuperInstance */; + } + getNodeLinks(node).flags |= nodeCheckFlag; + if (needToCaptureLexicalThis) { + // call expressions are allowed only in constructors so they should always capture correct 'this' + // super property access expressions can also appear in arrow functions - + // in this case they should also use correct lexical this + captureLexicalThis(node.parent, container); + } + } if (!baseClassType) { if (!classDeclaration || !ts.getClassExtendsHeritageClauseElement(classDeclaration)) { 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; - var needToCaptureLexicalThis; + if (!canUseSuperExpression) { + if (container && container.kind === 134 /* ComputedPropertyName */) { + 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; + } + if (container.kind === 142 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + return unknownType; + } + return nodeCheckFlag === 512 /* SuperStatic */ + ? getBaseConstructorTypeOfClass(classType) + : baseClassType; + function isLegalUsageOfSuperExpression(container) { + if (!container) { + return false; + } if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - canUseSuperExpression = container.kind === 141 /* Constructor */; + return container.kind === 142 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) // 'super' property access is allowed // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor - // super property access might appear in arrow functions with arbitrary deep nesting - needToCaptureLexicalThis = false; - while (container && container.kind === 171 /* ArrowFunction */) { - container = ts.getSuperContainer(container, true); - needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; - } // topmost container must be something that is directly nested in the class declaration if (container && ts.isClassLike(container.parent)) { if (container.flags & 128 /* Static */) { - canUseSuperExpression = - container.kind === 140 /* MethodDeclaration */ || - container.kind === 139 /* MethodSignature */ || - container.kind === 142 /* GetAccessor */ || - container.kind === 143 /* SetAccessor */; + return container.kind === 141 /* MethodDeclaration */ || + container.kind === 140 /* MethodSignature */ || + container.kind === 143 /* GetAccessor */ || + container.kind === 144 /* SetAccessor */; } else { - canUseSuperExpression = - container.kind === 140 /* MethodDeclaration */ || - container.kind === 139 /* MethodSignature */ || - container.kind === 142 /* GetAccessor */ || - container.kind === 143 /* SetAccessor */ || - container.kind === 138 /* PropertyDeclaration */ || - container.kind === 137 /* PropertySignature */ || - container.kind === 141 /* Constructor */; + return container.kind === 141 /* MethodDeclaration */ || + container.kind === 140 /* MethodSignature */ || + container.kind === 143 /* GetAccessor */ || + container.kind === 144 /* SetAccessor */ || + container.kind === 139 /* PropertyDeclaration */ || + container.kind === 138 /* PropertySignature */ || + container.kind === 142 /* Constructor */; } } } - if (canUseSuperExpression) { - var returnType; - if ((container.flags & 128 /* Static */) || isCallExpression) { - getNodeLinks(node).flags |= 512 /* SuperStatic */; - returnType = getBaseConstructorTypeOfClass(classType); - } - else { - getNodeLinks(node).flags |= 256 /* SuperInstance */; - returnType = baseClassType; - } - if (container.kind === 141 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { - // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) - error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); - returnType = unknownType; - } - if (!isCallExpression && needToCaptureLexicalThis) { - // call expressions are allowed only in constructors so they should always capture correct 'this' - // super property access expressions can also appear in arrow functions - - // in this case they should also use correct lexical this - captureLexicalThis(node.parent, container); - } - return returnType; - } - } - if (container && container.kind === 133 /* ComputedPropertyName */) { - 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 false; } - return unknownType; } // Return contextual type of parameter or undefined if no contextual type is available function getContextuallyTypedParameterType(parameter) { @@ -18592,7 +18950,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 135 /* Parameter */) { + if (declaration.kind === 136 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -18625,7 +18983,7 @@ var ts; } function isInParameterInitializerBeforeContainingFunction(node) { while (node.parent && !ts.isFunctionLike(node.parent)) { - if (node.parent.kind === 135 /* Parameter */ && node.parent.initializer === node) { + if (node.parent.kind === 136 /* Parameter */ && node.parent.initializer === node) { return true; } node = node.parent; @@ -18636,8 +18994,8 @@ var ts; // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed if (functionDecl.type || - functionDecl.kind === 141 /* Constructor */ || - functionDecl.kind === 142 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 143 /* SetAccessor */))) { + functionDecl.kind === 142 /* Constructor */ || + functionDecl.kind === 143 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(functionDecl.symbol, 144 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -18659,7 +19017,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 167 /* TaggedTemplateExpression */) { + if (template.parent.kind === 168 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -18667,13 +19025,13 @@ var ts; function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; var operator = binaryExpression.operatorToken.kind; - if (operator >= 54 /* FirstAssignment */ && operator <= 65 /* LastAssignment */) { + if (operator >= 55 /* FirstAssignment */ && operator <= 66 /* LastAssignment */) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); } } - else if (operator === 50 /* BarBarToken */) { + else if (operator === 51 /* BarBarToken */) { // When an || expression has a contextual type, the operands are contextually typed by that type. When an || // expression has no contextual type, the right operand is contextually typed by the type of the left operand. var type = getContextualType(binaryExpression); @@ -18769,7 +19127,7 @@ var ts; var index = ts.indexOf(arrayLiteral.elements, node); return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1 /* Number */) - || (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(type, undefined) : undefined); + || (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(type, /*errorNode*/ undefined) : undefined); } return undefined; } @@ -18780,7 +19138,7 @@ var ts; } function getContextualTypeForJsxExpression(expr) { // Contextual type only applies to JSX expressions that are in attribute assignments (not in 'Children' positions) - if (expr.parent.kind === 235 /* JsxAttribute */) { + if (expr.parent.kind === 236 /* JsxAttribute */) { var attrib = expr.parent; var attrsType = getJsxElementAttributesType(attrib.parent); if (!attrsType || isTypeAny(attrsType)) { @@ -18790,7 +19148,7 @@ var ts; return getTypeOfPropertyOfType(attrsType, attrib.name.text); } } - if (expr.kind === 236 /* JsxSpreadAttribute */) { + if (expr.kind === 237 /* JsxSpreadAttribute */) { return getJsxElementAttributesType(expr.parent); } return undefined; @@ -18811,38 +19169,38 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 208 /* VariableDeclaration */: - case 135 /* Parameter */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 136 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 161 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 171 /* ArrowFunction */: - case 201 /* ReturnStatement */: + case 172 /* ArrowFunction */: + case 202 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: return getContextualTypeForYieldOperand(parent); - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: return getTypeFromTypeNode(parent.type); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 242 /* PropertyAssignment */: + case 243 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 187 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 180 /* TemplateExpression */); + case 188 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 181 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return getContextualType(parent); - case 237 /* JsxExpression */: - case 236 /* JsxSpreadAttribute */: + case 238 /* JsxExpression */: + case 237 /* JsxSpreadAttribute */: return getContextualTypeForJsxExpression(parent); } return undefined; @@ -18859,7 +19217,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 170 /* FunctionExpression */ || node.kind === 171 /* ArrowFunction */; + return node.kind === 171 /* FunctionExpression */ || node.kind === 172 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions, arrow functions, and object literal methods are contextually typed. @@ -18873,7 +19231,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 140 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -18887,19 +19245,13 @@ var ts; var types = type.types; for (var _i = 0; _i < types.length; _i++) { var current = types[_i]; - // The signature set of all constituent type with call signatures should match - // So number of signatures allowed is either 0 or 1 - if (signatureList && - getSignaturesOfStructuredType(current, 0 /* Call */).length > 1) { - return undefined; - } var signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { + else if (!compareSignatures(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypes)) { // Signatures aren't identical, do not use return undefined; } @@ -18919,23 +19271,36 @@ var ts; } return result; } - // Presence of a contextual type mapper indicates inferential typing, except the identityMapper object is - // used as a special marker for other purposes. + /** + * Detect if the mapper implies an inference context. Specifically, there are 4 possible values + * for a mapper. Let's go through each one of them: + * + * 1. undefined - this means we are not doing inferential typing, but we may do contextual typing, + * which could cause us to assign a parameter a type + * 2. identityMapper - means we want to avoid assigning a parameter a type, whether or not we are in + * inferential typing (context is undefined for the identityMapper) + * 3. a mapper created by createInferenceMapper - we are doing inferential typing, we want to assign + * types to parameters and fix type parameters (context is defined) + * 4. an instantiation mapper created by createTypeMapper or createTypeEraser - this should never be + * passed as the contextual mapper when checking an expression (context is undefined for these) + * + * isInferentialContext is detecting if we are in case 3 + */ function isInferentialContext(mapper) { - return mapper && mapper !== identityMapper; + return mapper && mapper.context; } // A node is an assignment target if it is on the left hand side of an '=' token, if it is parented by a property // assignment in an object literal that is an assignment target, or if it is parented by an array literal that is // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 178 /* BinaryExpression */ && parent.operatorToken.kind === 54 /* EqualsToken */ && parent.left === node) { + if (parent.kind === 179 /* BinaryExpression */ && parent.operatorToken.kind === 55 /* EqualsToken */ && parent.left === node) { return true; } - if (parent.kind === 242 /* PropertyAssignment */) { + if (parent.kind === 243 /* PropertyAssignment */) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 161 /* ArrayLiteralExpression */) { + if (parent.kind === 162 /* ArrayLiteralExpression */) { return isAssignmentTarget(parent); } return false; @@ -18948,7 +19313,7 @@ var ts; // So the fact that contextualMapper is passed is not important, because the operand of a spread // element is not contextually typed. var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper); - return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false); + return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false); } function checkArrayLiteral(node, contextualMapper) { var elements = node.elements; @@ -18960,7 +19325,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 182 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 183 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -18975,7 +19340,7 @@ var ts; // if there is no index type / iterated type. var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1 /* Number */) || - (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(restArrayType, undefined) : undefined); + (languageVersion >= 2 /* ES6 */ ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined); if (restElementType) { elementTypes.push(restElementType); } @@ -18984,7 +19349,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 182 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 183 /* SpreadElementExpression */; } if (!hasSpreadElement) { var contextualType = getContextualType(node); @@ -18995,7 +19360,7 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 133 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 134 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -19035,11 +19400,11 @@ var ts; links.resolvedType = checkExpression(node.expression); // 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 (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 /* NumberLike */ | 258 /* StringLike */ | 4194304 /* ESSymbol */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 132 /* NumberLike */ | 258 /* StringLike */ | 16777216 /* ESSymbol */)) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { - checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true); } } return links.resolvedType; @@ -19054,18 +19419,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 242 /* PropertyAssignment */ || - memberDecl.kind === 243 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 243 /* PropertyAssignment */ || + memberDecl.kind === 244 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 242 /* PropertyAssignment */) { + if (memberDecl.kind === 243 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 140 /* MethodDeclaration */) { + else if (memberDecl.kind === 141 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 243 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 244 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -19085,7 +19450,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 142 /* GetAccessor */ || memberDecl.kind === 143 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 143 /* GetAccessor */ || memberDecl.kind === 144 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -19096,7 +19461,7 @@ var ts; var stringIndexType = getIndexType(0 /* String */); var numberIndexType = getIndexType(1 /* Number */); var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); - result.flags |= 524288 /* ObjectLiteral */ | 2097152 /* ContainsObjectLiteral */ | (typeFlags & 1048576 /* ContainsUndefinedOrNull */); + result.flags |= 524288 /* ObjectLiteral */ | 1048576 /* FreshObjectLiteral */ | 4194304 /* ContainsObjectLiteral */ | (typeFlags & 14680064 /* PropagatingFlags */); return result; function getIndexType(kind) { if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { @@ -19129,35 +19494,39 @@ var ts; if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 66 /* Identifier */) { + if (lhs.kind === 67 /* Identifier */) { return lhs.text === rhs.text; } return lhs.right.text === rhs.right.text && tagNamesAreEquivalent(lhs.left, rhs.left); } function checkJsxElement(node) { + // Check attributes + checkJsxOpeningLikeElement(node.openingElement); // Check that the closing tag matches if (!tagNamesAreEquivalent(node.openingElement.tagName, node.closingElement.tagName)) { error(node.closingElement, ts.Diagnostics.Expected_corresponding_JSX_closing_tag_for_0, ts.getTextOfNode(node.openingElement.tagName)); } - // Check attributes - checkJsxOpeningLikeElement(node.openingElement); + else { + // Perform resolution on the closing tag so that rename/go to definition/etc work + getJsxElementTagSymbol(node.closingElement); + } // Check children for (var _i = 0, _a = node.children; _i < _a.length; _i++) { var child = _a[_i]; switch (child.kind) { - case 237 /* JsxExpression */: + case 238 /* JsxExpression */: checkJsxExpression(child); break; - case 230 /* JsxElement */: + case 231 /* JsxElement */: checkJsxElement(child); break; - case 231 /* JsxSelfClosingElement */: + case 232 /* JsxSelfClosingElement */: checkJsxSelfClosingElement(child); break; default: // No checks for JSX Text - ts.Debug.assert(child.kind === 233 /* JsxText */); + ts.Debug.assert(child.kind === 234 /* JsxText */); } } return jsxElementType || anyType; @@ -19173,7 +19542,7 @@ var ts; * Returns true iff React would emit this tag name as a string rather than an identifier or qualified name */ function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 132 /* QualifiedName */) { + if (tagName.kind === 133 /* QualifiedName */) { return false; } else { @@ -19190,10 +19559,19 @@ var ts; else if (elementAttributesType && !isTypeAny(elementAttributesType)) { var correspondingPropSymbol = getPropertyOfType(elementAttributesType, node.name.text); correspondingPropType = correspondingPropSymbol && getTypeOfSymbol(correspondingPropSymbol); - // If there's no corresponding property with this name, error - if (!correspondingPropType && isUnhyphenatedJsxName(node.name.text)) { - error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); - return unknownType; + if (isUnhyphenatedJsxName(node.name.text)) { + // Maybe there's a string indexer? + var indexerType = getIndexTypeOfType(elementAttributesType, 0 /* String */); + if (indexerType) { + correspondingPropType = indexerType; + } + else { + // If there's no corresponding property with this name, error + if (!correspondingPropType) { + error(node.name, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.name.text, typeToString(elementAttributesType)); + return unknownType; + } + } } } var exprType; @@ -19269,7 +19647,7 @@ var ts; return intrinsicElementsType.symbol; } // Wasn't found - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, 'JSX.' + JsxNames.IntrinsicElements); + error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); return unknownSymbol; } else { @@ -19279,22 +19657,24 @@ var ts; } } function lookupClassTag(node) { - var valueSymbol; + var valueSymbol = resolveJsxTagName(node); // Look up the value in the current scope - if (node.tagName.kind === 66 /* Identifier */) { - var tag = node.tagName; - var sym = getResolvedSymbol(tag); - valueSymbol = sym.exportSymbol || sym; - } - else { - valueSymbol = checkQualifiedName(node.tagName).symbol; - } if (valueSymbol && valueSymbol !== unknownSymbol) { links.jsxFlags |= 4 /* ClassElement */; getSymbolLinks(valueSymbol).referenced = true; } return valueSymbol || unknownSymbol; } + function resolveJsxTagName(node) { + if (node.tagName.kind === 67 /* Identifier */) { + var tag = node.tagName; + var sym = getResolvedSymbol(tag); + return sym.exportSymbol || sym; + } + else { + return checkQualifiedName(node.tagName).symbol; + } + } } /** * Given a JSX element that is a class element, finds the Element Instance Type. If the @@ -19302,10 +19682,9 @@ var ts; * For example, in the element , the element instance type is `MyClass` (not `typeof MyClass`). */ function getJsxElementInstanceType(node) { - if (!(getNodeLinks(node).jsxFlags & 4 /* ClassElement */)) { - // There is no such thing as an instance type for a non-class element - return undefined; - } + // There is no such thing as an instance type for a non-class element. This + // line shouldn't be hit. + ts.Debug.assert(!!(getNodeLinks(node).jsxFlags & 4 /* ClassElement */), "Should not call getJsxElementInstanceType on non-class Element"); var classSymbol = getJsxElementTagSymbol(node); if (classSymbol === unknownSymbol) { // Couldn't find the class instance type. Error has already been issued @@ -19324,15 +19703,10 @@ var ts; if (signatures.length === 0) { // We found no signatures at all, which is an error error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName)); - return undefined; + return unknownType; } } - // Check that the constructor/factory returns an object type - var returnType = getUnionType(signatures.map(function (s) { return getReturnTypeOfSignature(s); })); - if (!isTypeAny(returnType) && !(returnType.flags & 80896 /* ObjectType */)) { - error(node.tagName, ts.Diagnostics.The_return_type_of_a_JSX_element_constructor_must_return_an_object_type); - return undefined; - } + var returnType = getUnionType(signatures.map(getReturnTypeOfSignature)); // Issue an error if this return type isn't assignable to JSX.ElementClass var elemClassType = getJsxGlobalElementClassType(); if (elemClassType) { @@ -19347,7 +19721,7 @@ var ts; /// non-instrinsic elements' attributes type is the element instance type) function getJsxElementPropertiesName() { // JSX - var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536 /* Namespace */, undefined); + var jsxNamespace = getGlobalSymbol(JsxNames.JSX, 1536 /* Namespace */, /*diagnosticMessage*/ undefined); // JSX.ElementAttributesProperty [symbol] var attribsPropTypeSym = jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementAttributesPropertyNameContainer, 793056 /* Type */); // JSX.ElementAttributesProperty [type] @@ -19383,7 +19757,7 @@ var ts; if (links.jsxFlags & 4 /* ClassElement */) { var elemInstanceType = getJsxElementInstanceType(node); if (isTypeAny(elemInstanceType)) { - return links.resolvedJsxType = anyType; + return links.resolvedJsxType = elemInstanceType; } var propsName = getJsxElementPropertiesName(); if (propsName === undefined) { @@ -19465,7 +19839,7 @@ var ts; // be marked as 'used' so we don't incorrectly elide its import. And if there // is no 'React' symbol in scope, we should issue an error. if (compilerOptions.jsx === 2 /* React */) { - var reactSym = resolveName(node.tagName, 'React', 107455 /* Value */, ts.Diagnostics.Cannot_find_name_0, 'React'); + var reactSym = resolveName(node.tagName, "React", 107455 /* Value */, ts.Diagnostics.Cannot_find_name_0, "React"); if (reactSym) { getSymbolLinks(reactSym).referenced = true; } @@ -19477,11 +19851,11 @@ var ts; // thus should have their types ignored var sawSpreadedAny = false; for (var i = node.attributes.length - 1; i >= 0; i--) { - if (node.attributes[i].kind === 235 /* JsxAttribute */) { + if (node.attributes[i].kind === 236 /* JsxAttribute */) { checkJsxAttribute((node.attributes[i]), targetAttributesType, nameTable); } else { - ts.Debug.assert(node.attributes[i].kind === 236 /* JsxSpreadAttribute */); + ts.Debug.assert(node.attributes[i].kind === 237 /* JsxSpreadAttribute */); var spreadType = checkJsxSpreadAttribute((node.attributes[i]), targetAttributesType, nameTable); if (isTypeAny(spreadType)) { sawSpreadedAny = true; @@ -19511,7 +19885,7 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 138 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 139 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; @@ -19527,8 +19901,8 @@ var ts; function checkClassPropertyAccess(node, left, type, prop) { var flags = getDeclarationFlagsFromSymbol(prop); var declaringClass = getDeclaredTypeOfSymbol(prop.parent); - if (left.kind === 92 /* SuperKeyword */) { - var errorNode = node.kind === 163 /* PropertyAccessExpression */ ? + if (left.kind === 93 /* SuperKeyword */) { + var errorNode = node.kind === 164 /* PropertyAccessExpression */ ? node.name : node.right; // TS 1.0 spec (April 2014): 4.8.2 @@ -19538,7 +19912,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (getDeclarationKindFromSymbol(prop) !== 140 /* MethodDeclaration */) { + if (getDeclarationKindFromSymbol(prop) !== 141 /* MethodDeclaration */) { // `prop` refers to a *property* declared in the super class // rather than a *method*, so it does not satisfy the above criteria. error(errorNode, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); @@ -19571,7 +19945,7 @@ var ts; } // Property is known to be protected at this point // All protected properties of a supertype are accessible in a super access - if (left.kind === 92 /* SuperKeyword */) { + if (left.kind === 93 /* SuperKeyword */) { return true; } // A protected property is accessible in the declaring class and classes derived from it @@ -19621,7 +19995,7 @@ var ts; return getTypeOfSymbol(prop); } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 163 /* PropertyAccessExpression */ + var left = node.kind === 164 /* PropertyAccessExpression */ ? node.expression : node.left; var type = checkExpression(left); @@ -19637,7 +20011,7 @@ var ts; // Grammar checking if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 166 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 167 /* NewExpression */ && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -19656,7 +20030,7 @@ var ts; } var isConstEnum = isConstEnumObjectType(objectType); if (isConstEnum && - (!node.argumentExpression || node.argumentExpression.kind !== 8 /* StringLiteral */)) { + (!node.argumentExpression || node.argumentExpression.kind !== 9 /* StringLiteral */)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } @@ -19684,7 +20058,7 @@ var ts; } } // Check for compatible indexer types. - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 /* StringLike */ | 132 /* NumberLike */ | 4194304 /* ESSymbol */)) { + if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 258 /* StringLike */ | 132 /* NumberLike */ | 16777216 /* ESSymbol */)) { // Try to use a number indexer. if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 132 /* NumberLike */)) { var numberIndexType = getIndexTypeOfType(objectType, 1 /* Number */); @@ -19714,10 +20088,10 @@ var ts; * Otherwise, returns undefined. */ function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { - if (indexArgumentExpression.kind === 8 /* StringLiteral */ || indexArgumentExpression.kind === 7 /* NumericLiteral */) { + if (indexArgumentExpression.kind === 9 /* StringLiteral */ || indexArgumentExpression.kind === 8 /* NumericLiteral */) { return indexArgumentExpression.text; } - if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { var rightHandSideName = indexArgumentExpression.name.text; return ts.getPropertyNameForKnownSymbolName(rightHandSideName); } @@ -19739,7 +20113,7 @@ var ts; return false; } // Make sure the property type is the primitive symbol type - if ((expressionType.flags & 4194304 /* ESSymbol */) === 0) { + if ((expressionType.flags & 16777216 /* ESSymbol */) === 0) { if (reportError) { error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); } @@ -19766,10 +20140,10 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 167 /* TaggedTemplateExpression */) { + if (node.kind === 168 /* TaggedTemplateExpression */) { checkExpression(node.template); } - else if (node.kind !== 136 /* Decorator */) { + else if (node.kind !== 137 /* Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -19799,13 +20173,13 @@ var ts; for (var _i = 0; _i < signatures.length; _i++) { var signature = signatures[_i]; var symbol = signature.declaration && getSymbolOfNode(signature.declaration); - var parent_6 = signature.declaration && signature.declaration.parent; + var parent_5 = signature.declaration && signature.declaration.parent; if (!lastSymbol || symbol === lastSymbol) { - if (lastParent && parent_6 === lastParent) { + if (lastParent && parent_5 === lastParent) { index++; } else { - lastParent = parent_6; + lastParent = parent_5; index = cutoffIndex; } } @@ -19813,7 +20187,7 @@ var ts; // current declaration belongs to a different symbol // set cutoffIndex so re-orderings in the future won't change result set from 0 to cutoffIndex index = cutoffIndex = result.length; - lastParent = parent_6; + lastParent = parent_5; } lastSymbol = symbol; // specialized signatures always need to be placed before non-specialized signatures regardless @@ -19835,7 +20209,7 @@ var ts; function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg && arg.kind === 182 /* SpreadElementExpression */) { + if (arg && arg.kind === 183 /* SpreadElementExpression */) { return i; } } @@ -19847,13 +20221,13 @@ var ts; var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments var isDecorator; var spreadArgIndex = -1; - if (node.kind === 167 /* TaggedTemplateExpression */) { + if (node.kind === 168 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 180 /* TemplateExpression */) { + if (tagExpression.template.kind === 181 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -19866,20 +20240,20 @@ var ts; // then this might actually turn out to be a TemplateHead in the future; // so we consider the call to be incomplete. var templateLiteral = tagExpression.template; - ts.Debug.assert(templateLiteral.kind === 10 /* NoSubstitutionTemplateLiteral */); + ts.Debug.assert(templateLiteral.kind === 11 /* NoSubstitutionTemplateLiteral */); callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 136 /* Decorator */) { + else if (node.kind === 137 /* Decorator */) { isDecorator = true; typeArguments = undefined; - adjustedArgCount = getEffectiveArgumentCount(node, undefined, signature); + adjustedArgCount = getEffectiveArgumentCount(node, /*args*/ undefined, signature); } else { var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 166 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 167 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -19922,7 +20296,7 @@ var ts; } // Instantiate a generic signature in the context of a non-generic signature (section 3.8.5 in TypeScript spec) function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature.typeParameters, true); + var context = createInferenceContext(signature.typeParameters, /*inferUnionTypes*/ true); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { // Type parameters from outer context referenced by source type are fixed by instantiation of the source type inferTypes(context, instantiateType(source, contextualMapper), target); @@ -19958,7 +20332,7 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 184 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 185 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type @@ -20017,14 +20391,14 @@ var ts; for (var i = 0; i < argCount; i++) { var arg = getEffectiveArgument(node, args, i); // If the effective argument is 'undefined', then it is an argument that is present but is synthetic. - if (arg === undefined || arg.kind !== 184 /* OmittedExpression */) { + if (arg === undefined || arg.kind !== 185 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); var argType = getEffectiveArgumentType(node, i, arg); // If the effective argument type is 'undefined', there is no synthetic type // for the argument. In that case, we should check the argument. if (argType === undefined) { - argType = arg.kind === 8 /* StringLiteral */ && !reportErrors + argType = arg.kind === 9 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); } @@ -20049,16 +20423,16 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 167 /* TaggedTemplateExpression */) { + if (node.kind === 168 /* TaggedTemplateExpression */) { var template = node.template; args = [undefined]; - if (template.kind === 180 /* TemplateExpression */) { + if (template.kind === 181 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); } } - else if (node.kind === 136 /* Decorator */) { + else if (node.kind === 137 /* Decorator */) { // For a decorator, we return undefined as we will determine // the number and types of arguments for a decorator using // `getEffectiveArgumentCount` and `getEffectiveArgumentType` below. @@ -20083,25 +20457,25 @@ var ts; * Otherwise, the argument count is the length of the 'args' array. */ function getEffectiveArgumentCount(node, args, signature) { - if (node.kind === 136 /* Decorator */) { + if (node.kind === 137 /* Decorator */) { switch (node.parent.kind) { - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: // A class decorator will have one argument (see `ClassDecorator` in core.d.ts) return 1; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: // A property declaration decorator will have two arguments (see // `PropertyDecorator` in core.d.ts) return 2; - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts) // If the method decorator signature only accepts a target and a key, we will only // type check those arguments. return signature.parameters.length >= 3 ? 3 : 2; - case 135 /* Parameter */: + case 136 /* Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts) return 3; @@ -20126,25 +20500,25 @@ var ts; function getEffectiveDecoratorFirstArgumentType(node) { // The first argument to a decorator is its `target`. switch (node.kind) { - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class) var classSymbol = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol); - case 135 /* Parameter */: + case 136 /* Parameter */: // For a parameter decorator, the `target` is the parent type of the // parameter's containing method. node = node.parent; - if (node.kind === 141 /* Constructor */) { + if (node.kind === 142 /* Constructor */) { var classSymbol_1 = getSymbolOfNode(node); return getTypeOfSymbol(classSymbol_1); } // fall-through - case 138 /* PropertyDeclaration */: - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: // For a property or method decorator, the `target` is the // "static"-side type of the parent of the member if the member is // declared "static"; otherwise, it is the "instance"-side type of the @@ -20173,35 +20547,35 @@ var ts; function getEffectiveDecoratorSecondArgumentType(node) { // The second argument to a decorator is its `propertyKey` switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: ts.Debug.fail("Class decorators should not have a second synthetic argument."); return unknownType; - case 135 /* Parameter */: + case 136 /* Parameter */: node = node.parent; - if (node.kind === 141 /* Constructor */) { + if (node.kind === 142 /* Constructor */) { // For a constructor parameter decorator, the `propertyKey` will be `undefined`. return anyType; } // For a non-constructor parameter decorator, the `propertyKey` will be either // a string or a symbol, based on the name of the parameter's containing method. // fall-through - case 138 /* PropertyDeclaration */: - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: // The `propertyKey` for a property or method decorator will be a // string literal type if the member name is an identifier, number, or string; // otherwise, if the member name is a computed property name it will // be either string or symbol. var element = node; switch (element.name.kind) { - case 66 /* Identifier */: - case 7 /* NumericLiteral */: - case 8 /* StringLiteral */: + case 67 /* Identifier */: + case 8 /* NumericLiteral */: + case 9 /* StringLiteral */: return getStringLiteralType(element.name); - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: var nameType = checkComputedPropertyName(element.name); - if (allConstituentTypesHaveKind(nameType, 4194304 /* ESSymbol */)) { + if (allConstituentTypesHaveKind(nameType, 16777216 /* ESSymbol */)) { return nameType; } else { @@ -20227,18 +20601,18 @@ var ts; // The third argument to a decorator is either its `descriptor` for a method decorator // or its `parameterIndex` for a paramter decorator switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: ts.Debug.fail("Class decorators should not have a third synthetic argument."); return unknownType; - case 135 /* Parameter */: + case 136 /* Parameter */: // The `parameterIndex` for a parameter decorator is always a number return numberType; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: ts.Debug.fail("Property decorators should not have a third synthetic argument."); return unknownType; - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: // The `descriptor` for a method decorator will be a `TypedPropertyDescriptor` // for the type of the member. var propertyType = getTypeOfNode(node); @@ -20271,10 +20645,10 @@ var ts; // Decorators provide special arguments, a tagged template expression provides // a special first argument, and string literals get string literal types // unless we're reporting errors - if (node.kind === 136 /* Decorator */) { + if (node.kind === 137 /* Decorator */) { return getEffectiveDecoratorArgumentType(node, argIndex); } - else if (argIndex === 0 && node.kind === 167 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */) { return globalTemplateStringsArrayType; } // This is not a synthetic argument, so we return 'undefined' @@ -20286,8 +20660,8 @@ var ts; */ function getEffectiveArgument(node, args, argIndex) { // For a decorator or the first argument of a tagged template expression we return undefined. - if (node.kind === 136 /* Decorator */ || - (argIndex === 0 && node.kind === 167 /* TaggedTemplateExpression */)) { + if (node.kind === 137 /* Decorator */ || + (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */)) { return undefined; } return args[argIndex]; @@ -20296,11 +20670,11 @@ var ts; * Gets the error node to use when reporting errors for an effective argument. */ function getEffectiveArgumentErrorNode(node, argIndex, arg) { - if (node.kind === 136 /* Decorator */) { + if (node.kind === 137 /* Decorator */) { // For a decorator, we use the expression of the decorator for error reporting. return node.expression; } - else if (argIndex === 0 && node.kind === 167 /* TaggedTemplateExpression */) { + else if (argIndex === 0 && node.kind === 168 /* TaggedTemplateExpression */) { // For a the first argument of a tagged template expression, we use the template of the tag for error reporting. return node.template; } @@ -20309,13 +20683,13 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray, headMessage) { - var isTaggedTemplate = node.kind === 167 /* TaggedTemplateExpression */; - var isDecorator = node.kind === 136 /* Decorator */; + var isTaggedTemplate = node.kind === 168 /* TaggedTemplateExpression */; + var isDecorator = node.kind === 137 /* Decorator */; var typeArguments; if (!isTaggedTemplate && !isDecorator) { typeArguments = node.typeArguments; // We already perform checking on the type arguments on the class declaration itself. - if (node.expression.kind !== 92 /* SuperKeyword */) { + if (node.expression.kind !== 93 /* SuperKeyword */) { ts.forEach(typeArguments, checkSourceElement); } } @@ -20412,17 +20786,18 @@ var ts; // in arguments too early. If possible, we'd like to only type them once we know the correct // overload. However, this matters for the case where the call is correct. When the call is // an error, we don't need to exclude any arguments, although it would cause no harm to do so. - checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, /*excludeArgument*/ undefined, /*reportErrors*/ true); } else if (candidateForTypeArgumentError) { if (!isTaggedTemplate && !isDecorator && typeArguments) { - checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true, headMessage); + checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], /*reportErrors*/ true, headMessage); } 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)); + var diagnosticChainHead = ts.chainDiagnosticMessages(/*details*/ undefined, // details will be provided by call to reportNoCommonSupertypeError + ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); if (headMessage) { diagnosticChainHead = ts.chainDiagnosticMessages(diagnosticChainHead, headMessage); } @@ -20441,6 +20816,9 @@ var ts; for (var _i = 0; _i < candidates.length; _i++) { var candidate = candidates[_i]; if (hasCorrectArity(node, args, candidate)) { + if (candidate.typeParameters && typeArguments) { + candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); + } return candidate; } } @@ -20463,7 +20841,7 @@ var ts; var candidate = void 0; var typeArgumentsAreValid = void 0; var inferenceContext = originalCandidate.typeParameters - ? createInferenceContext(originalCandidate.typeParameters, false) + ? createInferenceContext(originalCandidate.typeParameters, /*inferUnionTypes*/ false) : undefined; while (true) { candidate = originalCandidate; @@ -20471,7 +20849,7 @@ var ts; var typeArgumentTypes = void 0; if (typeArguments) { typeArgumentTypes = new Array(candidate.typeParameters.length); - typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, /*reportErrors*/ false); } else { inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext); @@ -20483,7 +20861,7 @@ var ts; } candidate = getSignatureInstantiation(candidate, typeArgumentTypes); } - if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, /*reportErrors*/ false)) { break; } var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; @@ -20518,7 +20896,7 @@ var ts; } } function resolveCallExpression(node, candidatesOutArray) { - if (node.expression.kind === 92 /* SuperKeyword */) { + if (node.expression.kind === 93 /* SuperKeyword */) { var superType = checkSuperExpression(node.expression); if (superType !== unknownType) { // In super call, the candidate signatures are the matching arity signatures of the base constructor function instantiated @@ -20592,7 +20970,7 @@ var ts; // Note, only class declarations can be declared abstract. // In the case of a merged class-module or class-interface declaration, // only the class declaration node will have the Abstract flag set. - var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 211 /* ClassDeclaration */); + var valueDecl = expressionType.symbol && ts.getDeclarationOfKind(expressionType.symbol, 212 /* ClassDeclaration */); if (valueDecl && valueDecl.flags & 256 /* Abstract */) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(valueDecl.name)); return resolveErrorCall(node); @@ -20651,16 +21029,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 135 /* Parameter */: + case 136 /* Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; } } @@ -20697,16 +21075,16 @@ var ts; // to correctly fill the candidatesOutArray. if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 165 /* CallExpression */) { + if (node.kind === 166 /* CallExpression */) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 166 /* NewExpression */) { + else if (node.kind === 167 /* NewExpression */) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 167 /* TaggedTemplateExpression */) { + else if (node.kind === 168 /* TaggedTemplateExpression */) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } - else if (node.kind === 136 /* Decorator */) { + else if (node.kind === 137 /* Decorator */) { links.resolvedSignature = resolveDecorator(node, candidatesOutArray); } else { @@ -20724,15 +21102,15 @@ var ts; // Grammar checking; stop grammar-checking if checkGrammarTypeArguments return true checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); var signature = getResolvedSignature(node); - if (node.expression.kind === 92 /* SuperKeyword */) { + if (node.expression.kind === 93 /* SuperKeyword */) { return voidType; } - if (node.kind === 166 /* NewExpression */) { + if (node.kind === 167 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 141 /* Constructor */ && - declaration.kind !== 145 /* ConstructSignature */ && - declaration.kind !== 150 /* ConstructorType */) { + declaration.kind !== 142 /* Constructor */ && + declaration.kind !== 146 /* ConstructSignature */ && + declaration.kind !== 151 /* ConstructorType */) { // When resolved signature is a call signature (and not a construct signature) the result type is any if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); @@ -20746,7 +21124,7 @@ var ts; return getReturnTypeOfSignature(getResolvedSignature(node)); } function checkAssertion(node) { - var exprType = checkExpression(node.expression); + var exprType = getRegularTypeOfObjectLiteral(checkExpression(node.expression)); var targetType = getTypeFromTypeNode(node.type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); @@ -20765,13 +21143,51 @@ var ts; 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); + var contextualParameterType = getTypeAtPosition(context, i); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { var parameter = ts.lastOrUndefined(signature.parameters); - var links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(ts.lastOrUndefined(context.parameters)), mapper); + var contextualParameterType = getTypeOfSymbol(ts.lastOrUndefined(context.parameters)); + assignTypeToParameterAndFixTypeParameters(parameter, contextualParameterType, mapper); + } + } + function assignTypeToParameterAndFixTypeParameters(parameter, contextualType, mapper) { + var links = getSymbolLinks(parameter); + if (!links.type) { + links.type = instantiateType(contextualType, mapper); + } + else if (isInferentialContext(mapper)) { + // Even if the parameter already has a type, it might be because it was given a type while + // processing the function as an argument to a prior signature during overload resolution. + // If this was the case, it may have caused some type parameters to be fixed. So here, + // we need to ensure that type parameters at the same positions get fixed again. This is + // done by calling instantiateType to attach the mapper to the contextualType, and then + // calling inferTypes to force a walk of contextualType so that all the correct fixing + // happens. The choice to pass in links.type may seem kind of arbitrary, but it serves + // to make sure that all the correct positions in contextualType are reached by the walk. + // Here is an example: + // + // interface Base { + // baseProp; + // } + // interface Derived extends Base { + // toBase(): Base; + // } + // + // var derived: Derived; + // + // declare function foo(x: T, func: (p: T) => T): T; + // declare function foo(x: T, func: (p: T) => T): T; + // + // var result = foo(derived, d => d.toBase()); + // + // We are typing d while checking the second overload. But we've already given d + // a type (Derived) from the first overload. However, we still want to fix the + // T in the second overload so that we do not infer Base as a candidate for T + // (inferring Base would make type argument inference inconsistent between the two + // overloads). + inferTypes(mapper.context, links.type, instantiateType(contextualType, mapper)); } } function createPromiseType(promisedType) { @@ -20791,7 +21207,7 @@ var ts; } var isAsync = ts.isAsyncFunctionLike(func); var type; - if (func.body.kind !== 189 /* Block */) { + if (func.body.kind !== 190 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -20910,7 +21326,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 205 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 206 /* ThrowStatement */); } // TypeScript Specification 1.0 (6.3) - July 2014 // An explicitly typed function whose return type isn't the Void or the Any type @@ -20925,7 +21341,7 @@ var ts; return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (ts.nodeIsMissing(func.body) || func.body.kind !== 189 /* Block */) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 190 /* Block */) { return; } var bodyBlock = func.body; @@ -20943,10 +21359,10 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 140 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 170 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 171 /* FunctionExpression */) { checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -20959,37 +21375,44 @@ var ts; } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); - // Check if function expression is contextually typed and assign parameter types if so - if (!(links.flags & 1024 /* ContextChecked */)) { + var contextSensitive = isContextSensitive(node); + var mightFixTypeParameters = contextSensitive && isInferentialContext(contextualMapper); + // Check if function expression is contextually typed and assign parameter types if so. + // See the comment in assignTypeToParameterAndFixTypeParameters to understand why we need to + // check mightFixTypeParameters. + if (mightFixTypeParameters || !(links.flags & 1024 /* ContextChecked */)) { var contextualSignature = getContextualSignature(node); // If a type check is started at a function expression that is an argument of a function call, obtaining the // contextual type may recursively get back to here during overload resolution of the call. If so, we will have // already assigned contextual types. - if (!(links.flags & 1024 /* ContextChecked */)) { + var contextChecked = !!(links.flags & 1024 /* ContextChecked */); + if (mightFixTypeParameters || !contextChecked) { links.flags |= 1024 /* ContextChecked */; if (contextualSignature) { var signature = getSignaturesOfType(type, 0 /* Call */)[0]; - if (isContextSensitive(node)) { + if (contextSensitive) { assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); } - if (!node.type && !signature.resolvedReturnType) { + if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) { var returnType = getReturnTypeFromBody(node, contextualMapper); if (!signature.resolvedReturnType) { signature.resolvedReturnType = returnType; } } } - checkSignatureDeclaration(node); + if (!contextChecked) { + checkSignatureDeclaration(node); + } } } - if (produceDiagnostics && node.kind !== 140 /* MethodDeclaration */ && node.kind !== 139 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 140 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 141 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var isAsync = ts.isAsyncFunctionLike(node); if (isAsync) { emitAwaiter = true; @@ -21011,7 +21434,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 189 /* Block */) { + if (node.body.kind === 190 /* Block */) { checkSourceElement(node.body); } else { @@ -21057,24 +21480,24 @@ var ts; // and property accesses(section 4.10). // All other expression constructs described in this chapter are classified as values. switch (n.kind) { - case 66 /* Identifier */: { + case 67 /* Identifier */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.3 // An identifier expression that references a variable or parameter is classified as a reference. // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; } - case 163 /* PropertyAccessExpression */: { + case 164 /* PropertyAccessExpression */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.10 // A property access expression is always classified as a reference. // NOTE (not in spec): assignment to enum members should not be allowed return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; } - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: // old compiler doesn't check indexed assess return true; - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -21082,22 +21505,22 @@ var ts; } function isConstVariableReference(n) { switch (n.kind) { - case 66 /* Identifier */: - case 163 /* PropertyAccessExpression */: { + case 67 /* Identifier */: + case 164 /* PropertyAccessExpression */: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 32768 /* Const */) !== 0; } - case 164 /* ElementAccessExpression */: { + case 165 /* ElementAccessExpression */: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); - if (symbol && index && index.kind === 8 /* StringLiteral */) { + if (symbol && index && index.kind === 9 /* StringLiteral */) { var name_12 = index.text; var prop = getPropertyOfType(getTypeOfSymbol(symbol), name_12); return prop && (prop.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 32768 /* Const */) !== 0; } return false; } - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return isConstVariableReference(n.expression); default: return false; @@ -21141,17 +21564,17 @@ var ts; function checkPrefixUnaryExpression(node) { var operandType = checkExpression(node.operand); switch (node.operator) { - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 48 /* TildeToken */: - if (someConstituentTypeHasKind(operandType, 4194304 /* ESSymbol */)) { + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 49 /* TildeToken */: + if (someConstituentTypeHasKind(operandType, 16777216 /* ESSymbol */)) { error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); } return numberType; - case 47 /* ExclamationToken */: + case 48 /* ExclamationToken */: return booleanType; - case 39 /* PlusPlusToken */: - case 40 /* MinusMinusToken */: + case 40 /* PlusPlusToken */: + case 41 /* MinusMinusToken */: var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); if (ok) { // run check only if former checks succeeded to avoid reporting cascading errors @@ -21217,7 +21640,7 @@ var 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 (allConstituentTypesHaveKind(leftType, 4194814 /* Primitive */)) { + if (allConstituentTypesHaveKind(leftType, 16777726 /* Primitive */)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -21231,7 +21654,7 @@ var 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 (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */ | 132 /* NumberLike */ | 4194304 /* ESSymbol */)) { + if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */ | 132 /* NumberLike */ | 16777216 /* ESSymbol */)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 80896 /* ObjectType */ | 512 /* TypeParameter */)) { @@ -21243,7 +21666,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 242 /* PropertyAssignment */ || p.kind === 243 /* ShorthandPropertyAssignment */) { + if (p.kind === 243 /* PropertyAssignment */ || p.kind === 244 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var name_13 = p.name; var type = isTypeAny(sourceType) @@ -21268,12 +21691,12 @@ var ts; // This elementType will be used if the specific property corresponding to this index is not // present (aka the tuple element property). This call also checks that the parentType is in // fact an iterable or array (depending on target language). - var elementType = checkIteratedTypeOrElementType(sourceType, node, false) || unknownType; + var elementType = checkIteratedTypeOrElementType(sourceType, node, /*allowStringInput*/ false) || unknownType; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 184 /* OmittedExpression */) { - if (e.kind !== 182 /* SpreadElementExpression */) { + if (e.kind !== 185 /* OmittedExpression */) { + if (e.kind !== 183 /* SpreadElementExpression */) { var propName = "" + i; var type = isTypeAny(sourceType) ? sourceType @@ -21298,7 +21721,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 178 /* BinaryExpression */ && restExpression.operatorToken.kind === 54 /* EqualsToken */) { + if (restExpression.kind === 179 /* BinaryExpression */ && restExpression.operatorToken.kind === 55 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -21311,14 +21734,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 178 /* BinaryExpression */ && target.operatorToken.kind === 54 /* EqualsToken */) { + if (target.kind === 179 /* BinaryExpression */ && target.operatorToken.kind === 55 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 162 /* ObjectLiteralExpression */) { + if (target.kind === 163 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 161 /* ArrayLiteralExpression */) { + if (target.kind === 162 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -21326,38 +21749,38 @@ var ts; 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); + checkTypeAssignableTo(sourceType, targetType, target, /*headMessage*/ undefined); } return sourceType; } function checkBinaryExpression(node, contextualMapper) { var operator = node.operatorToken.kind; - if (operator === 54 /* EqualsToken */ && (node.left.kind === 162 /* ObjectLiteralExpression */ || node.left.kind === 161 /* ArrayLiteralExpression */)) { + if (operator === 55 /* EqualsToken */ && (node.left.kind === 163 /* ObjectLiteralExpression */ || node.left.kind === 162 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); var rightType = checkExpression(node.right, contextualMapper); switch (operator) { - case 36 /* AsteriskToken */: - case 57 /* AsteriskEqualsToken */: - case 37 /* SlashToken */: - case 58 /* SlashEqualsToken */: - case 38 /* PercentToken */: - case 59 /* PercentEqualsToken */: - case 35 /* MinusToken */: - case 56 /* MinusEqualsToken */: - case 41 /* LessThanLessThanToken */: - case 60 /* LessThanLessThanEqualsToken */: - case 42 /* GreaterThanGreaterThanToken */: - case 61 /* GreaterThanGreaterThanEqualsToken */: - case 43 /* GreaterThanGreaterThanGreaterThanToken */: - case 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 45 /* BarToken */: - case 64 /* BarEqualsToken */: - case 46 /* CaretToken */: - case 65 /* CaretEqualsToken */: - case 44 /* AmpersandToken */: - case 63 /* AmpersandEqualsToken */: + case 37 /* AsteriskToken */: + case 58 /* AsteriskEqualsToken */: + case 38 /* SlashToken */: + case 59 /* SlashEqualsToken */: + case 39 /* PercentToken */: + case 60 /* PercentEqualsToken */: + case 36 /* MinusToken */: + case 57 /* MinusEqualsToken */: + case 42 /* LessThanLessThanToken */: + case 61 /* LessThanLessThanEqualsToken */: + case 43 /* GreaterThanGreaterThanToken */: + case 62 /* GreaterThanGreaterThanEqualsToken */: + case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 46 /* BarToken */: + case 65 /* BarEqualsToken */: + case 47 /* CaretToken */: + case 66 /* CaretEqualsToken */: + case 45 /* AmpersandToken */: + case 64 /* AmpersandEqualsToken */: // TypeScript 1.0 spec (April 2014): 4.15.1 // These operators require their operands to be of type Any, the Number primitive type, // or an enum type. Operands of an enum type are treated @@ -21385,8 +21808,8 @@ var ts; } } return numberType; - case 34 /* PlusToken */: - case 55 /* PlusEqualsToken */: + case 35 /* PlusToken */: + case 56 /* PlusEqualsToken */: // TypeScript 1.0 spec (April 2014): 4.15.2 // The binary + operator requires both operands to be of the Number primitive type or an enum type, // or at least one of the operands to be of type Any or the String primitive type. @@ -21420,44 +21843,44 @@ var ts; reportOperatorError(); return anyType; } - if (operator === 55 /* PlusEqualsToken */) { + if (operator === 56 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; - case 24 /* LessThanToken */: - case 26 /* GreaterThanToken */: - case 27 /* LessThanEqualsToken */: - case 28 /* GreaterThanEqualsToken */: + case 25 /* LessThanToken */: + case 27 /* GreaterThanToken */: + case 28 /* LessThanEqualsToken */: + case 29 /* GreaterThanEqualsToken */: if (!checkForDisallowedESSymbolOperand(operator)) { return booleanType; } // Fall through - case 29 /* EqualsEqualsToken */: - case 30 /* ExclamationEqualsToken */: - case 31 /* EqualsEqualsEqualsToken */: - case 32 /* ExclamationEqualsEqualsToken */: + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } return booleanType; - case 88 /* InstanceOfKeyword */: + case 89 /* InstanceOfKeyword */: return checkInstanceOfExpression(node, leftType, rightType); - case 87 /* InKeyword */: + case 88 /* InKeyword */: return checkInExpression(node, leftType, rightType); - case 49 /* AmpersandAmpersandToken */: + case 50 /* AmpersandAmpersandToken */: return rightType; - case 50 /* BarBarToken */: + case 51 /* BarBarToken */: return getUnionType([leftType, rightType]); - case 54 /* EqualsToken */: + case 55 /* EqualsToken */: checkAssignmentOperator(rightType); - return rightType; - case 23 /* CommaToken */: + return getRegularTypeOfObjectLiteral(rightType); + case 24 /* CommaToken */: return rightType; } // Return true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator) { - var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 4194304 /* ESSymbol */) ? node.left : - someConstituentTypeHasKind(rightType, 4194304 /* ESSymbol */) ? node.right : + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 16777216 /* ESSymbol */) ? node.left : + someConstituentTypeHasKind(rightType, 16777216 /* ESSymbol */) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); @@ -21467,21 +21890,21 @@ var ts; } function getSuggestedBooleanOperator(operator) { switch (operator) { - case 45 /* BarToken */: - case 64 /* BarEqualsToken */: - return 50 /* BarBarToken */; - case 46 /* CaretToken */: - case 65 /* CaretEqualsToken */: - return 32 /* ExclamationEqualsEqualsToken */; - case 44 /* AmpersandToken */: - case 63 /* AmpersandEqualsToken */: - return 49 /* AmpersandAmpersandToken */; + case 46 /* BarToken */: + case 65 /* BarEqualsToken */: + return 51 /* BarBarToken */; + case 47 /* CaretToken */: + case 66 /* CaretEqualsToken */: + return 33 /* ExclamationEqualsEqualsToken */; + case 45 /* AmpersandToken */: + case 64 /* AmpersandEqualsToken */: + return 50 /* AmpersandAmpersandToken */; default: return undefined; } } function checkAssignmentOperator(valueType) { - if (produceDiagnostics && operator >= 54 /* FirstAssignment */ && operator <= 65 /* LastAssignment */) { + if (produceDiagnostics && operator >= 55 /* FirstAssignment */ && operator <= 66 /* LastAssignment */) { // TypeScript 1.0 spec (April 2014): 4.17 // An assignment of the form // VarExpr = ValueExpr @@ -21492,7 +21915,7 @@ var ts; // Use default messages if (ok) { // to avoid cascading errors check assignability only if 'isReference' check succeeded and no errors were reported - checkTypeAssignableTo(valueType, leftType, node.left, undefined); + checkTypeAssignableTo(valueType, leftType, node.left, /*headMessage*/ undefined); } } } @@ -21530,7 +21953,7 @@ var ts; // If the user's code is syntactically correct, the func should always have a star. After all, // we are in a yield context. if (func && func.asteriskToken) { - var expressionType = checkExpressionCached(node.expression, undefined); + var expressionType = checkExpressionCached(node.expression, /*contextualMapper*/ undefined); var expressionElementType; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { @@ -21542,10 +21965,10 @@ var ts; if (func.type) { var signatureElementType = getElementTypeOfIterableIterator(getTypeFromTypeNode(func.type)) || anyType; if (nodeIsYieldStar) { - checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(expressionElementType, signatureElementType, node.expression, /*headMessage*/ undefined); } else { - checkTypeAssignableTo(expressionType, signatureElementType, node.expression, undefined); + checkTypeAssignableTo(expressionType, signatureElementType, node.expression, /*headMessage*/ undefined); } } } @@ -21588,7 +22011,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -21599,14 +22022,14 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { - if (contextualMapper && contextualMapper !== identityMapper) { + if (isInferentialContext(contextualMapper)) { var signature = getSingleCallSignature(type); if (signature && signature.typeParameters) { var contextualType = getContextualType(node); @@ -21629,7 +22052,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpression(node, contextualMapper) { var type; - if (node.kind === 132 /* QualifiedName */) { + if (node.kind === 133 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -21641,9 +22064,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 163 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 164 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 66 /* Identifier */ || node.kind === 132 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); 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); } @@ -21657,78 +22080,78 @@ var ts; } function checkExpressionWorker(node, contextualMapper) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return checkIdentifier(node); - case 94 /* ThisKeyword */: + case 95 /* ThisKeyword */: return checkThisExpression(node); - case 92 /* SuperKeyword */: + case 93 /* SuperKeyword */: return checkSuperExpression(node); - case 90 /* NullKeyword */: + case 91 /* NullKeyword */: return nullType; - case 96 /* TrueKeyword */: - case 81 /* FalseKeyword */: + case 97 /* TrueKeyword */: + case 82 /* FalseKeyword */: return booleanType; - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: return checkNumericLiteral(node); - case 180 /* TemplateExpression */: + case 181 /* TemplateExpression */: return checkTemplateExpression(node); - case 8 /* StringLiteral */: - case 10 /* NoSubstitutionTemplateLiteral */: + case 9 /* StringLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: return stringType; - case 9 /* RegularExpressionLiteral */: + case 10 /* RegularExpressionLiteral */: return globalRegExpType; - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 163 /* PropertyAccessExpression */: + case 164 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return checkCallExpression(node); - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: return checkClassExpression(node); - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 173 /* TypeOfExpression */: + case 174 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: return checkAssertion(node); - case 172 /* DeleteExpression */: + case 173 /* DeleteExpression */: return checkDeleteExpression(node); - case 174 /* VoidExpression */: + case 175 /* VoidExpression */: return checkVoidExpression(node); - case 175 /* AwaitExpression */: + case 176 /* AwaitExpression */: return checkAwaitExpression(node); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 177 /* PostfixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 182 /* SpreadElementExpression */: + case 183 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 184 /* OmittedExpression */: + case 185 /* OmittedExpression */: return undefinedType; - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: return checkYieldExpression(node); - case 237 /* JsxExpression */: + case 238 /* JsxExpression */: return checkJsxExpression(node); - case 230 /* JsxElement */: + case 231 /* JsxElement */: return checkJsxElement(node); - case 231 /* JsxSelfClosingElement */: + case 232 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node); - case 232 /* JsxOpeningElement */: + case 233 /* JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return unknownType; @@ -21757,7 +22180,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 141 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 142 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -21774,15 +22197,15 @@ var ts; if (!node.asteriskToken || !node.body) { return false; } - return node.kind === 140 /* MethodDeclaration */ || - node.kind === 210 /* FunctionDeclaration */ || - node.kind === 170 /* FunctionExpression */; + return node.kind === 141 /* MethodDeclaration */ || + node.kind === 211 /* FunctionDeclaration */ || + node.kind === 171 /* FunctionExpression */; } function getTypePredicateParameterIndex(parameterList, parameter) { if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 66 /* Identifier */ && + if (param.name.kind === 67 /* Identifier */ && param.name.text === parameter.text) { return i; } @@ -21792,31 +22215,31 @@ var ts; } function isInLegalTypePredicatePosition(node) { switch (node.parent.kind) { - case 171 /* ArrowFunction */: - case 144 /* CallSignature */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 149 /* FunctionType */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 172 /* ArrowFunction */: + case 145 /* CallSignature */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 150 /* FunctionType */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return node === node.parent.type; } return false; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 146 /* IndexSignature */) { + if (node.kind === 147 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 149 /* FunctionType */ || node.kind === 210 /* FunctionDeclaration */ || node.kind === 150 /* ConstructorType */ || - node.kind === 144 /* CallSignature */ || node.kind === 141 /* Constructor */ || - node.kind === 145 /* ConstructSignature */) { + else if (node.kind === 150 /* FunctionType */ || node.kind === 211 /* FunctionDeclaration */ || node.kind === 151 /* ConstructorType */ || + node.kind === 145 /* CallSignature */ || node.kind === 142 /* Constructor */ || + node.kind === 146 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); ts.forEach(node.parameters, checkParameter); if (node.type) { - if (node.type.kind === 147 /* TypePredicate */) { + if (node.type.kind === 148 /* TypePredicate */) { var typePredicate = getSignatureFromDeclaration(node).typePredicate; var typePredicateNode = node.type; if (isInLegalTypePredicatePosition(typePredicateNode)) { @@ -21825,7 +22248,7 @@ var ts; error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_a_rest_parameter); } else { - checkTypeAssignableTo(typePredicate.type, getTypeAtLocation(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); + checkTypeAssignableTo(typePredicate.type, getTypeOfNode(node.parameters[typePredicate.parameterIndex]), typePredicateNode.type); } } else if (typePredicateNode.parameterName) { @@ -21835,19 +22258,19 @@ var ts; if (hasReportedError) { break; } - if (param.name.kind === 158 /* ObjectBindingPattern */ || - param.name.kind === 159 /* ArrayBindingPattern */) { + if (param.name.kind === 159 /* ObjectBindingPattern */ || + param.name.kind === 160 /* ArrayBindingPattern */) { (function checkBindingPattern(pattern) { for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.name.kind === 66 /* Identifier */ && + if (element.name.kind === 67 /* Identifier */ && element.name.text === typePredicate.parameterName) { error(typePredicateNode.parameterName, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, typePredicate.parameterName); hasReportedError = true; break; } - else if (element.name.kind === 159 /* ArrayBindingPattern */ || - element.name.kind === 158 /* ObjectBindingPattern */) { + else if (element.name.kind === 160 /* ArrayBindingPattern */ || + element.name.kind === 159 /* ObjectBindingPattern */) { checkBindingPattern(element.name); } } @@ -21871,10 +22294,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 144 /* CallSignature */: + case 145 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -21902,7 +22325,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 212 /* InterfaceDeclaration */) { + if (node.kind === 213 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -21922,7 +22345,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 127 /* StringKeyword */: + case 128 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -21930,7 +22353,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 125 /* NumberKeyword */: + case 126 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -21979,56 +22402,80 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 165 /* CallExpression */ && n.expression.kind === 92 /* SuperKeyword */; + return n.kind === 166 /* CallExpression */ && n.expression.kind === 93 /* SuperKeyword */; + } + function containsSuperCallAsComputedPropertyName(n) { + return n.name && containsSuperCall(n.name); } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } - switch (n.kind) { - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: - case 162 /* ObjectLiteralExpression */: return false; - default: return ts.forEachChild(n, containsSuperCall); + else if (ts.isFunctionLike(n)) { + return false; + } + else if (ts.isClassLike(n)) { + return ts.forEach(n.members, containsSuperCallAsComputedPropertyName); } + return ts.forEachChild(n, containsSuperCall); } function markThisReferencesAsErrors(n) { - if (n.kind === 94 /* ThisKeyword */) { + if (n.kind === 95 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 170 /* FunctionExpression */ && n.kind !== 210 /* FunctionDeclaration */) { + else if (n.kind !== 171 /* FunctionExpression */ && n.kind !== 211 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 138 /* PropertyDeclaration */ && + return n.kind === 139 /* PropertyDeclaration */ && !(n.flags & 128 /* Static */) && !!n.initializer; } // TS 1.0 spec (April 2014): 8.3.2 // Constructors of classes with no extends clause may not contain super calls, whereas // constructors of derived classes must contain at least one super call somewhere in their function body. - if (ts.getClassExtendsHeritageClauseElement(node.parent)) { + var containingClassDecl = node.parent; + if (ts.getClassExtendsHeritageClauseElement(containingClassDecl)) { + var containingClassSymbol = getSymbolOfNode(containingClassDecl); + var containingClassInstanceType = getDeclaredTypeOfSymbol(containingClassSymbol); + var baseConstructorType = getBaseConstructorTypeOfClass(containingClassInstanceType); if (containsSuperCall(node.body)) { - // The first statement in the body of a constructor must be a super call if both of the following are true: + if (baseConstructorType === nullType) { + error(node, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); + } + // The first statement in the body of a constructor (excluding prologue directives) must be a super call + // if both of the following are true: // - The containing class is a derived class. // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); + // Skip past any prologue directives to find the first statement + // to ensure that it was a super call. if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 192 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + var superCallStatement; + for (var _i = 0; _i < statements.length; _i++) { + var statement = statements[_i]; + if (statement.kind === 193 /* ExpressionStatement */ && isSuperCallExpression(statement.expression)) { + superCallStatement = statement; + break; + } + if (!ts.isPrologueDirective(statement)) { + break; + } + } + if (!superCallStatement) { 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 { // In such a required super call, it is a compile-time error for argument expressions to reference this. - markThisReferencesAsErrors(statements[0].expression); + markThisReferencesAsErrors(superCallStatement.expression); } } } - else { + else if (baseConstructorType !== nullType) { error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); } } @@ -22037,7 +22484,7 @@ var ts; if (produceDiagnostics) { // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 142 /* GetAccessor */) { + if (node.kind === 143 /* GetAccessor */) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } @@ -22045,7 +22492,7 @@ var ts; if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 142 /* GetAccessor */ ? 143 /* SetAccessor */ : 142 /* GetAccessor */; + var otherKind = node.kind === 143 /* GetAccessor */ ? 144 /* SetAccessor */ : 143 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { @@ -22141,9 +22588,9 @@ var ts; var signaturesToCheck; // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 212 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 144 /* CallSignature */ || signatureDeclarationNode.kind === 145 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 144 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 213 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 145 /* CallSignature */ || signatureDeclarationNode.kind === 146 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 145 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -22161,7 +22608,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 212 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 213 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported flags |= 1 /* Export */; @@ -22247,7 +22694,7 @@ var ts; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 140 /* MethodDeclaration */ || node.kind === 139 /* MethodSignature */); + ts.Debug.assert(node.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */); ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -22283,7 +22730,7 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 212 /* InterfaceDeclaration */ || node.parent.kind === 152 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 213 /* InterfaceDeclaration */ || node.parent.kind === 153 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -22294,7 +22741,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 210 /* FunctionDeclaration */ || node.kind === 140 /* MethodDeclaration */ || node.kind === 139 /* MethodSignature */ || node.kind === 141 /* Constructor */) { + if (node.kind === 211 /* FunctionDeclaration */ || node.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */ || node.kind === 142 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -22378,8 +22825,6 @@ var ts; if (!produceDiagnostics) { return; } - // Exports should be checked only if enclosing module contains both exported and non exported declarations. - // In case if all declarations are non-exported check is unnecessary. // if localSymbol is defined on node then node itself is exported - check is required var symbol = node.localSymbol; if (!symbol) { @@ -22397,38 +22842,55 @@ var ts; } // we use SymbolFlags.ExportValue, SymbolFlags.ExportType and SymbolFlags.ExportNamespace // to denote disjoint declarationSpaces (without making new enum type). - var exportedDeclarationSpaces = 0; - var nonExportedDeclarationSpaces = 0; - ts.forEach(symbol.declarations, function (d) { + var exportedDeclarationSpaces = 0 /* None */; + var nonExportedDeclarationSpaces = 0 /* None */; + var defaultExportedDeclarationSpaces = 0 /* None */; + for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { + var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - if (getEffectiveDeclarationFlags(d, 1 /* Export */)) { - exportedDeclarationSpaces |= declarationSpaces; + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* Export */ | 1024 /* Default */); + if (effectiveDeclarationFlags & 1 /* Export */) { + if (effectiveDeclarationFlags & 1024 /* Default */) { + defaultExportedDeclarationSpaces |= declarationSpaces; + } + else { + exportedDeclarationSpaces |= declarationSpaces; + } } else { nonExportedDeclarationSpaces |= declarationSpaces; } - }); - var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; - if (commonDeclarationSpace) { + } + // Spaces for anyting not declared a 'default export'. + var nonDefaultExportedDeclarationSpaces = exportedDeclarationSpaces | nonExportedDeclarationSpaces; + var commonDeclarationSpacesForExportsAndLocals = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + var commonDeclarationSpacesForDefaultAndNonDefault = defaultExportedDeclarationSpaces & nonDefaultExportedDeclarationSpaces; + if (commonDeclarationSpacesForExportsAndLocals || commonDeclarationSpacesForDefaultAndNonDefault) { // declaration spaces for exported and non-exported declarations intersect - ts.forEach(symbol.declarations, function (d) { - if (getDeclarationSpaces(d) & commonDeclarationSpace) { + for (var _b = 0, _c = symbol.declarations; _b < _c.length; _b++) { + var d = _c[_b]; + var declarationSpaces = getDeclarationSpaces(d); + // Only error on the declarations that conributed to the intersecting spaces. + if (declarationSpaces & commonDeclarationSpacesForDefaultAndNonDefault) { + error(d.name, ts.Diagnostics.Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead, ts.declarationNameToString(d.name)); + } + else if (declarationSpaces & commonDeclarationSpacesForExportsAndLocals) { 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 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 215 /* ModuleDeclaration */: - return d.name.kind === 8 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ + case 216 /* ModuleDeclaration */: + return d.name.kind === 9 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -22505,7 +22967,7 @@ var ts; * The runtime behavior of the `await` keyword. */ function getAwaitedType(type) { - return checkAwaitedType(type, undefined, undefined); + return checkAwaitedType(type, /*location*/ undefined, /*message*/ undefined); } function checkAwaitedType(type, location, message) { return checkAwaitedTypeWorker(type); @@ -22672,22 +23134,22 @@ var ts; var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node); var errorInfo; switch (node.parent.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 135 /* Parameter */: + case 136 /* Parameter */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any); break; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: expectedReturnType = voidType; errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any); break; - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); expectedReturnType = getUnionType([descriptorType, voidType]); @@ -22700,9 +23162,9 @@ var ts; // When we are emitting type metadata for decorators, we need to try to check the type // as if it were an expression so that we can emit the type in a value position when we // serialize the type metadata. - if (node && node.kind === 148 /* TypeReference */) { + if (node && node.kind === 149 /* TypeReference */) { var root = getFirstIdentifier(node.typeName); - var rootSymbol = resolveName(root, root.text, 107455 /* Value */, undefined, undefined); + var rootSymbol = resolveName(root, root.text, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); if (rootSymbol && rootSymbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { markAliasSymbolAsReferenced(rootSymbol); } @@ -22714,19 +23176,19 @@ var ts; */ function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 135 /* Parameter */: + case 136 /* Parameter */: checkTypeNodeAsExpression(node.type); break; - case 140 /* MethodDeclaration */: + case 141 /* MethodDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 142 /* GetAccessor */: + case 143 /* GetAccessor */: checkTypeNodeAsExpression(node.type); break; - case 143 /* SetAccessor */: + case 144 /* SetAccessor */: checkTypeNodeAsExpression(ts.getSetAccessorTypeAnnotationNode(node)); break; } @@ -22755,25 +23217,25 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 140 /* MethodDeclaration */: + case 141 /* MethodDeclaration */: checkParameterTypeAnnotationsAsExpressions(node); // fall-through - case 143 /* SetAccessor */: - case 142 /* GetAccessor */: - case 138 /* PropertyDeclaration */: - case 135 /* Parameter */: + case 144 /* SetAccessor */: + case 143 /* GetAccessor */: + case 139 /* PropertyDeclaration */: + case 136 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 135 /* Parameter */) { + if (node.kind === 136 /* Parameter */) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -22799,7 +23261,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 134 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -22848,11 +23310,11 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 189 /* Block */) { + if (node.kind === 190 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 216 /* ModuleBlock */) { + if (ts.isFunctionBlock(node) || node.kind === 217 /* ModuleBlock */) { checkFunctionAndClassExpressionBodies(node); } } @@ -22871,12 +23333,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 138 /* PropertyDeclaration */ || - node.kind === 137 /* PropertySignature */ || - node.kind === 140 /* MethodDeclaration */ || - node.kind === 139 /* MethodSignature */ || - node.kind === 142 /* GetAccessor */ || - node.kind === 143 /* SetAccessor */) { + if (node.kind === 139 /* PropertyDeclaration */ || + node.kind === 138 /* PropertySignature */ || + node.kind === 141 /* MethodDeclaration */ || + node.kind === 140 /* MethodSignature */ || + node.kind === 143 /* GetAccessor */ || + node.kind === 144 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -22885,7 +23347,7 @@ var ts; return false; } var root = ts.getRootDeclaration(node); - if (root.kind === 135 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 136 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -22901,7 +23363,7 @@ var ts; var current = node; while (current) { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - var isDeclaration_1 = node.kind !== 66 /* Identifier */; + var isDeclaration_1 = node.kind !== 67 /* Identifier */; if (isDeclaration_1) { error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } @@ -22924,7 +23386,7 @@ var ts; return; } if (ts.getClassExtendsHeritageClauseElement(enclosingClass)) { - var isDeclaration_2 = node.kind !== 66 /* Identifier */; + var isDeclaration_2 = node.kind !== 67 /* Identifier */; if (isDeclaration_2) { error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); } @@ -22938,12 +23400,12 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 215 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 216 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 245 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 246 /* SourceFile */ && ts.isExternalModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -22978,27 +23440,27 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 208 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 209 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); if (symbol.flags & 1 /* FunctionScopedVariable */) { - var localDeclarationSymbol = resolveName(node, node.name.text, 3 /* Variable */, undefined, undefined); + var localDeclarationSymbol = resolveName(node, node.name.text, 3 /* Variable */, /*nodeNotFoundErrorMessage*/ undefined, /*nameArg*/ undefined); if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 49152 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 209 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 190 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 210 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 191 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 189 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 216 /* ModuleBlock */ || - container.kind === 215 /* ModuleDeclaration */ || - container.kind === 245 /* SourceFile */); + (container.kind === 190 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 217 /* ModuleBlock */ || + container.kind === 216 /* ModuleDeclaration */ || + container.kind === 246 /* 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 @@ -23013,18 +23475,18 @@ var ts; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (ts.getRootDeclaration(node).kind !== 135 /* Parameter */) { + if (ts.getRootDeclaration(node).kind !== 136 /* Parameter */) { return; } var func = ts.getContainingFunction(node); visit(node.initializer); function visit(n) { - if (n.kind === 66 /* Identifier */) { + if (n.kind === 67 /* Identifier */) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 135 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 136 /* Parameter */) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -23050,7 +23512,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -23061,14 +23523,14 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && ts.getRootDeclaration(node).kind === 135 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && ts.getRootDeclaration(node).kind === 136 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { if (node.initializer) { - checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); + checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, /*headMessage*/ undefined); checkParameterInitializer(node); } return; @@ -23078,7 +23540,7 @@ var ts; if (node === symbol.valueDeclaration) { // Node is the primary declaration of the symbol, just validate the initializer if (node.initializer) { - checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); + checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, /*headMessage*/ undefined); checkParameterInitializer(node); } } @@ -23090,13 +23552,13 @@ var ts; 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); + checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); } } - if (node.kind !== 138 /* PropertyDeclaration */ && node.kind !== 137 /* PropertySignature */) { + if (node.kind !== 139 /* PropertyDeclaration */ && node.kind !== 138 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 208 /* VariableDeclaration */ || node.kind === 160 /* BindingElement */) { + if (node.kind === 209 /* VariableDeclaration */ || node.kind === 161 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -23119,7 +23581,7 @@ var ts; } function checkGrammarDisallowedModifiersOnObjectLiteralExpressionMethod(node) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && node.parent.kind === 162 /* ObjectLiteralExpression */) { + if (node.modifiers && node.parent.kind === 163 /* ObjectLiteralExpression */) { if (ts.isAsyncFunctionLike(node)) { if (node.modifiers.length > 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); @@ -23157,12 +23619,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 210 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer.kind === 210 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -23182,14 +23644,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer.kind === 210 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 161 /* ArrayLiteralExpression */ || varExpr.kind === 162 /* ObjectLiteralExpression */) { + if (varExpr.kind === 162 /* ArrayLiteralExpression */ || varExpr.kind === 163 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -23197,14 +23659,14 @@ var ts; } else { var leftType = checkExpression(varExpr); - checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, + checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_previously_defined_constant); // iteratedType will be undefined if the rightType was missing properties/signatures // required to get its iteratedType (like [Symbol.iterator] or next). This may be // because we accessed properties from anyType, or it may have led to an error inside // getElementTypeOfIterable. if (iteratedType) { - checkTypeAssignableTo(iteratedType, leftType, varExpr, undefined); + checkTypeAssignableTo(iteratedType, leftType, varExpr, /*headMessage*/ undefined); } } } @@ -23218,7 +23680,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer.kind === 210 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -23232,7 +23694,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 161 /* ArrayLiteralExpression */ || varExpr.kind === 162 /* ObjectLiteralExpression */) { + if (varExpr.kind === 162 /* ArrayLiteralExpression */ || varExpr.kind === 163 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAnyOrAllConstituentTypesHaveKind(leftType, 258 /* StringLike */)) { @@ -23261,7 +23723,7 @@ var ts; } function checkRightHandSideOfForOf(rhsExpression) { var expressionType = getTypeOfExpression(rhsExpression); - return checkIteratedTypeOrElementType(expressionType, rhsExpression, true); + return checkIteratedTypeOrElementType(expressionType, rhsExpression, /*allowStringInput*/ true); } function checkIteratedTypeOrElementType(inputType, errorNode, allowStringInput) { if (isTypeAny(inputType)) { @@ -23404,8 +23866,8 @@ var ts; if ((type.flags & 4096 /* Reference */) && type.target === globalIterableIteratorType) { return type.typeArguments[0]; } - return getElementTypeOfIterable(type, undefined) || - getElementTypeOfIterator(type, undefined); + return getElementTypeOfIterable(type, /*errorNode*/ undefined) || + getElementTypeOfIterator(type, /*errorNode*/ undefined); } /** * This function does the following steps: @@ -23428,7 +23890,7 @@ var ts; ts.Debug.assert(languageVersion < 2 /* ES6 */); // After we remove all types that are StringLike, we will know if there was a string constituent // based on whether the remaining type is the same as the initial type. - var arrayType = removeTypesFromUnionType(arrayOrStringType, 258 /* StringLike */, true, true); + var arrayType = removeTypesFromUnionType(arrayOrStringType, 258 /* StringLike */, /*isTypeOfKind*/ true, /*allowEmptyUnionResult*/ true); var hasStringConstituent = arrayOrStringType !== arrayType; var reportedError = false; if (hasStringConstituent) { @@ -23471,7 +23933,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 142 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 143 /* SetAccessor */))); + return !!(node.kind === 143 /* GetAccessor */ && ts.getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 144 /* SetAccessor */))); } function checkReturnStatement(node) { // Grammar checking @@ -23494,10 +23956,10 @@ var ts; // for generators. return; } - if (func.kind === 143 /* SetAccessor */) { + if (func.kind === 144 /* SetAccessor */) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } - else if (func.kind === 141 /* Constructor */) { + else if (func.kind === 142 /* Constructor */) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -23533,7 +23995,7 @@ var ts; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 239 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 240 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -23545,14 +24007,14 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 238 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 239 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { // check 'expressionType isAssignableTo caseType' failed, try the reversed check and report errors if it fails - checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + checkTypeAssignableTo(caseType, expressionType, caseClause.expression, /*headMessage*/ undefined); } } ts.forEach(clause.statements, checkSourceElement); @@ -23566,7 +24028,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 204 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 205 /* LabeledStatement */ && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -23596,7 +24058,7 @@ var ts; if (catchClause) { // Grammar checking if (catchClause.variableDeclaration) { - if (catchClause.variableDeclaration.name.kind !== 66 /* Identifier */) { + if (catchClause.variableDeclaration.name.kind !== 67 /* Identifier */) { grammarErrorOnFirstToken(catchClause.variableDeclaration.name, ts.Diagnostics.Catch_clause_variable_name_must_be_an_identifier); } else if (catchClause.variableDeclaration.type) { @@ -23671,7 +24133,7 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 133 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 134 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -23842,7 +24304,7 @@ var ts; // type declaration, derived and base resolve to the same symbol even in the case of generic classes. if (derived === base) { // derived class inherits base without override/redeclaration - var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 211 /* ClassDeclaration */); + var derivedClassDecl = ts.getDeclarationOfKind(type.symbol, 212 /* ClassDeclaration */); // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. @@ -23890,7 +24352,7 @@ var ts; } } function isAccessor(kind) { - return kind === 142 /* GetAccessor */ || kind === 143 /* SetAccessor */; + return kind === 143 /* GetAccessor */ || kind === 144 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -23960,7 +24422,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 212 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 213 /* InterfaceDeclaration */); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -23981,7 +24443,7 @@ var ts; if (symbol && symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 211 /* ClassDeclaration */ && !ts.isInAmbientContext(declaration)) { + if (declaration.kind === 212 /* ClassDeclaration */ && !ts.isInAmbientContext(declaration)) { error(node, ts.Diagnostics.Only_an_ambient_class_can_be_merged_with_an_interface); break; } @@ -24014,32 +24476,12 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 133 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 134 /* ComputedPropertyName */ && 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); - if (autoValue === undefined) { - if (enumIsConst) { - error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); - } - else if (!ambient) { - // Only here do we need to check that the initializer is assignable to the enum type. - // If it is a constant value (not undefined), it is syntactically constrained to be a number. - // Also, we do not need to check this for ambients because there is already - // a syntax error if it is not a constant. - checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, 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); - } - } + autoValue = computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient); } else if (ambient && !enumIsConst) { autoValue = undefined; @@ -24050,22 +24492,48 @@ var ts; }); nodeLinks.flags |= 8192 /* EnumValuesComputed */; } - function getConstantValueForEnumMemberInitializer(initializer) { - return evalConstant(initializer); + function computeConstantValueForEnumMemberInitializer(initializer, enumType, enumIsConst, ambient) { + // Controls if error should be reported after evaluation of constant value is completed + // Can be false if another more precise error was already reported during evaluation. + var reportError = true; + var value = evalConstant(initializer); + if (reportError) { + if (value === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (!ambient) { + // Only here do we need to check that the initializer is assignable to the enum type. + // If it is a constant value (not undefined), it is syntactically constrained to be a number. + // Also, we do not need to check this for ambients because there is already + // a syntax error if it is not a constant. + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, /*headMessage*/ undefined); + } + } + else if (enumIsConst) { + if (isNaN(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(value)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } + } + return value; function evalConstant(e) { switch (e.kind) { - case 176 /* PrefixUnaryExpression */: - var value = evalConstant(e.operand); - if (value === undefined) { + case 177 /* PrefixUnaryExpression */: + var value_1 = evalConstant(e.operand); + if (value_1 === undefined) { return undefined; } switch (e.operator) { - case 34 /* PlusToken */: return value; - case 35 /* MinusToken */: return -value; - case 48 /* TildeToken */: return ~value; + case 35 /* PlusToken */: return value_1; + case 36 /* MinusToken */: return -value_1; + case 49 /* TildeToken */: return ~value_1; } return undefined; - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -24075,41 +24543,41 @@ var ts; return undefined; } switch (e.operatorToken.kind) { - case 45 /* BarToken */: return left | right; - case 44 /* AmpersandToken */: return left & right; - case 42 /* GreaterThanGreaterThanToken */: return left >> right; - case 43 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; - case 41 /* LessThanLessThanToken */: return left << right; - case 46 /* CaretToken */: return left ^ right; - case 36 /* AsteriskToken */: return left * right; - case 37 /* SlashToken */: return left / right; - case 34 /* PlusToken */: return left + right; - case 35 /* MinusToken */: return left - right; - case 38 /* PercentToken */: return left % right; + case 46 /* BarToken */: return left | right; + case 45 /* AmpersandToken */: return left & right; + case 43 /* GreaterThanGreaterThanToken */: return left >> right; + case 44 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; + case 42 /* LessThanLessThanToken */: return left << right; + case 47 /* CaretToken */: return left ^ right; + case 37 /* AsteriskToken */: return left * right; + case 38 /* SlashToken */: return left / right; + case 35 /* PlusToken */: return left + right; + case 36 /* MinusToken */: return left - right; + case 39 /* PercentToken */: return left % right; } return undefined; - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: return +e.text; - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return evalConstant(e.expression); - case 66 /* Identifier */: - case 164 /* ElementAccessExpression */: - case 163 /* PropertyAccessExpression */: + case 67 /* Identifier */: + case 165 /* ElementAccessExpression */: + case 164 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); - var enumType; + var enumType_1; var propertyName; - if (e.kind === 66 /* Identifier */) { + if (e.kind === 67 /* Identifier */) { // unqualified names can refer to member that reside in different declaration of the enum so just doing name resolution won't work. // instead pick current enum type and later try to fetch member from the type - enumType = currentType; + enumType_1 = currentType; propertyName = e.text; } else { var expression; - if (e.kind === 164 /* ElementAccessExpression */) { + if (e.kind === 165 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || - e.argumentExpression.kind !== 8 /* StringLiteral */) { + e.argumentExpression.kind !== 9 /* StringLiteral */) { return undefined; } expression = e.expression; @@ -24122,26 +24590,26 @@ var ts; // expression part in ElementAccess\PropertyAccess should be either identifier or dottedName var current = expression; while (current) { - if (current.kind === 66 /* Identifier */) { + if (current.kind === 67 /* Identifier */) { break; } - else if (current.kind === 163 /* PropertyAccessExpression */) { + else if (current.kind === 164 /* PropertyAccessExpression */) { current = current.expression; } else { return undefined; } } - enumType = checkExpression(expression); + enumType_1 = checkExpression(expression); // allow references to constant members of other enums - if (!(enumType.symbol && (enumType.symbol.flags & 384 /* Enum */))) { + if (!(enumType_1.symbol && (enumType_1.symbol.flags & 384 /* Enum */))) { return undefined; } } if (propertyName === undefined) { return undefined; } - var property = getPropertyOfObjectType(enumType, propertyName); + var property = getPropertyOfObjectType(enumType_1, propertyName); if (!property || !(property.flags & 8 /* EnumMember */)) { return undefined; } @@ -24152,6 +24620,8 @@ var ts; } // illegal case: forward reference if (!isDefinedBefore(propertyDecl, member)) { + reportError = false; + error(e, ts.Diagnostics.A_member_initializer_in_a_const_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_const_enums); return undefined; } return getNodeLinks(propertyDecl).enumMemberValue; @@ -24194,7 +24664,7 @@ var ts; var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 214 /* EnumDeclaration */) { + if (declaration.kind !== 215 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -24217,8 +24687,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 211 /* ClassDeclaration */ || - (declaration.kind === 210 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 212 /* ClassDeclaration */ || + (declaration.kind === 211 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -24241,7 +24711,7 @@ var ts; function checkModuleDeclaration(node) { if (produceDiagnostics) { // Grammar checking - var isAmbientExternalModule = node.name.kind === 8 /* StringLiteral */; + var isAmbientExternalModule = node.name.kind === 9 /* StringLiteral */; var contextErrorMessage = isAmbientExternalModule ? ts.Diagnostics.An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file : ts.Diagnostics.A_namespace_declaration_is_only_allowed_in_a_namespace_or_module; @@ -24250,7 +24720,7 @@ var ts; return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node)) { - if (!ts.isInAmbientContext(node) && node.name.kind === 8 /* StringLiteral */) { + if (!ts.isInAmbientContext(node) && node.name.kind === 9 /* StringLiteral */) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } } @@ -24274,7 +24744,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 211 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 212 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */; @@ -24294,28 +24764,28 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 132 /* QualifiedName */) { + if (node.kind === 133 /* QualifiedName */) { node = node.left; } - else if (node.kind === 163 /* PropertyAccessExpression */) { + else if (node.kind === 164 /* PropertyAccessExpression */) { node = node.expression; } else { break; } } - ts.Debug.assert(node.kind === 66 /* Identifier */); + ts.Debug.assert(node.kind === 67 /* Identifier */); return node; } function checkExternalImportOrExportDeclaration(node) { var moduleName = ts.getExternalModuleName(node); - if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 8 /* StringLiteral */) { + if (!ts.nodeIsMissing(moduleName) && moduleName.kind !== 9 /* StringLiteral */) { error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 216 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; - if (node.parent.kind !== 245 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 225 /* ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 217 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; + if (node.parent.kind !== 246 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 226 /* ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -24338,7 +24808,7 @@ var ts; (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 227 /* ExportSpecifier */ ? + var message = node.kind === 228 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -24365,7 +24835,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -24402,7 +24872,7 @@ var ts; } } else { - if (languageVersion >= 2 /* ES6 */) { + if (languageVersion >= 2 /* ES6 */ && !ts.isInAmbientContext(node)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, ts.Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); } @@ -24422,8 +24892,8 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 216 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; - if (node.parent.kind !== 245 /* SourceFile */ && !inAmbientExternalModule) { + var inAmbientExternalModule = node.parent.kind === 217 /* ModuleBlock */ && node.parent.parent.name.kind === 9 /* StringLiteral */; + if (node.parent.kind !== 246 /* SourceFile */ && !inAmbientExternalModule) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -24437,7 +24907,7 @@ var ts; } } function checkGrammarModuleElementContext(node, errorMessage) { - if (node.parent.kind !== 245 /* SourceFile */ && node.parent.kind !== 216 /* ModuleBlock */ && node.parent.kind !== 215 /* ModuleDeclaration */) { + if (node.parent.kind !== 246 /* SourceFile */ && node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 216 /* ModuleDeclaration */) { return grammarErrorOnFirstToken(node, errorMessage); } } @@ -24452,8 +24922,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 245 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 215 /* ModuleDeclaration */ && container.name.kind === 66 /* Identifier */) { + var container = node.parent.kind === 246 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 216 /* ModuleDeclaration */ && container.name.kind === 67 /* Identifier */) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } @@ -24461,7 +24931,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 2035 /* Modifier */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } - if (node.expression.kind === 66 /* Identifier */) { + if (node.expression.kind === 67 /* Identifier */) { markExportAsReferenced(node); } else { @@ -24480,10 +24950,10 @@ var ts; } } function getModuleStatements(node) { - if (node.kind === 245 /* SourceFile */) { + if (node.kind === 246 /* SourceFile */) { return node.statements; } - if (node.kind === 215 /* ModuleDeclaration */ && node.body.kind === 216 /* ModuleBlock */) { + if (node.kind === 216 /* ModuleDeclaration */ && node.body.kind === 217 /* ModuleBlock */) { return node.body.statements; } return emptyArray; @@ -24522,118 +24992,118 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessivly // hitting the cancellation token on every node we check. switch (kind) { - case 215 /* ModuleDeclaration */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: + case 216 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: return checkTypeParameter(node); - case 135 /* Parameter */: + case 136 /* Parameter */: return checkParameter(node); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return checkPropertyDeclaration(node); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 146 /* IndexSignature */: + case 147 /* IndexSignature */: return checkSignatureDeclaration(node); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return checkMethodDeclaration(node); - case 141 /* Constructor */: + case 142 /* Constructor */: return checkConstructorDeclaration(node); - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return checkAccessorDeclaration(node); - case 148 /* TypeReference */: + case 149 /* TypeReference */: return checkTypeReferenceNode(node); - case 147 /* TypePredicate */: + case 148 /* TypePredicate */: return checkTypePredicate(node); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return checkTypeQuery(node); - case 152 /* TypeLiteral */: + case 153 /* TypeLiteral */: return checkTypeLiteral(node); - case 153 /* ArrayType */: + case 154 /* ArrayType */: return checkArrayType(node); - case 154 /* TupleType */: + case 155 /* TupleType */: return checkTupleType(node); - case 155 /* UnionType */: - case 156 /* IntersectionType */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: return checkSourceElement(node.type); - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 189 /* Block */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return checkBlock(node); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return checkVariableStatement(node); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: return checkExpressionStatement(node); - case 193 /* IfStatement */: + case 194 /* IfStatement */: return checkIfStatement(node); - case 194 /* DoStatement */: + case 195 /* DoStatement */: return checkDoStatement(node); - case 195 /* WhileStatement */: + case 196 /* WhileStatement */: return checkWhileStatement(node); - case 196 /* ForStatement */: + case 197 /* ForStatement */: return checkForStatement(node); - case 197 /* ForInStatement */: + case 198 /* ForInStatement */: return checkForInStatement(node); - case 198 /* ForOfStatement */: + case 199 /* ForOfStatement */: return checkForOfStatement(node); - case 199 /* ContinueStatement */: - case 200 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 201 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: return checkReturnStatement(node); - case 202 /* WithStatement */: + case 203 /* WithStatement */: return checkWithStatement(node); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: return checkSwitchStatement(node); - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return checkLabeledStatement(node); - case 205 /* ThrowStatement */: + case 206 /* ThrowStatement */: return checkThrowStatement(node); - case 206 /* TryStatement */: + case 207 /* TryStatement */: return checkTryStatement(node); - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 160 /* BindingElement */: + case 161 /* BindingElement */: return checkBindingElement(node); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return checkClassDeclaration(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: return checkImportDeclaration(node); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return checkExportDeclaration(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return checkExportAssignment(node); - case 191 /* EmptyStatement */: + case 192 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 207 /* DebuggerStatement */: + case 208 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 228 /* MissingDeclaration */: + case 229 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -24648,95 +25118,95 @@ var ts; // Delaying the type check of the body ensures foo has been assigned a type. function checkFunctionAndClassExpressionBodies(node) { switch (node.kind) { - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: ts.forEach(node.members, checkSourceElement); break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: ts.forEach(node.decorators, checkFunctionAndClassExpressionBodies); ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionAndClassExpressionBodies); break; - case 202 /* WithStatement */: + case 203 /* WithStatement */: checkFunctionAndClassExpressionBodies(node.expression); break; - case 136 /* Decorator */: - case 135 /* Parameter */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: - case 160 /* BindingElement */: - case 161 /* ArrayLiteralExpression */: - case 162 /* ObjectLiteralExpression */: - case 242 /* PropertyAssignment */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 167 /* TaggedTemplateExpression */: - case 180 /* TemplateExpression */: - case 187 /* TemplateSpan */: - case 168 /* TypeAssertionExpression */: - case 186 /* AsExpression */: - case 169 /* ParenthesizedExpression */: - case 173 /* TypeOfExpression */: - case 174 /* VoidExpression */: - case 175 /* AwaitExpression */: - case 172 /* DeleteExpression */: - case 176 /* PrefixUnaryExpression */: - case 177 /* PostfixUnaryExpression */: - case 178 /* BinaryExpression */: - case 179 /* ConditionalExpression */: - case 182 /* SpreadElementExpression */: - case 181 /* YieldExpression */: - case 189 /* Block */: - case 216 /* ModuleBlock */: - case 190 /* VariableStatement */: - case 192 /* ExpressionStatement */: - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 199 /* ContinueStatement */: - case 200 /* BreakStatement */: - case 201 /* ReturnStatement */: - case 203 /* SwitchStatement */: - case 217 /* CaseBlock */: - case 238 /* CaseClause */: - case 239 /* DefaultClause */: - case 204 /* LabeledStatement */: - case 205 /* ThrowStatement */: - case 206 /* TryStatement */: - case 241 /* CatchClause */: - case 208 /* VariableDeclaration */: - case 209 /* VariableDeclarationList */: - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 244 /* EnumMember */: - case 224 /* ExportAssignment */: - case 245 /* SourceFile */: - case 237 /* JsxExpression */: - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: - case 235 /* JsxAttribute */: - case 236 /* JsxSpreadAttribute */: - case 232 /* JsxOpeningElement */: + case 137 /* Decorator */: + case 136 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: + case 161 /* BindingElement */: + case 162 /* ArrayLiteralExpression */: + case 163 /* ObjectLiteralExpression */: + case 243 /* PropertyAssignment */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 168 /* TaggedTemplateExpression */: + case 181 /* TemplateExpression */: + case 188 /* TemplateSpan */: + case 169 /* TypeAssertionExpression */: + case 187 /* AsExpression */: + case 170 /* ParenthesizedExpression */: + case 174 /* TypeOfExpression */: + case 175 /* VoidExpression */: + case 176 /* AwaitExpression */: + case 173 /* DeleteExpression */: + case 177 /* PrefixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: + case 179 /* BinaryExpression */: + case 180 /* ConditionalExpression */: + case 183 /* SpreadElementExpression */: + case 182 /* YieldExpression */: + case 190 /* Block */: + case 217 /* ModuleBlock */: + case 191 /* VariableStatement */: + case 193 /* ExpressionStatement */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 200 /* ContinueStatement */: + case 201 /* BreakStatement */: + case 202 /* ReturnStatement */: + case 204 /* SwitchStatement */: + case 218 /* CaseBlock */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: + case 205 /* LabeledStatement */: + case 206 /* ThrowStatement */: + case 207 /* TryStatement */: + case 242 /* CatchClause */: + case 209 /* VariableDeclaration */: + case 210 /* VariableDeclarationList */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 245 /* EnumMember */: + case 225 /* ExportAssignment */: + case 246 /* SourceFile */: + case 238 /* JsxExpression */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: + case 236 /* JsxAttribute */: + case 237 /* JsxSpreadAttribute */: + case 233 /* JsxOpeningElement */: ts.forEachChild(node, checkFunctionAndClassExpressionBodies); break; } @@ -24822,7 +25292,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 202 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 203 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -24845,25 +25315,25 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } // fall through; this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -24872,13 +25342,16 @@ var ts; copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 170 /* FunctionExpression */: + case 171 /* FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); } break; } + if (ts.introducesArgumentsExoticObject(location)) { + copySymbol(argumentsSymbol, meaning); + } memberFlags = location.flags; location = location.parent; } @@ -24912,43 +25385,43 @@ var ts; } } function isTypeDeclarationName(name) { - return name.kind === 66 /* Identifier */ && + return name.kind === 67 /* Identifier */ && isTypeDeclaration(name.parent) && name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 134 /* TypeParameter */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 214 /* EnumDeclaration */: + case 135 /* TypeParameter */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 215 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 132 /* QualifiedName */) { + while (node.parent && node.parent.kind === 133 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 148 /* TypeReference */; + return node.parent && node.parent.kind === 149 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 163 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 164 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 185 /* ExpressionWithTypeArguments */; + return node.parent && node.parent.kind === 186 /* ExpressionWithTypeArguments */; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 132 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 133 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 218 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 219 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 224 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 225 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -24960,11 +25433,11 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 224 /* ExportAssignment */) { + if (entityName.parent.kind === 225 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 163 /* PropertyAccessExpression */) { + if (entityName.kind !== 164 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -24974,11 +25447,13 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 185 /* ExpressionWithTypeArguments */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 186 /* ExpressionWithTypeArguments */ ? 793056 /* Type */ : 1536 /* Namespace */; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if ((entityName.parent.kind === 232 /* JsxOpeningElement */) || (entityName.parent.kind === 231 /* JsxSelfClosingElement */)) { + else if ((entityName.parent.kind === 233 /* JsxOpeningElement */) || + (entityName.parent.kind === 232 /* JsxSelfClosingElement */) || + (entityName.parent.kind === 235 /* JsxClosingElement */)) { return getJsxElementTagSymbol(entityName.parent); } else if (ts.isExpression(entityName)) { @@ -24986,20 +25461,20 @@ var ts; // Missing entity name. return undefined; } - if (entityName.kind === 66 /* Identifier */) { + if (entityName.kind === 67 /* Identifier */) { // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 163 /* PropertyAccessExpression */) { + else if (entityName.kind === 164 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 132 /* QualifiedName */) { + else if (entityName.kind === 133 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -25008,22 +25483,22 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 148 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 149 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.parent.kind === 235 /* JsxAttribute */) { + else if (entityName.parent.kind === 236 /* JsxAttribute */) { return getJsxAttributePropertySymbol(entityName.parent); } - if (entityName.parent.kind === 147 /* TypePredicate */) { - return resolveEntityName(entityName, 1 /* FunctionScopedVariable */); + if (entityName.parent.kind === 148 /* TypePredicate */) { + return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */); } // Do we want to return undefined here? return undefined; } - function getSymbolInfo(node) { + function getSymbolAtLocation(node) { if (isInsideWithStatementBody(node)) { // We cannot answer semantic questions within a with block, do not proceed any further return undefined; @@ -25032,39 +25507,50 @@ var ts; // This is a declaration, call getSymbolOfNode return getSymbolOfNode(node.parent); } - if (node.kind === 66 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 224 /* ExportAssignment */ - ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImportEquals(node); + if (node.kind === 67 /* Identifier */) { + if (isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 225 /* ExportAssignment */ + ? getSymbolOfEntityNameOrPropertyAccessExpression(node) + : getSymbolOfPartOfRightHandSideOfImportEquals(node); + } + else if (node.parent.kind === 161 /* BindingElement */ && + node.parent.parent.kind === 159 /* ObjectBindingPattern */ && + node === node.parent.propertyName) { + var typeOfPattern = getTypeOfNode(node.parent.parent); + var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); + if (propertyDeclaration) { + return propertyDeclaration; + } + } } switch (node.kind) { - case 66 /* Identifier */: - case 163 /* PropertyAccessExpression */: - case 132 /* QualifiedName */: + case 67 /* Identifier */: + case 164 /* PropertyAccessExpression */: + case 133 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: var type = checkExpression(node); return type.symbol; - case 118 /* ConstructorKeyword */: + case 119 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 141 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 142 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: // External module name in an import declaration if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 219 /* ImportDeclaration */ || node.parent.kind === 225 /* ExportDeclaration */) && + ((node.parent.kind === 220 /* ImportDeclaration */ || node.parent.kind === 226 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Fall through - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: // index access - if (node.parent.kind === 164 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -25081,7 +25567,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 243 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 244 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */); } return undefined; @@ -25103,28 +25589,28 @@ var ts; return getBaseTypes(getDeclaredTypeOfSymbol(getSymbolOfNode(node.parent.parent)))[0]; } if (isTypeDeclaration(node)) { - // In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration + // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); } if (isTypeDeclarationName(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); } if (ts.isDeclaration(node)) { - // In this case, we call getSymbolOfNode instead of getSymbolInfo because it is a declaration + // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getTypeOfSymbol(symbol); } if (ts.isDeclarationName(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); return symbol && getTypeOfSymbol(symbol); } if (ts.isBindingPattern(node)) { return getTypeForVariableLikeDeclaration(node.parent); } if (isInRightSideOfImportOrExportAssignment(node)) { - var symbol = getSymbolInfo(node); + var symbol = getSymbolAtLocation(node); var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); } @@ -25195,11 +25681,11 @@ var ts; } var parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 245 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && parentSymbol.valueDeclaration.kind === 246 /* SourceFile */) { return parentSymbol.valueDeclaration; } for (var n = node.parent; n; n = n.parent) { - if ((n.kind === 215 /* ModuleDeclaration */ || n.kind === 214 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { + if ((n.kind === 216 /* ModuleDeclaration */ || n.kind === 215 /* EnumDeclaration */) && getSymbolOfNode(n) === parentSymbol) { return n; } } @@ -25214,11 +25700,11 @@ var ts; } function isStatementWithLocals(node) { switch (node.kind) { - case 189 /* Block */: - case 217 /* CaseBlock */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 190 /* Block */: + case 218 /* CaseBlock */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: return true; } return false; @@ -25229,7 +25715,7 @@ var ts; if (links.isNestedRedeclaration === undefined) { var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); links.isNestedRedeclaration = isStatementWithLocals(container) && - !!resolveName(container.parent, symbol.name, 107455 /* Value */, undefined, undefined); + !!resolveName(container.parent, symbol.name, 107455 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); } return links.isNestedRedeclaration; } @@ -25248,22 +25734,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 218 /* ImportEqualsDeclaration */: - case 220 /* ImportClause */: - case 221 /* NamespaceImport */: - case 223 /* ImportSpecifier */: - case 227 /* ExportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportClause */: + case 222 /* NamespaceImport */: + case 224 /* ImportSpecifier */: + case 228 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 224 /* ExportAssignment */: - return node.expression && node.expression.kind === 66 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; + case 225 /* ExportAssignment */: + return node.expression && node.expression.kind === 67 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 245 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 246 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -25276,7 +25762,11 @@ var ts; return true; } // const enums and modules that contain only const enums are not considered values from the emit perespective - return target !== unknownSymbol && target && target.flags & 107455 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target); + // unless 'preserveConstEnums' option is set to true + return target !== unknownSymbol && + target && + target.flags & 107455 /* Value */ && + (compilerOptions.preserveConstEnums || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || s.constEnumOnlyModule; @@ -25321,7 +25811,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 244 /* EnumMember */) { + if (node.kind === 245 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -25336,14 +25826,16 @@ var ts; function isFunctionType(type) { return type.flags & 80896 /* ObjectType */ && getSignaturesOfType(type, 0 /* Call */).length > 0; } - function getTypeReferenceSerializationKind(node) { + function getTypeReferenceSerializationKind(typeName) { // Resolve the symbol as a value to ensure the type can be reached at runtime during emit. - var symbol = resolveEntityName(node.typeName, 107455 /* Value */, true); - var constructorType = symbol ? getTypeOfSymbol(symbol) : undefined; + var valueSymbol = resolveEntityName(typeName, 107455 /* Value */, /*ignoreErrors*/ true); + var constructorType = valueSymbol ? getTypeOfSymbol(valueSymbol) : undefined; if (constructorType && isConstructorType(constructorType)) { return ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue; } - var type = getTypeFromTypeNode(node); + // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. + var typeSymbol = resolveEntityName(typeName, 793056 /* Type */, /*ignoreErrors*/ true); + var type = getDeclaredTypeOfSymbol(typeSymbol); if (type === unknownType) { return ts.TypeReferenceSerializationKind.Unknown; } @@ -25365,7 +25857,7 @@ var ts; else if (allConstituentTypesHaveKind(type, 8192 /* Tuple */)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (allConstituentTypesHaveKind(type, 4194304 /* ESSymbol */)) { + else if (allConstituentTypesHaveKind(type, 16777216 /* ESSymbol */)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -25400,7 +25892,7 @@ var ts; function getReferencedValueSymbol(reference) { return getNodeLinks(reference).resolvedSymbol || resolveName(reference, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, - /*nodeNotFoundMessage*/ undefined, undefined); + /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); } function getReferencedValueDeclaration(reference) { ts.Debug.assert(!ts.nodeIsSynthesized(reference)); @@ -25409,13 +25901,13 @@ var ts; } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 160 /* BindingElement */ || (n.parent.kind === 208 /* VariableDeclaration */ && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 161 /* BindingElement */ || (n.parent.kind === 209 /* VariableDeclaration */ && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || - resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, undefined, undefined); + resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); var isLetOrConst = symbol && (symbol.flags & 2 /* BlockScopedVariable */) && - symbol.valueDeclaration.parent.kind !== 241 /* CatchClause */; + symbol.valueDeclaration.parent.kind !== 242 /* CatchClause */; if (isLetOrConst) { // side-effect of calling this method: // assign id to symbol if it was not yet set @@ -25457,7 +25949,8 @@ var ts; collectLinkedAliases: collectLinkedAliases, getBlockScopedVariableId: getBlockScopedVariableId, getReferencedValueDeclaration: getReferencedValueDeclaration, - getTypeReferenceSerializationKind: getTypeReferenceSerializationKind + getTypeReferenceSerializationKind: getTypeReferenceSerializationKind, + isOptionalParameter: isOptionalParameter }; } function initializeTypeChecker() { @@ -25477,7 +25970,7 @@ var ts; getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types - globalArrayType = getGlobalType("Array", 1); + globalArrayType = getGlobalType("Array", /*arity*/ 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); globalStringType = getGlobalType("String"); @@ -25489,10 +25982,10 @@ var ts; getGlobalPropertyDecoratorType = ts.memoize(function () { return getGlobalType("PropertyDecorator"); }); getGlobalMethodDecoratorType = ts.memoize(function () { return getGlobalType("MethodDecorator"); }); getGlobalParameterDecoratorType = ts.memoize(function () { return getGlobalType("ParameterDecorator"); }); - getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", 1); }); - getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", 1); }); - tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056 /* Type */, undefined) && getGlobalPromiseType(); }); - getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", 1); }); + getGlobalTypedPropertyDescriptorType = ts.memoize(function () { return getGlobalType("TypedPropertyDescriptor", /*arity*/ 1); }); + getGlobalPromiseType = ts.memoize(function () { return getGlobalType("Promise", /*arity*/ 1); }); + tryGetGlobalPromiseType = ts.memoize(function () { return getGlobalSymbol("Promise", 793056 /* Type */, /*diagnostic*/ undefined) && getGlobalPromiseType(); }); + getGlobalPromiseLikeType = ts.memoize(function () { return getGlobalType("PromiseLike", /*arity*/ 1); }); getInstantiatedGlobalPromiseLikeType = ts.memoize(createInstantiatedPromiseLikeType); getGlobalPromiseConstructorSymbol = ts.memoize(function () { return getGlobalValueSymbol("Promise"); }); getGlobalPromiseConstructorLikeType = ts.memoize(function () { return getGlobalType("PromiseConstructorLike"); }); @@ -25503,9 +25996,9 @@ var ts; globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); globalESSymbolType = getGlobalType("Symbol"); globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalIterableType = getGlobalType("Iterable", 1); - globalIteratorType = getGlobalType("Iterator", 1); - globalIterableIteratorType = getGlobalType("IterableIterator", 1); + globalIterableType = getGlobalType("Iterable", /*arity*/ 1); + globalIteratorType = getGlobalType("Iterator", /*arity*/ 1); + globalIterableIteratorType = getGlobalType("IterableIterator", /*arity*/ 1); } else { globalTemplateStringsArrayType = unknownType; @@ -25549,7 +26042,7 @@ var ts; else if (languageVersion < 1 /* ES5 */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } - else if (node.kind === 142 /* GetAccessor */ || node.kind === 143 /* SetAccessor */) { + else if (node.kind === 143 /* GetAccessor */ || node.kind === 144 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -25559,38 +26052,38 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 141 /* Constructor */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 146 /* IndexSignature */: - case 215 /* ModuleDeclaration */: - case 219 /* ImportDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 225 /* ExportDeclaration */: - case 224 /* ExportAssignment */: - case 135 /* Parameter */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 142 /* Constructor */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 147 /* IndexSignature */: + case 216 /* ModuleDeclaration */: + case 220 /* ImportDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 226 /* ExportDeclaration */: + case 225 /* ExportAssignment */: + case 136 /* Parameter */: break; - case 210 /* FunctionDeclaration */: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 115 /* AsyncKeyword */) && - node.parent.kind !== 216 /* ModuleBlock */ && node.parent.kind !== 245 /* SourceFile */) { + case 211 /* FunctionDeclaration */: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 116 /* AsyncKeyword */) && + node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 190 /* VariableStatement */: - case 213 /* TypeAliasDeclaration */: - if (node.modifiers && node.parent.kind !== 216 /* ModuleBlock */ && node.parent.kind !== 245 /* SourceFile */) { + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 191 /* VariableStatement */: + case 214 /* TypeAliasDeclaration */: + if (node.modifiers && node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; - case 214 /* EnumDeclaration */: - if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 71 /* ConstKeyword */) && - node.parent.kind !== 216 /* ModuleBlock */ && node.parent.kind !== 245 /* SourceFile */) { + case 215 /* EnumDeclaration */: + if (node.modifiers && (node.modifiers.length > 1 || node.modifiers[0].kind !== 72 /* ConstKeyword */) && + node.parent.kind !== 217 /* ModuleBlock */ && node.parent.kind !== 246 /* SourceFile */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } break; @@ -25605,14 +26098,14 @@ var ts; for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) { var modifier = _a[_i]; switch (modifier.kind) { - case 109 /* PublicKeyword */: - case 108 /* ProtectedKeyword */: - case 107 /* PrivateKeyword */: + case 110 /* PublicKeyword */: + case 109 /* ProtectedKeyword */: + case 108 /* PrivateKeyword */: var text = void 0; - if (modifier.kind === 109 /* PublicKeyword */) { + if (modifier.kind === 110 /* PublicKeyword */) { text = "public"; } - else if (modifier.kind === 108 /* ProtectedKeyword */) { + else if (modifier.kind === 109 /* ProtectedKeyword */) { text = "protected"; lastProtected = modifier; } @@ -25629,11 +26122,11 @@ var ts; else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 216 /* ModuleBlock */ || node.parent.kind === 245 /* SourceFile */) { + else if (node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } else if (flags & 256 /* Abstract */) { - if (modifier.kind === 107 /* PrivateKeyword */) { + if (modifier.kind === 108 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { @@ -25642,17 +26135,17 @@ var ts; } flags |= ts.modifierToFlag(modifier.kind); break; - case 110 /* StaticKeyword */: + case 111 /* StaticKeyword */: if (flags & 128 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 216 /* ModuleBlock */ || node.parent.kind === 245 /* SourceFile */) { + else if (node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 135 /* Parameter */) { + else if (node.kind === 136 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256 /* Abstract */) { @@ -25661,7 +26154,7 @@ var ts; flags |= 128 /* Static */; lastStatic = modifier; break; - case 79 /* ExportKeyword */: + case 80 /* ExportKeyword */: if (flags & 1 /* Export */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); } @@ -25674,42 +26167,42 @@ var ts; else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } - else if (node.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.kind === 212 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 135 /* Parameter */) { + else if (node.kind === 136 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; break; - case 119 /* DeclareKeyword */: + case 120 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.kind === 212 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 135 /* Parameter */) { + else if (node.kind === 136 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 216 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 217 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; lastDeclare = modifier; break; - case 112 /* AbstractKeyword */: + case 113 /* AbstractKeyword */: if (flags & 256 /* Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 211 /* ClassDeclaration */) { - if (node.kind !== 140 /* MethodDeclaration */) { + if (node.kind !== 212 /* ClassDeclaration */) { + if (node.kind !== 141 /* MethodDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_or_method_declaration); } - if (!(node.parent.kind === 211 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { + if (!(node.parent.kind === 212 /* ClassDeclaration */ && node.parent.flags & 256 /* Abstract */)) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 128 /* Static */) { @@ -25721,14 +26214,14 @@ var ts; } flags |= 256 /* Abstract */; break; - case 115 /* AsyncKeyword */: + case 116 /* AsyncKeyword */: if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* Ambient */ || ts.isInAmbientContext(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 135 /* Parameter */) { + else if (node.kind === 136 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } flags |= 512 /* Async */; @@ -25736,7 +26229,7 @@ var ts; break; } } - if (node.kind === 141 /* Constructor */) { + if (node.kind === 142 /* Constructor */) { if (flags & 128 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -25754,10 +26247,10 @@ var ts; } return; } - else if ((node.kind === 219 /* ImportDeclaration */ || node.kind === 218 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 220 /* ImportDeclaration */ || node.kind === 219 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 135 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 136 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } if (flags & 512 /* Async */) { @@ -25769,10 +26262,10 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics.Async_functions_are_only_available_when_targeting_ECMAScript_6_and_higher); } switch (node.kind) { - case 140 /* MethodDeclaration */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: if (!node.asteriskToken) { return false; } @@ -25820,16 +26313,14 @@ var ts; return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); } } - else if (parameter.questionToken || parameter.initializer) { + else if (parameter.questionToken) { seenOptionalParameter = true; - if (parameter.questionToken && parameter.initializer) { + if (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); - } + else if (seenOptionalParameter && !parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); } } } @@ -25840,7 +26331,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 171 /* ArrowFunction */) { + if (node.kind === 172 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -25875,7 +26366,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 127 /* StringKeyword */ && parameter.type.kind !== 125 /* NumberKeyword */) { + if (parameter.type.kind !== 128 /* StringKeyword */ && parameter.type.kind !== 126 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -25908,7 +26399,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < args.length; _i++) { var arg = args[_i]; - if (arg.kind === 184 /* OmittedExpression */) { + if (arg.kind === 185 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -25935,7 +26426,7 @@ var ts; if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 80 /* ExtendsKeyword */) { + if (heritageClause.token === 81 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } @@ -25948,7 +26439,7 @@ var ts; seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 103 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 104 /* ImplementsKeyword */); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); } @@ -25964,14 +26455,14 @@ var ts; if (node.heritageClauses) { for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) { var heritageClause = _a[_i]; - if (heritageClause.token === 80 /* ExtendsKeyword */) { + if (heritageClause.token === 81 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - ts.Debug.assert(heritageClause.token === 103 /* ImplementsKeyword */); + ts.Debug.assert(heritageClause.token === 104 /* ImplementsKeyword */); return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); } // Grammar checking heritageClause inside class declaration @@ -25982,19 +26473,19 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 133 /* ComputedPropertyName */) { + if (node.kind !== 134 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 178 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 23 /* CommaToken */) { + if (computedPropertyName.expression.kind === 179 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 24 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 210 /* FunctionDeclaration */ || - node.kind === 170 /* FunctionExpression */ || - node.kind === 140 /* MethodDeclaration */); + ts.Debug.assert(node.kind === 211 /* FunctionDeclaration */ || + node.kind === 171 /* FunctionExpression */ || + node.kind === 141 /* MethodDeclaration */); if (ts.isInAmbientContext(node)) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -26020,8 +26511,8 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_16 = prop.name; - if (prop.kind === 184 /* OmittedExpression */ || - name_16.kind === 133 /* ComputedPropertyName */) { + if (prop.kind === 185 /* OmittedExpression */ || + name_16.kind === 134 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name_16); continue; @@ -26035,21 +26526,21 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 242 /* PropertyAssignment */ || prop.kind === 243 /* ShorthandPropertyAssignment */) { + if (prop.kind === 243 /* PropertyAssignment */ || prop.kind === 244 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); - if (name_16.kind === 7 /* NumericLiteral */) { + if (name_16.kind === 8 /* NumericLiteral */) { checkGrammarNumericLiteral(name_16); } currentKind = Property; } - else if (prop.kind === 140 /* MethodDeclaration */) { + else if (prop.kind === 141 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 142 /* GetAccessor */) { + else if (prop.kind === 143 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 143 /* SetAccessor */) { + else if (prop.kind === 144 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -26081,7 +26572,7 @@ var ts; var seen = {}; for (var _i = 0, _a = node.attributes; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 236 /* JsxSpreadAttribute */) { + if (attr.kind === 237 /* JsxSpreadAttribute */) { continue; } var jsxAttr = attr; @@ -26093,7 +26584,7 @@ var ts; return grammarErrorOnNode(name_17, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } var initializer = jsxAttr.initializer; - if (initializer && initializer.kind === 237 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 238 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(jsxAttr.initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -26102,24 +26593,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 209 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 210 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 197 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 197 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 197 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 198 /* ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -26142,10 +26633,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 142 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 143 /* GetAccessor */ && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 143 /* SetAccessor */) { + else if (kind === 144 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -26170,7 +26661,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 133 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 134 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -26180,7 +26671,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 162 /* ObjectLiteralExpression */) { + if (node.parent.kind === 163 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -26204,22 +26695,22 @@ var ts; return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 212 /* InterfaceDeclaration */) { + else if (node.parent.kind === 213 /* InterfaceDeclaration */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 152 /* TypeLiteral */) { + else if (node.parent.kind === 153 /* TypeLiteral */) { return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: return true; - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -26231,26 +26722,26 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 199 /* ContinueStatement */ - && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 200 /* ContinueStatement */ + && !isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } return false; } break; - case 203 /* SwitchStatement */: - if (node.kind === 200 /* BreakStatement */ && !node.label) { + case 204 /* SwitchStatement */: + if (node.kind === 201 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } break; default: - if (isIterationStatement(current, false) && !node.label) { + if (isIterationStatement(current, /*lookInLabeledStatement*/ false) && !node.label) { // unlabeled break or continue within iteration statement - ok return false; } @@ -26259,13 +26750,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 200 /* BreakStatement */ + var message = node.kind === 201 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 200 /* BreakStatement */ + var message = node.kind === 201 /* BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -26277,7 +26768,7 @@ var ts; if (node !== ts.lastOrUndefined(elements)) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 159 /* ArrayBindingPattern */ || node.name.kind === 158 /* ObjectBindingPattern */) { + if (node.name.kind === 160 /* ArrayBindingPattern */ || node.name.kind === 159 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -26287,7 +26778,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 197 /* ForInStatement */ && node.parent.parent.kind !== 198 /* ForOfStatement */) { + if (node.parent.parent.kind !== 198 /* ForInStatement */ && node.parent.parent.kind !== 199 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -26314,7 +26805,7 @@ var ts; return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 66 /* Identifier */) { + if (name.kind === 67 /* Identifier */) { if (name.text === "let") { return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -26323,7 +26814,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 184 /* OmittedExpression */) { + if (element.kind !== 185 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -26340,15 +26831,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 193 /* IfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 202 /* WithStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 194 /* IfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 203 /* WithStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: return false; - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -26364,13 +26855,13 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 176 /* PrefixUnaryExpression */) { + if (expression.kind === 177 /* PrefixUnaryExpression */) { var unaryExpression = expression; - if (unaryExpression.operator === 34 /* PlusToken */ || unaryExpression.operator === 35 /* MinusToken */) { + if (unaryExpression.operator === 35 /* PlusToken */ || unaryExpression.operator === 36 /* MinusToken */) { expression = unaryExpression.operand; } } - if (expression.kind === 7 /* NumericLiteral */) { + if (expression.kind === 8 /* NumericLiteral */) { // Allows for scientific notation since literalExpression.text was formed by // coercing a number to a string. Sometimes this coercion can yield a string // in scientific notation. @@ -26393,7 +26884,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 133 /* ComputedPropertyName */) { + if (node.name.kind === 134 /* ComputedPropertyName */) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -26436,7 +26927,7 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 66 /* Identifier */ && + return node.kind === 67 /* Identifier */ && (node.text === "eval" || node.text === "arguments"); } function checkGrammarConstructorTypeParameters(node) { @@ -26456,12 +26947,12 @@ var ts; return true; } } - else if (node.parent.kind === 212 /* InterfaceDeclaration */) { + else if (node.parent.kind === 213 /* InterfaceDeclaration */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 152 /* TypeLiteral */) { + else if (node.parent.kind === 153 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -26481,11 +26972,11 @@ var ts; // export_opt ExternalImportDeclaration // export_opt AmbientDeclaration // - if (node.kind === 212 /* InterfaceDeclaration */ || - node.kind === 219 /* ImportDeclaration */ || - node.kind === 218 /* ImportEqualsDeclaration */ || - node.kind === 225 /* ExportDeclaration */ || - node.kind === 224 /* ExportAssignment */ || + if (node.kind === 213 /* InterfaceDeclaration */ || + node.kind === 220 /* ImportDeclaration */ || + node.kind === 219 /* ImportEqualsDeclaration */ || + node.kind === 226 /* ExportDeclaration */ || + node.kind === 225 /* ExportAssignment */ || (node.flags & 2 /* Ambient */) || (node.flags & (1 /* Export */ | 1024 /* Default */))) { return false; @@ -26495,7 +26986,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 190 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 191 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -26521,7 +27012,7 @@ var ts; // to prevent noisyness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 189 /* Block */ || node.parent.kind === 216 /* ModuleBlock */ || node.parent.kind === 245 /* SourceFile */) { + if (node.parent.kind === 190 /* Block */ || node.parent.kind === 217 /* ModuleBlock */ || node.parent.kind === 246 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -26542,7 +27033,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); - diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span), 0, message, arg0, arg1, arg2)); + diagnostics.add(ts.createFileDiagnostic(sourceFile, ts.textSpanEnd(span), /*length*/ 0, message, arg0, arg1, arg2)); return true; } } @@ -26603,7 +27094,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 219 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 220 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -26679,10 +27170,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 208 /* VariableDeclaration */) { + if (declaration.kind === 209 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 222 /* NamedImports */ || declaration.kind === 223 /* ImportSpecifier */ || declaration.kind === 220 /* ImportClause */) { + else if (declaration.kind === 223 /* NamedImports */ || declaration.kind === 224 /* ImportSpecifier */ || declaration.kind === 221 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -26700,7 +27191,7 @@ var ts; // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 219 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 220 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -26710,12 +27201,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 215 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 216 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 215 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 216 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -26798,7 +27289,7 @@ var ts; var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); // jsDoc comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, jsDocComments, true, newLine, ts.writeCommentRange); + ts.emitComments(currentSourceFile, writer, jsDocComments, /*trailingSeparator*/ true, newLine, ts.writeCommentRange); } } function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { @@ -26807,49 +27298,49 @@ var ts; } function emitType(type) { switch (type.kind) { - case 114 /* AnyKeyword */: - case 127 /* StringKeyword */: - case 125 /* NumberKeyword */: - case 117 /* BooleanKeyword */: - case 128 /* SymbolKeyword */: - case 100 /* VoidKeyword */: - case 8 /* StringLiteral */: + case 115 /* AnyKeyword */: + case 128 /* StringKeyword */: + case 126 /* NumberKeyword */: + case 118 /* BooleanKeyword */: + case 129 /* SymbolKeyword */: + case 101 /* VoidKeyword */: + case 9 /* StringLiteral */: return writeTextOfNode(currentSourceFile, type); - case 185 /* ExpressionWithTypeArguments */: + case 186 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(type); - case 148 /* TypeReference */: + case 149 /* TypeReference */: return emitTypeReference(type); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return emitTypeQuery(type); - case 153 /* ArrayType */: + case 154 /* ArrayType */: return emitArrayType(type); - case 154 /* TupleType */: + case 155 /* TupleType */: return emitTupleType(type); - case 155 /* UnionType */: + case 156 /* UnionType */: return emitUnionType(type); - case 156 /* IntersectionType */: + case 157 /* IntersectionType */: return emitIntersectionType(type); - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: return emitParenType(type); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 152 /* TypeLiteral */: + case 153 /* TypeLiteral */: return emitTypeLiteral(type); - case 66 /* Identifier */: + case 67 /* Identifier */: return emitEntityName(type); - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: return emitEntityName(type); - case 147 /* TypePredicate */: + case 148 /* TypePredicate */: return emitTypePredicate(type); } function writeEntityName(entityName) { - if (entityName.kind === 66 /* Identifier */) { + if (entityName.kind === 67 /* Identifier */) { writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 132 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 132 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 133 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 133 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); @@ -26858,13 +27349,13 @@ var ts; function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 218 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 219 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); } function emitExpressionWithTypeArguments(node) { if (ts.isSupportedExpressionWithTypeArguments(node)) { - ts.Debug.assert(node.expression.kind === 66 /* Identifier */ || node.expression.kind === 163 /* PropertyAccessExpression */); + ts.Debug.assert(node.expression.kind === 67 /* Identifier */ || node.expression.kind === 164 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -26945,7 +27436,7 @@ var ts; } } function emitExportAssignment(node) { - if (node.expression.kind === 66 /* Identifier */) { + if (node.expression.kind === 67 /* Identifier */) { write(node.isExportEquals ? "export = " : "export default "); writeTextOfNode(currentSourceFile, node.expression); } @@ -26965,7 +27456,7 @@ var ts; write(";"); writeLine(); // Make all the declarations visible for the export name - if (node.expression.kind === 66 /* Identifier */) { + if (node.expression.kind === 67 /* Identifier */) { var nodes = resolver.collectLinkedAliases(node.expression); // write each of these declarations asynchronously writeAsynchronousModuleElements(nodes); @@ -26984,10 +27475,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 218 /* ImportEqualsDeclaration */ || - (node.parent.kind === 245 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 219 /* ImportEqualsDeclaration */ || + (node.parent.kind === 246 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 245 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 246 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -26997,7 +27488,7 @@ var ts; }); } else { - if (node.kind === 219 /* ImportDeclaration */) { + if (node.kind === 220 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -27015,23 +27506,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return writeVariableStatement(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return writeClassDeclaration(node); - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -27047,7 +27538,7 @@ var ts; if (node.flags & 1024 /* Default */) { write("default "); } - else if (node.kind !== 212 /* InterfaceDeclaration */) { + else if (node.kind !== 213 /* InterfaceDeclaration */) { write("declare "); } } @@ -27096,7 +27587,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 221 /* NamespaceImport */) { + if (namedBindings.kind === 222 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -27124,7 +27615,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 222 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -27182,7 +27673,7 @@ var ts; write("module "); } writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 216 /* ModuleBlock */) { + while (node.body.kind !== 217 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -27199,14 +27690,18 @@ var ts; enclosingDeclaration = prevEnclosingDeclaration; } function writeTypeAliasDeclaration(node) { + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; emitJsDocComments(node); emitModuleElementDeclarationFlags(node); write("type "); writeTextOfNode(currentSourceFile, node.name); + emitTypeParameters(node.typeParameters); write(" = "); emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); write(";"); writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { return { diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, @@ -27243,7 +27738,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 140 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 141 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -27254,15 +27749,15 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 149 /* FunctionType */ || - node.parent.kind === 150 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 152 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 140 /* MethodDeclaration */ || - node.parent.kind === 139 /* MethodSignature */ || - node.parent.kind === 149 /* FunctionType */ || - node.parent.kind === 150 /* ConstructorType */ || - node.parent.kind === 144 /* CallSignature */ || - node.parent.kind === 145 /* ConstructSignature */); + if (node.parent.kind === 150 /* FunctionType */ || + node.parent.kind === 151 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 153 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 141 /* MethodDeclaration */ || + node.parent.kind === 140 /* MethodSignature */ || + node.parent.kind === 150 /* FunctionType */ || + node.parent.kind === 151 /* ConstructorType */ || + node.parent.kind === 145 /* CallSignature */ || + node.parent.kind === 146 /* ConstructSignature */); emitType(node.constraint); } else { @@ -27273,31 +27768,31 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 144 /* CallSignature */: + case 145 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 212 /* ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -27328,7 +27823,7 @@ var ts; function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 211 /* ClassDeclaration */) { + if (node.parent.parent.kind === 212 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -27368,9 +27863,9 @@ var ts; emitTypeParameters(node.typeParameters); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - emitHeritageClause([baseTypeNode], false); + emitHeritageClause([baseTypeNode], /*isImplementsList*/ false); } - emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), true); + emitHeritageClause(ts.getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true); write(" {"); writeLine(); increaseIndent(); @@ -27389,7 +27884,7 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitTypeParameters(node.typeParameters); - emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), /*isImplementsList*/ false); write(" {"); writeLine(); increaseIndent(); @@ -27412,7 +27907,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 208 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 209 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -27422,10 +27917,10 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentSourceFile, node.name); // If optional property emit ? - if ((node.kind === 138 /* PropertyDeclaration */ || node.kind === 137 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 138 /* PropertyDeclaration */ || node.kind === 137 /* PropertySignature */) && node.parent.kind === 152 /* TypeLiteral */) { + if ((node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) && node.parent.kind === 153 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32 /* Private */)) { @@ -27434,14 +27929,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 208 /* VariableDeclaration */) { + if (node.kind === 209 /* VariableDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 138 /* PropertyDeclaration */ || node.kind === 137 /* PropertySignature */) { + else if (node.kind === 139 /* PropertyDeclaration */ || node.kind === 138 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? @@ -27450,7 +27945,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.kind === 212 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -27482,7 +27977,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 184 /* OmittedExpression */) { + if (element.kind !== 185 /* OmittedExpression */) { elements.push(element); } } @@ -27503,7 +27998,7 @@ var ts; } else { writeTextOfNode(currentSourceFile, bindingElement.name); - writeTypeOfDeclaration(bindingElement, undefined, getBindingElementTypeVisibilityError); + writeTypeOfDeclaration(bindingElement, /*type*/ undefined, getBindingElementTypeVisibilityError); } } } @@ -27552,7 +28047,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 142 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 143 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -27565,7 +28060,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 142 /* GetAccessor */ + return accessor.kind === 143 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -27574,7 +28069,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 143 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 144 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? @@ -27624,17 +28119,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 210 /* FunctionDeclaration */) { + if (node.kind === 211 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 140 /* MethodDeclaration */) { + else if (node.kind === 141 /* MethodDeclaration */) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 210 /* FunctionDeclaration */) { + if (node.kind === 211 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 141 /* Constructor */) { + else if (node.kind === 142 /* Constructor */) { write("constructor"); } else { @@ -27652,11 +28147,11 @@ var ts; } function emitSignatureDeclaration(node) { // Construct signature or constructor type write new Signature - if (node.kind === 145 /* ConstructSignature */ || node.kind === 150 /* ConstructorType */) { + if (node.kind === 146 /* ConstructSignature */ || node.kind === 151 /* ConstructorType */) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 146 /* IndexSignature */) { + if (node.kind === 147 /* IndexSignature */) { write("["); } else { @@ -27666,22 +28161,22 @@ var ts; enclosingDeclaration = node; // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 146 /* IndexSignature */) { + if (node.kind === 147 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 149 /* FunctionType */ || node.kind === 150 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 152 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 150 /* FunctionType */ || node.kind === 151 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 153 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 141 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 142 /* Constructor */ && !(node.flags & 32 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -27692,26 +28187,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 144 /* CallSignature */: + case 145 /* CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 146 /* IndexSignature */: + case 147 /* IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -27719,7 +28214,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.kind === 212 /* 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 : @@ -27733,7 +28228,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 210 /* FunctionDeclaration */: + case 211 /* 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 : @@ -27764,13 +28259,13 @@ var ts; else { writeTextOfNode(currentSourceFile, node.name); } - if (node.initializer || ts.hasQuestionToken(node)) { + if (resolver.isOptionalParameter(node)) { write("?"); } decreaseIndent(); - if (node.parent.kind === 149 /* FunctionType */ || - node.parent.kind === 150 /* ConstructorType */ || - node.parent.parent.kind === 152 /* TypeLiteral */) { + if (node.parent.kind === 150 /* FunctionType */ || + node.parent.kind === 151 /* ConstructorType */ || + node.parent.parent.kind === 153 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32 /* Private */)) { @@ -27786,24 +28281,24 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 141 /* Constructor */: + case 142 /* Constructor */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 144 /* CallSignature */: + case 145 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -27811,7 +28306,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 211 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 212 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -27824,7 +28319,7 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -27836,12 +28331,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 158 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 159 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 159 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 160 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -27860,7 +28355,7 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 184 /* OmittedExpression */) { + if (bindingElement.kind === 185 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -27869,7 +28364,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 160 /* BindingElement */) { + else if (bindingElement.kind === 161 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -27879,10 +28374,8 @@ var ts; // emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void; writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); - // If bindingElement has propertyName property, then its name must be another bindingPattern of SyntaxKind.ObjectBindingPattern - emitBindingPattern(bindingElement.name); } - else if (bindingElement.name) { + if (bindingElement.name) { if (ts.isBindingPattern(bindingElement.name)) { // If it is a nested binding pattern, we will recursively descend into each element and emit each one separately. // In the case of rest element, we will omit rest element. @@ -27894,7 +28387,7 @@ var ts; emitBindingPattern(bindingElement.name); } else { - ts.Debug.assert(bindingElement.name.kind === 66 /* Identifier */); + ts.Debug.assert(bindingElement.name.kind === 67 /* Identifier */); // If the node is just an identifier, we will simply emit the text associated with the node's name // Example: // original: function foo({y = 10, x}) {} @@ -27910,40 +28403,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 210 /* FunctionDeclaration */: - case 215 /* ModuleDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 212 /* InterfaceDeclaration */: - case 211 /* ClassDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 214 /* EnumDeclaration */: + case 211 /* FunctionDeclaration */: + case 216 /* ModuleDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 213 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 215 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible - return emitModuleElement(node, !node.importClause); - case 225 /* ExportDeclaration */: + return emitModuleElement(node, /*isModuleElementVisible*/ !node.importClause); + case 226 /* ExportDeclaration */: return emitExportDeclaration(node); - case 141 /* Constructor */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 142 /* Constructor */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return writeFunctionDeclaration(node); - case 145 /* ConstructSignature */: - case 144 /* CallSignature */: - case 146 /* IndexSignature */: + case 146 /* ConstructSignature */: + case 145 /* CallSignature */: + case 147 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return emitAccessorDeclaration(node); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return emitPropertyDeclaration(node); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return emitExportAssignment(node); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return emitSourceFile(node); } } @@ -27952,7 +28445,7 @@ var ts; ? referencedFile.fileName // Declaration file, use declaration file name : ts.shouldEmitToOwnFile(referencedFile, compilerOptions) ? ts.getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file - : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; // Global out file + : ts.removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; // Global out file declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ false); referencePathsOutput += "/// " + newLine; @@ -28026,18 +28519,18 @@ var ts; emitFile(jsFilePath, sourceFile); } }); - if (compilerOptions.out) { - emitFile(compilerOptions.out); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } else { // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) if (ts.shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, ts.forEach(host.getSourceFiles(), shouldEmitJsx) ? ".jsx" : ".js"); + var jsFilePath = ts.getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!ts.isDeclarationFile(targetSourceFile) && compilerOptions.out) { - emitFile(compilerOptions.out); + else if (!ts.isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } // Sort and make the unique list of diagnostics @@ -28100,7 +28593,7 @@ var ts; var detachedCommentsInfo; var writeComment = ts.writeCommentRange; /** Emit a node */ - var emit = emitNodeWithoutSourceMap; + var emit = emitNodeWithCommentsAndWithoutSourcemap; /** Called just before starting emit of a node */ var emitStart = function (node) { }; /** Called once the emit of the node is done */ @@ -28135,7 +28628,7 @@ var ts; }); } writeLine(); - writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + writeEmittedFiles(writer.getText(), /*writeByteOrderMark*/ compilerOptions.emitBOM); return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; @@ -28195,7 +28688,7 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 8 /* StringLiteral */ ? + var baseName = expr.kind === 9 /* StringLiteral */ ? ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; return makeUniqueName(baseName); } @@ -28207,19 +28700,19 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return makeUniqueName(node.text); - case 215 /* ModuleDeclaration */: - case 214 /* EnumDeclaration */: + case 216 /* ModuleDeclaration */: + case 215 /* EnumDeclaration */: return generateNameForModuleOrEnum(node); - case 219 /* ImportDeclaration */: - case 225 /* ExportDeclaration */: + case 220 /* ImportDeclaration */: + case 226 /* ExportDeclaration */: return generateNameForImportOrExportDeclaration(node); - case 210 /* FunctionDeclaration */: - case 211 /* ClassDeclaration */: - case 224 /* ExportAssignment */: + case 211 /* FunctionDeclaration */: + case 212 /* ClassDeclaration */: + case 225 /* ExportAssignment */: return generateNameForExportDefault(); - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: return generateNameForClassExpression(); } } @@ -28285,7 +28778,7 @@ var ts; function base64VLQFormatEncode(inValue) { function base64FormatEncode(inValue) { if (inValue < 64) { - return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(inValue); + return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue); } throw TypeError(inValue + ": not a 64 based value"); } @@ -28391,7 +28884,7 @@ var ts; // unless it is a computed property. Then it is shown with brackets, // but the brackets are included in the name. var name_21 = node.name; - if (!name_21 || name_21.kind !== 133 /* ComputedPropertyName */) { + if (!name_21 || name_21.kind !== 134 /* ComputedPropertyName */) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -28409,20 +28902,20 @@ var ts; // The scope was already given a name use it recordScopeNameStart(scopeName); } - else if (node.kind === 210 /* FunctionDeclaration */ || - node.kind === 170 /* FunctionExpression */ || - node.kind === 140 /* MethodDeclaration */ || - node.kind === 139 /* MethodSignature */ || - node.kind === 142 /* GetAccessor */ || - node.kind === 143 /* SetAccessor */ || - node.kind === 215 /* ModuleDeclaration */ || - node.kind === 211 /* ClassDeclaration */ || - node.kind === 214 /* EnumDeclaration */) { + else if (node.kind === 211 /* FunctionDeclaration */ || + node.kind === 171 /* FunctionExpression */ || + node.kind === 141 /* MethodDeclaration */ || + node.kind === 140 /* MethodSignature */ || + node.kind === 143 /* GetAccessor */ || + node.kind === 144 /* SetAccessor */ || + node.kind === 216 /* ModuleDeclaration */ || + node.kind === 212 /* ClassDeclaration */ || + node.kind === 215 /* EnumDeclaration */) { // Declaration and has associated name use it if (node.name) { var name_22 = node.name; // For computed property names, the text will include the brackets - scopeName = name_22.kind === 133 /* ComputedPropertyName */ + scopeName = name_22.kind === 134 /* ComputedPropertyName */ ? ts.getTextOfNode(name_22) : node.name.text; } @@ -28481,7 +28974,7 @@ var ts; } else { // Write source map file - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false); sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; } // Write sourcemap url to the js file and write the js file @@ -28517,7 +29010,9 @@ var ts; if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { // The relative paths are relative to the common directory sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); - sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath + ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap + host.getCurrentDirectory(), host.getCanonicalFileName, /*isAbsolutePathAnUrl*/ true); } else { @@ -28532,7 +29027,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node); } - if (node.kind !== 245 /* SourceFile */) { + if (node.kind !== 246 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node); recordEmitNodeEndSpan(node); @@ -28543,8 +29038,11 @@ var ts; } } } + function emitNodeWithCommentsAndWithSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithSourceMap; + emit = emitNodeWithCommentsAndWithSourcemap; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -28557,7 +29055,7 @@ var ts; } // Create a temporary variable with a unique unused name. function createTempVariable(flags) { - var result = ts.createSynthesizedNode(66 /* Identifier */); + var result = ts.createSynthesizedNode(67 /* Identifier */); result.text = makeTempVariableName(flags); return result; } @@ -28667,7 +29165,14 @@ var ts; write(", "); } } - emitNode(nodes[start + i]); + var node = nodes[start + i]; + // This emitting is to make sure we emit following comment properly + // ...(x, /*comment1*/ y)... + // ^ => node.pos + // "comment1" is not considered leading comment for "y" but rather + // considered as trailing comment of the previous node. + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); leadingComma = true; } if (trailingComma) { @@ -28680,11 +29185,11 @@ var ts; } function emitCommaList(nodes) { if (nodes) { - emitList(nodes, 0, nodes.length, false, false); + emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); } } function emitLines(nodes) { - emitLinesStartingAt(nodes, 0); + emitLinesStartingAt(nodes, /*startIndex*/ 0); } function emitLinesStartingAt(nodes, startIndex) { for (var i = startIndex; i < nodes.length; i++) { @@ -28693,7 +29198,7 @@ var ts; } } function isBinaryOrOctalIntegerLiteral(node, text) { - if (node.kind === 7 /* NumericLiteral */ && text.length > 1) { + if (node.kind === 8 /* NumericLiteral */ && text.length > 1) { switch (text.charCodeAt(1)) { case 98 /* b */: case 66 /* B */: @@ -28706,7 +29211,7 @@ var ts; } function emitLiteral(node) { var text = getLiteralText(node); - if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 9 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { @@ -28720,7 +29225,7 @@ var ts; // Any template literal or string literal with an extended escape // (e.g. "\u{0067}") will need to be downleveled as a escaped string literal. if (languageVersion < 2 /* ES6 */ && (ts.isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) { - return getQuotedEscapedLiteralText('"', node.text, '"'); + return getQuotedEscapedLiteralText("\"", node.text, "\""); } // If we don't need to downlevel and we can reach the original source text using // the node's parent reference, then simply get the text as it was originally written. @@ -28730,17 +29235,17 @@ var ts; // If we can't reach the original source text, use the canonical form if it's a number, // or an escaped quoted form of the original text if it's string-like. switch (node.kind) { - case 8 /* StringLiteral */: - return getQuotedEscapedLiteralText('"', node.text, '"'); - case 10 /* NoSubstitutionTemplateLiteral */: - return getQuotedEscapedLiteralText('`', node.text, '`'); - case 11 /* TemplateHead */: - return getQuotedEscapedLiteralText('`', node.text, '${'); - case 12 /* TemplateMiddle */: - return getQuotedEscapedLiteralText('}', node.text, '${'); - case 13 /* TemplateTail */: - return getQuotedEscapedLiteralText('}', node.text, '`'); - case 7 /* NumericLiteral */: + case 9 /* StringLiteral */: + return getQuotedEscapedLiteralText("\"", node.text, "\""); + case 11 /* NoSubstitutionTemplateLiteral */: + return getQuotedEscapedLiteralText("`", node.text, "`"); + case 12 /* TemplateHead */: + return getQuotedEscapedLiteralText("`", node.text, "${"); + case 13 /* TemplateMiddle */: + return getQuotedEscapedLiteralText("}", node.text, "${"); + case 14 /* TemplateTail */: + return getQuotedEscapedLiteralText("}", node.text, "`"); + case 8 /* NumericLiteral */: return node.text; } ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for."); @@ -28757,18 +29262,18 @@ var ts; // thus we need to remove those characters. // First template piece starts with "`", others with "}" // Last template piece ends with "`", others with "${" - var isLast = node.kind === 10 /* NoSubstitutionTemplateLiteral */ || node.kind === 13 /* TemplateTail */; + var isLast = node.kind === 11 /* NoSubstitutionTemplateLiteral */ || node.kind === 14 /* TemplateTail */; text = text.substring(1, text.length - (isLast ? 1 : 2)); // Newline normalization: // ES6 Spec 11.8.6.1 - Static Semantics of TV's and TRV's // and LineTerminatorSequences are normalized to for both TV and TRV. text = text.replace(/\r\n?/g, "\n"); text = ts.escapeString(text); - write('"' + text + '"'); + write("\"" + text + "\""); } function emitDownlevelTaggedTemplateArray(node, literalEmitter) { write("["); - if (node.template.kind === 10 /* NoSubstitutionTemplateLiteral */) { + if (node.template.kind === 11 /* NoSubstitutionTemplateLiteral */) { literalEmitter(node.template); } else { @@ -28795,11 +29300,11 @@ var ts; write("("); emit(tempVariable); // Now we emit the expressions - if (node.template.kind === 180 /* TemplateExpression */) { + if (node.template.kind === 181 /* TemplateExpression */) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 178 /* BinaryExpression */ - && templateSpan.expression.operatorToken.kind === 23 /* CommaToken */; + var needsParens = templateSpan.expression.kind === 179 /* BinaryExpression */ + && templateSpan.expression.operatorToken.kind === 24 /* CommaToken */; emitParenthesizedIf(templateSpan.expression, needsParens); }); } @@ -28833,7 +29338,7 @@ var ts; // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 169 /* ParenthesizedExpression */ + var needsParens = templateSpan.expression.kind !== 170 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; if (i > 0 || headEmitted) { // If this is the first span and the head was not emitted, then this templateSpan's @@ -28875,11 +29380,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: return parent.expression === template; - case 167 /* TaggedTemplateExpression */: - case 169 /* ParenthesizedExpression */: + case 168 /* TaggedTemplateExpression */: + case 170 /* ParenthesizedExpression */: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; @@ -28900,20 +29405,20 @@ var ts; // 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 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: switch (expression.operatorToken.kind) { - case 36 /* AsteriskToken */: - case 37 /* SlashToken */: - case 38 /* PercentToken */: + case 37 /* AsteriskToken */: + case 38 /* SlashToken */: + case 39 /* PercentToken */: return 1 /* GreaterThan */; - case 34 /* PlusToken */: - case 35 /* MinusToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: return 0 /* EqualTo */; default: return -1 /* LessThan */; } - case 181 /* YieldExpression */: - case 179 /* ConditionalExpression */: + case 182 /* YieldExpression */: + case 180 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -28928,10 +29433,10 @@ var ts; /// Emit a tag name, which is either '"div"' for lower-cased names, or /// 'Div' for upper-cased or dotted names function emitTagName(name) { - if (name.kind === 66 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { - write('"'); + if (name.kind === 67 /* Identifier */ && ts.isIntrinsicJsxName(name.text)) { + write("\""); emit(name); - write('"'); + write("\""); } else { emit(name); @@ -28942,9 +29447,9 @@ var ts; /// about keywords, just non-identifier characters function emitAttributeName(name) { if (/[A-Za-z_]+[\w*]/.test(name.text)) { - write('"'); + write("\""); emit(name); - write('"'); + write("\""); } else { emit(name); @@ -28976,37 +29481,37 @@ var ts; // Either emit one big object literal (no spread attribs), or // a call to React.__spread var attrs = openingNode.attributes; - if (ts.forEach(attrs, function (attr) { return attr.kind === 236 /* JsxSpreadAttribute */; })) { + if (ts.forEach(attrs, function (attr) { return attr.kind === 237 /* JsxSpreadAttribute */; })) { write("React.__spread("); var haveOpenedObjectLiteral = false; - for (var i_2 = 0; i_2 < attrs.length; i_2++) { - if (attrs[i_2].kind === 236 /* JsxSpreadAttribute */) { + for (var i_1 = 0; i_1 < attrs.length; i_1++) { + if (attrs[i_1].kind === 237 /* JsxSpreadAttribute */) { // If this is the first argument, we need to emit a {} as the first argument - if (i_2 === 0) { + if (i_1 === 0) { write("{}, "); } if (haveOpenedObjectLiteral) { write("}"); haveOpenedObjectLiteral = false; } - if (i_2 > 0) { + if (i_1 > 0) { write(", "); } - emit(attrs[i_2].expression); + emit(attrs[i_1].expression); } else { - ts.Debug.assert(attrs[i_2].kind === 235 /* JsxAttribute */); + ts.Debug.assert(attrs[i_1].kind === 236 /* JsxAttribute */); if (haveOpenedObjectLiteral) { write(", "); } else { haveOpenedObjectLiteral = true; - if (i_2 > 0) { + if (i_1 > 0) { write(", "); } write("{"); } - emitJsxAttribute(attrs[i_2]); + emitJsxAttribute(attrs[i_1]); } } if (haveOpenedObjectLiteral) @@ -29029,16 +29534,16 @@ var ts; if (children) { for (var i = 0; i < children.length; i++) { // Don't emit empty expressions - if (children[i].kind === 237 /* JsxExpression */ && !(children[i].expression)) { + if (children[i].kind === 238 /* JsxExpression */ && !(children[i].expression)) { continue; } // Don't emit empty strings - if (children[i].kind === 233 /* JsxText */) { + if (children[i].kind === 234 /* JsxText */) { var text = getTextToEmit(children[i]); if (text !== undefined) { - write(', "'); + write(", \""); write(text); - write('"'); + write("\""); } } else { @@ -29051,11 +29556,11 @@ var ts; write(")"); // closes "React.createElement(" emitTrailingComments(openingNode); } - if (node.kind === 230 /* JsxElement */) { + if (node.kind === 231 /* JsxElement */) { emitJsxElement(node.openingElement, node.children); } else { - ts.Debug.assert(node.kind === 231 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 232 /* JsxSelfClosingElement */); emitJsxElement(node); } } @@ -29075,11 +29580,11 @@ var ts; if (i > 0) { write(" "); } - if (attribs[i].kind === 236 /* JsxSpreadAttribute */) { + if (attribs[i].kind === 237 /* JsxSpreadAttribute */) { emitJsxSpreadAttribute(attribs[i]); } else { - ts.Debug.assert(attribs[i].kind === 235 /* JsxAttribute */); + ts.Debug.assert(attribs[i].kind === 236 /* JsxAttribute */); emitJsxAttribute(attribs[i]); } } @@ -29087,11 +29592,11 @@ var ts; function emitJsxOpeningOrSelfClosingElement(node) { write("<"); emit(node.tagName); - if (node.attributes.length > 0 || (node.kind === 231 /* JsxSelfClosingElement */)) { + if (node.attributes.length > 0 || (node.kind === 232 /* JsxSelfClosingElement */)) { write(" "); } emitAttributes(node.attributes); - if (node.kind === 231 /* JsxSelfClosingElement */) { + if (node.kind === 232 /* JsxSelfClosingElement */) { write("/>"); } else { @@ -29110,11 +29615,11 @@ var ts; } emitJsxClosingElement(node.closingElement); } - if (node.kind === 230 /* JsxElement */) { + if (node.kind === 231 /* JsxElement */) { emitJsxElement(node); } else { - ts.Debug.assert(node.kind === 231 /* JsxSelfClosingElement */); + ts.Debug.assert(node.kind === 232 /* JsxSelfClosingElement */); emitJsxOpeningOrSelfClosingElement(node); } } @@ -29122,11 +29627,11 @@ var ts; // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. // For example, this is utilized when feeding in a result to Object.defineProperty. function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 160 /* BindingElement */); - if (node.kind === 8 /* StringLiteral */) { + ts.Debug.assert(node.kind !== 161 /* BindingElement */); + if (node.kind === 9 /* StringLiteral */) { emitLiteral(node); } - else if (node.kind === 133 /* ComputedPropertyName */) { + else if (node.kind === 134 /* ComputedPropertyName */) { // if this is a decorated computed property, we will need to capture the result // of the property expression so that we can apply decorators later. This is to ensure // we don't introduce unintended side effects: @@ -29158,7 +29663,7 @@ var ts; } else { write("\""); - if (node.kind === 7 /* NumericLiteral */) { + if (node.kind === 8 /* NumericLiteral */) { write(node.text); } else { @@ -29170,58 +29675,60 @@ var ts; function isExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 161 /* ArrayLiteralExpression */: - case 178 /* BinaryExpression */: - case 165 /* CallExpression */: - case 238 /* CaseClause */: - case 133 /* ComputedPropertyName */: - case 179 /* ConditionalExpression */: - case 136 /* Decorator */: - case 172 /* DeleteExpression */: - case 194 /* DoStatement */: - case 164 /* ElementAccessExpression */: - case 224 /* ExportAssignment */: - case 192 /* ExpressionStatement */: - case 185 /* ExpressionWithTypeArguments */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 193 /* IfStatement */: - case 231 /* JsxSelfClosingElement */: - case 232 /* JsxOpeningElement */: - case 166 /* NewExpression */: - case 169 /* ParenthesizedExpression */: - case 177 /* PostfixUnaryExpression */: - case 176 /* PrefixUnaryExpression */: - case 201 /* ReturnStatement */: - case 243 /* ShorthandPropertyAssignment */: - case 182 /* SpreadElementExpression */: - case 203 /* SwitchStatement */: - case 167 /* TaggedTemplateExpression */: - case 187 /* TemplateSpan */: - case 205 /* ThrowStatement */: - case 168 /* TypeAssertionExpression */: - case 173 /* TypeOfExpression */: - case 174 /* VoidExpression */: - case 195 /* WhileStatement */: - case 202 /* WithStatement */: - case 181 /* YieldExpression */: + case 162 /* ArrayLiteralExpression */: + case 179 /* BinaryExpression */: + case 166 /* CallExpression */: + case 239 /* CaseClause */: + case 134 /* ComputedPropertyName */: + case 180 /* ConditionalExpression */: + case 137 /* Decorator */: + case 173 /* DeleteExpression */: + case 195 /* DoStatement */: + case 165 /* ElementAccessExpression */: + case 225 /* ExportAssignment */: + case 193 /* ExpressionStatement */: + case 186 /* ExpressionWithTypeArguments */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 194 /* IfStatement */: + case 232 /* JsxSelfClosingElement */: + case 233 /* JsxOpeningElement */: + case 237 /* JsxSpreadAttribute */: + case 238 /* JsxExpression */: + case 167 /* NewExpression */: + case 170 /* ParenthesizedExpression */: + case 178 /* PostfixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: + case 202 /* ReturnStatement */: + case 244 /* ShorthandPropertyAssignment */: + case 183 /* SpreadElementExpression */: + case 204 /* SwitchStatement */: + case 168 /* TaggedTemplateExpression */: + case 188 /* TemplateSpan */: + case 206 /* ThrowStatement */: + case 169 /* TypeAssertionExpression */: + case 174 /* TypeOfExpression */: + case 175 /* VoidExpression */: + case 196 /* WhileStatement */: + case 203 /* WithStatement */: + case 182 /* YieldExpression */: return true; - case 160 /* BindingElement */: - case 244 /* EnumMember */: - case 135 /* Parameter */: - case 242 /* PropertyAssignment */: - case 138 /* PropertyDeclaration */: - case 208 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 245 /* EnumMember */: + case 136 /* Parameter */: + case 243 /* PropertyAssignment */: + case 139 /* PropertyDeclaration */: + case 209 /* VariableDeclaration */: return parent.initializer === node; - case 163 /* PropertyAccessExpression */: + case 164 /* PropertyAccessExpression */: return parent.expression === node; - case 171 /* ArrowFunction */: - case 170 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 171 /* FunctionExpression */: return parent.body === node; - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return parent.moduleReference === node; - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: return parent.left === node; } return false; @@ -29233,7 +29740,7 @@ var ts; } var container = resolver.getReferencedExportContainer(node); if (container) { - if (container.kind === 245 /* SourceFile */) { + if (container.kind === 246 /* SourceFile */) { // Identifier references module export if (languageVersion < 2 /* ES6 */ && compilerOptions.module !== 4 /* System */) { write("exports."); @@ -29248,13 +29755,13 @@ var ts; else if (languageVersion < 2 /* ES6 */) { var declaration = resolver.getReferencedImportDeclaration(node); if (declaration) { - if (declaration.kind === 220 /* ImportClause */) { + if (declaration.kind === 221 /* ImportClause */) { // Identifier references default import write(getGeneratedNameForNode(declaration.parent)); - write(languageVersion === 0 /* ES3 */ ? '["default"]' : ".default"); + write(languageVersion === 0 /* ES3 */ ? "[\"default\"]" : ".default"); return; } - else if (declaration.kind === 223 /* ImportSpecifier */) { + else if (declaration.kind === 224 /* ImportSpecifier */) { // Identifier references named import write(getGeneratedNameForNode(declaration.parent.parent.parent)); write("."); @@ -29272,13 +29779,13 @@ var ts; } function isNameOfNestedRedeclaration(node) { if (languageVersion < 2 /* ES6 */) { - var parent_7 = node.parent; - switch (parent_7.kind) { - case 160 /* BindingElement */: - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 208 /* VariableDeclaration */: - return parent_7.name === node && resolver.isNestedRedeclaration(parent_7); + var parent_6 = node.parent; + switch (parent_6.kind) { + case 161 /* BindingElement */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 209 /* VariableDeclaration */: + return parent_6.name === node && resolver.isNestedRedeclaration(parent_6); } } return false; @@ -29322,13 +29829,13 @@ var ts; function emitObjectBindingPattern(node) { write("{ "); var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); write(" }"); } function emitArrayBindingPattern(node) { write("["); var elements = node.elements; - emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + emitList(elements, 0, elements.length, /*multiLine*/ false, /*trailingComma*/ elements.hasTrailingComma); write("]"); } function emitBindingElement(node) { @@ -29352,7 +29859,7 @@ var ts; emit(node.expression); } function emitYieldExpression(node) { - write(ts.tokenToString(111 /* YieldKeyword */)); + write(ts.tokenToString(112 /* YieldKeyword */)); if (node.asteriskToken) { write("*"); } @@ -29366,7 +29873,7 @@ var ts; if (needsParenthesis) { write("("); } - write(ts.tokenToString(111 /* YieldKeyword */)); + write(ts.tokenToString(112 /* YieldKeyword */)); write(" "); emit(node.expression); if (needsParenthesis) { @@ -29374,22 +29881,22 @@ var ts; } } function needsParenthesisForAwaitExpressionAsYield(node) { - if (node.parent.kind === 178 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { + if (node.parent.kind === 179 /* BinaryExpression */ && !ts.isAssignmentOperator(node.parent.operatorToken.kind)) { return true; } - else if (node.parent.kind === 179 /* ConditionalExpression */ && node.parent.condition === node) { + else if (node.parent.kind === 180 /* ConditionalExpression */ && node.parent.condition === node) { return true; } return false; } function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { - case 66 /* Identifier */: - case 161 /* ArrayLiteralExpression */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: - case 165 /* CallExpression */: - case 169 /* ParenthesizedExpression */: + case 67 /* Identifier */: + case 162 /* ArrayLiteralExpression */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 170 /* ParenthesizedExpression */: // This list is not exhaustive and only includes those cases that are relevant // to the check in emitArrayLiteral. More cases can be added as needed. return false; @@ -29409,17 +29916,17 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 182 /* SpreadElementExpression */) { + if (e.kind === 183 /* SpreadElementExpression */) { e = e.expression; - emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); + emitParenthesizedIf(e, /*parenthesized*/ group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; - if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 161 /* ArrayLiteralExpression */) { + if (pos === length && group === 0 && needsUniqueCopy && e.kind !== 162 /* ArrayLiteralExpression */) { write(".slice()"); } } else { var i = pos; - while (i < length && elements[i].kind !== 182 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 183 /* SpreadElementExpression */) { i++; } write("["); @@ -29442,7 +29949,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 182 /* SpreadElementExpression */; + return node.kind === 183 /* SpreadElementExpression */; } function emitArrayLiteral(node) { var elements = node.elements; @@ -29451,12 +29958,12 @@ var ts; } else if (languageVersion >= 2 /* ES6 */ || !ts.forEach(elements, isSpreadElementExpression)) { write("["); - emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); write("]"); } else { - emitListWithSpread(elements, true, (node.flags & 2048 /* MultiLine */) !== 0, - /*trailingComma*/ elements.hasTrailingComma, true); + emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ (node.flags & 2048 /* MultiLine */) !== 0, + /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); } } function emitObjectLiteralBody(node, numElements) { @@ -29471,7 +29978,7 @@ var ts; // then try to preserve the original shape of the object literal. // Otherwise just try to preserve the formatting. if (numElements === properties.length) { - emitLinePreservingList(node, properties, languageVersion >= 1 /* ES5 */, true); + emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= 1 /* ES5 */, /* spacesBetweenBraces */ true); } else { var multiLine = (node.flags & 2048 /* MultiLine */) !== 0; @@ -29481,7 +29988,7 @@ var ts; else { increaseIndent(); } - emitList(properties, 0, numElements, multiLine, false); + emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ false); if (!multiLine) { write(" "); } @@ -29512,7 +30019,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 142 /* GetAccessor */ || property.kind === 143 /* SetAccessor */) { + if (property.kind === 143 /* GetAccessor */ || property.kind === 144 /* SetAccessor */) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { @@ -29564,13 +30071,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 242 /* PropertyAssignment */) { + if (property.kind === 243 /* PropertyAssignment */) { emit(property.initializer); } - else if (property.kind === 243 /* ShorthandPropertyAssignment */) { + else if (property.kind === 244 /* ShorthandPropertyAssignment */) { emitExpressionIdentifier(property.name); } - else if (property.kind === 140 /* MethodDeclaration */) { + else if (property.kind === 141 /* MethodDeclaration */) { emitFunctionDeclaration(property); } else { @@ -29604,7 +30111,7 @@ var ts; // 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 === 133 /* ComputedPropertyName */) { + if (properties[i].name.kind === 134 /* ComputedPropertyName */) { numInitialNonComputedProperties = i; break; } @@ -29620,21 +30127,21 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(178 /* BinaryExpression */, startsOnNewLine); + var result = ts.createSynthesizedNode(179 /* BinaryExpression */, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(163 /* PropertyAccessExpression */); + var result = ts.createSynthesizedNode(164 /* PropertyAccessExpression */); result.expression = parenthesizeForAccess(expression); - result.dotToken = ts.createSynthesizedNode(20 /* DotToken */); + result.dotToken = ts.createSynthesizedNode(21 /* DotToken */); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(164 /* ElementAccessExpression */); + var result = ts.createSynthesizedNode(165 /* ElementAccessExpression */); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; @@ -29642,7 +30149,7 @@ var ts; function parenthesizeForAccess(expr) { // When diagnosing whether the expression needs parentheses, the decision should be based // on the innermost expression in a chain of nested type assertions. - while (expr.kind === 168 /* TypeAssertionExpression */ || expr.kind === 186 /* AsExpression */) { + while (expr.kind === 169 /* TypeAssertionExpression */ || expr.kind === 187 /* AsExpression */) { expr = expr.expression; } // isLeftHandSideExpression is almost the correct criterion for when it is not necessary @@ -29654,11 +30161,11 @@ var ts; // 1.x -> not the same as (1).x // if (ts.isLeftHandSideExpression(expr) && - expr.kind !== 166 /* NewExpression */ && - expr.kind !== 7 /* NumericLiteral */) { + expr.kind !== 167 /* NewExpression */ && + expr.kind !== 8 /* NumericLiteral */) { return expr; } - var node = ts.createSynthesizedNode(169 /* ParenthesizedExpression */); + var node = ts.createSynthesizedNode(170 /* ParenthesizedExpression */); node.expression = expr; return node; } @@ -29680,12 +30187,20 @@ var ts; function emitPropertyAssignment(node) { emit(node.name); write(": "); + // This is to ensure that we emit comment in the following case: + // For example: + // obj = { + // id: /*comment1*/ ()=>void + // } + // "comment1" is not considered to be leading comment for node.initializer + // but rather a trailing comment on the previous node. + emitTrailingCommentsOfPosition(node.initializer.pos); emit(node.initializer); } // Return true if identifier resolves to an exported member of a namespace function isNamespaceExportReference(node) { var container = resolver.getReferencedExportContainer(node); - return container && container.kind !== 245 /* SourceFile */; + return container && container.kind !== 246 /* SourceFile */; } function emitShorthandPropertyAssignment(node) { // The name property of a short-hand property assignment is considered an expression position, so here @@ -29707,21 +30222,25 @@ var ts; } } function tryEmitConstantValue(node) { - if (compilerOptions.isolatedModules) { - // do not inline enum values in separate compilation mode - return false; - } - var constantValue = resolver.getConstantValue(node); + var constantValue = tryGetConstEnumValue(node); if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 163 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 164 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; } return false; } + function tryGetConstEnumValue(node) { + if (compilerOptions.isolatedModules) { + return undefined; + } + return node.kind === 164 /* PropertyAccessExpression */ || node.kind === 165 /* ElementAccessExpression */ + ? resolver.getConstantValue(node) + : undefined; + } // Returns 'true' if the code was actually indented, false otherwise. // If the code is not indented, an optional valueToWriteWhenNotIndenting will be // emitted instead. @@ -29748,10 +30267,20 @@ var ts; emit(node.expression); var indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken); // 1 .toString is a valid property access, emit a space after the literal + // Also emit a space if expression is a integer const enum value - it will appear in generated code as numeric literal var shouldEmitSpace; - if (!indentedBeforeDot && node.expression.kind === 7 /* NumericLiteral */) { - var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); - shouldEmitSpace = text.indexOf(ts.tokenToString(20 /* DotToken */)) < 0; + if (!indentedBeforeDot) { + if (node.expression.kind === 8 /* NumericLiteral */) { + // check if numeric literal was originally written with a dot + var text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node.expression); + shouldEmitSpace = text.indexOf(ts.tokenToString(21 /* DotToken */)) < 0; + } + else { + // check if constant enum value is integer + var constantValue = tryGetConstEnumValue(node.expression); + // isFinite handles cases when constantValue is undefined + shouldEmitSpace = isFinite(constantValue) && Math.floor(constantValue) === constantValue; + } } if (shouldEmitSpace) { write(" ."); @@ -29769,7 +30298,7 @@ var ts; emit(node.right); } function emitQualifiedNameAsExpression(node, useFallback) { - if (node.left.kind === 66 /* Identifier */) { + if (node.left.kind === 67 /* Identifier */) { emitEntityNameAsExpression(node.left, useFallback); } else if (useFallback) { @@ -29777,19 +30306,19 @@ var ts; write("("); emitNodeWithoutSourceMap(temp); write(" = "); - emitEntityNameAsExpression(node.left, true); + emitEntityNameAsExpression(node.left, /*useFallback*/ true); write(") && "); emitNodeWithoutSourceMap(temp); } else { - emitEntityNameAsExpression(node.left, false); + emitEntityNameAsExpression(node.left, /*useFallback*/ false); } write("."); - emitNodeWithoutSourceMap(node.right); + emit(node.right); } function emitEntityNameAsExpression(node, useFallback) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: if (useFallback) { write("typeof "); emitExpressionIdentifier(node); @@ -29797,7 +30326,7 @@ var ts; } emitExpressionIdentifier(node); break; - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: emitQualifiedNameAsExpression(node, useFallback); break; } @@ -29812,16 +30341,16 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 182 /* SpreadElementExpression */; }); + return ts.forEach(elements, function (e) { return e.kind === 183 /* SpreadElementExpression */; }); } function skipParentheses(node) { - while (node.kind === 169 /* ParenthesizedExpression */ || node.kind === 168 /* TypeAssertionExpression */ || node.kind === 186 /* AsExpression */) { + while (node.kind === 170 /* ParenthesizedExpression */ || node.kind === 169 /* TypeAssertionExpression */ || node.kind === 187 /* AsExpression */) { node = node.expression; } return node; } function emitCallTarget(node) { - if (node.kind === 66 /* Identifier */ || node.kind === 94 /* ThisKeyword */ || node.kind === 92 /* SuperKeyword */) { + if (node.kind === 67 /* Identifier */ || node.kind === 95 /* ThisKeyword */ || node.kind === 93 /* SuperKeyword */) { emit(node); return node; } @@ -29836,20 +30365,20 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 163 /* PropertyAccessExpression */) { + if (expr.kind === 164 /* PropertyAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 164 /* ElementAccessExpression */) { + else if (expr.kind === 165 /* ElementAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); write("]"); } - else if (expr.kind === 92 /* SuperKeyword */) { + else if (expr.kind === 93 /* SuperKeyword */) { target = expr; write("_super"); } @@ -29858,7 +30387,7 @@ var ts; } write(".apply("); if (target) { - if (target.kind === 92 /* SuperKeyword */) { + if (target.kind === 93 /* SuperKeyword */) { // Calls of form super(...) and super.foo(...) emitThis(target); } @@ -29872,7 +30401,7 @@ var ts; write("void 0"); } write(", "); - emitListWithSpread(node.arguments, false, false, false, true); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ true); write(")"); } function emitCallExpression(node) { @@ -29881,13 +30410,13 @@ var ts; return; } var superCall = false; - if (node.expression.kind === 92 /* SuperKeyword */) { + if (node.expression.kind === 93 /* SuperKeyword */) { emitSuper(node.expression); superCall = true; } else { emit(node.expression); - superCall = node.expression.kind === 163 /* PropertyAccessExpression */ && node.expression.expression.kind === 92 /* SuperKeyword */; + superCall = node.expression.kind === 164 /* PropertyAccessExpression */ && node.expression.expression.kind === 93 /* SuperKeyword */; } if (superCall && languageVersion < 2 /* ES6 */) { write(".call("); @@ -29929,7 +30458,7 @@ var ts; write(".bind.apply("); emit(target); write(", [void 0].concat("); - emitListWithSpread(node.arguments, false, false, false, false); + emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); write(")))"); write("()"); } @@ -29956,12 +30485,12 @@ var ts; // If the node is synthesized, it means the emitter put the parentheses there, // not the user. If we didn't want them, the emitter would not have put them // there. - if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 171 /* ArrowFunction */) { - if (node.expression.kind === 168 /* TypeAssertionExpression */ || node.expression.kind === 186 /* AsExpression */) { + if (!ts.nodeIsSynthesized(node) && node.parent.kind !== 172 /* ArrowFunction */) { + if (node.expression.kind === 169 /* TypeAssertionExpression */ || node.expression.kind === 187 /* AsExpression */) { var operand = node.expression.expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; - while (operand.kind === 168 /* TypeAssertionExpression */ || operand.kind === 186 /* AsExpression */) { + while (operand.kind === 169 /* TypeAssertionExpression */ || operand.kind === 187 /* AsExpression */) { operand = operand.expression; } // We have an expression of the form: (SubExpr) @@ -29972,14 +30501,14 @@ var ts; // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() // new (A()) should be emitted as new (A()) and not new A() // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 176 /* PrefixUnaryExpression */ && - operand.kind !== 174 /* VoidExpression */ && - operand.kind !== 173 /* TypeOfExpression */ && - operand.kind !== 172 /* DeleteExpression */ && - operand.kind !== 177 /* PostfixUnaryExpression */ && - operand.kind !== 166 /* NewExpression */ && - !(operand.kind === 165 /* CallExpression */ && node.parent.kind === 166 /* NewExpression */) && - !(operand.kind === 170 /* FunctionExpression */ && node.parent.kind === 165 /* CallExpression */)) { + if (operand.kind !== 177 /* PrefixUnaryExpression */ && + operand.kind !== 175 /* VoidExpression */ && + operand.kind !== 174 /* TypeOfExpression */ && + operand.kind !== 173 /* DeleteExpression */ && + operand.kind !== 178 /* PostfixUnaryExpression */ && + operand.kind !== 167 /* NewExpression */ && + !(operand.kind === 166 /* CallExpression */ && node.parent.kind === 167 /* NewExpression */) && + !(operand.kind === 171 /* FunctionExpression */ && node.parent.kind === 166 /* CallExpression */)) { emit(operand); return; } @@ -29990,29 +30519,29 @@ var ts; write(")"); } function emitDeleteExpression(node) { - write(ts.tokenToString(75 /* DeleteKeyword */)); + write(ts.tokenToString(76 /* DeleteKeyword */)); write(" "); emit(node.expression); } function emitVoidExpression(node) { - write(ts.tokenToString(100 /* VoidKeyword */)); + write(ts.tokenToString(101 /* VoidKeyword */)); write(" "); emit(node.expression); } function emitTypeOfExpression(node) { - write(ts.tokenToString(98 /* TypeOfKeyword */)); + write(ts.tokenToString(99 /* TypeOfKeyword */)); write(" "); emit(node.expression); } function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { - if (!isCurrentFileSystemExternalModule() || node.kind !== 66 /* Identifier */ || ts.nodeIsSynthesized(node)) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 67 /* Identifier */ || ts.nodeIsSynthesized(node)) { return false; } - var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 208 /* VariableDeclaration */ || node.parent.kind === 160 /* BindingElement */); + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 209 /* VariableDeclaration */ || node.parent.kind === 161 /* BindingElement */); var targetDeclaration = isVariableDeclarationOrBindingElement ? node.parent : resolver.getReferencedValueDeclaration(node); - return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, /*isExported*/ true); } function emitPrefixUnaryExpression(node) { var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); @@ -30038,12 +30567,12 @@ var ts; // the resulting expression a prefix increment operation. And in the second, it will make the resulting // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. - if (node.operand.kind === 176 /* PrefixUnaryExpression */) { + if (node.operand.kind === 177 /* PrefixUnaryExpression */) { var operand = node.operand; - if (node.operator === 34 /* PlusToken */ && (operand.operator === 34 /* PlusToken */ || operand.operator === 39 /* PlusPlusToken */)) { + if (node.operator === 35 /* PlusToken */ && (operand.operator === 35 /* PlusToken */ || operand.operator === 40 /* PlusPlusToken */)) { write(" "); } - else if (node.operator === 35 /* MinusToken */ && (operand.operator === 35 /* MinusToken */ || operand.operator === 40 /* MinusMinusToken */)) { + else if (node.operator === 36 /* MinusToken */ && (operand.operator === 36 /* MinusToken */ || operand.operator === 41 /* MinusMinusToken */)) { write(" "); } } @@ -30063,7 +30592,7 @@ var ts; write("\", "); write(ts.tokenToString(node.operator)); emit(node.operand); - if (node.operator === 39 /* PlusPlusToken */) { + if (node.operator === 40 /* PlusPlusToken */) { write(") - 1)"); } else { @@ -30076,7 +30605,7 @@ var ts; } } function shouldHoistDeclarationInSystemJsModule(node) { - return isSourceFileLevelDeclarationInSystemJsModule(node, false); + return isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ false); } /* * Checks if given node is a source file level declaration (not nested in module/function). @@ -30094,10 +30623,10 @@ var ts; } var current = node; while (current) { - if (current.kind === 245 /* SourceFile */) { + if (current.kind === 246 /* SourceFile */) { return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); } - else if (ts.isFunctionLike(current) || current.kind === 216 /* ModuleBlock */) { + else if (ts.isFunctionLike(current) || current.kind === 217 /* ModuleBlock */) { return false; } else { @@ -30106,13 +30635,13 @@ var ts; } } function emitBinaryExpression(node) { - if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 54 /* EqualsToken */ && - (node.left.kind === 162 /* ObjectLiteralExpression */ || node.left.kind === 161 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 192 /* ExpressionStatement */); + if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 55 /* EqualsToken */ && + (node.left.kind === 163 /* ObjectLiteralExpression */ || node.left.kind === 162 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 193 /* ExpressionStatement */); } else { - var exportChanged = node.operatorToken.kind >= 54 /* FirstAssignment */ && - node.operatorToken.kind <= 65 /* LastAssignment */ && + var exportChanged = node.operatorToken.kind >= 55 /* FirstAssignment */ && + node.operatorToken.kind <= 66 /* LastAssignment */ && isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); if (exportChanged) { // emit assignment 'x y' as 'exports("x", x y)' @@ -30121,7 +30650,7 @@ var ts; write("\", "); } emit(node.left); - var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 /* CommaToken */ ? " " : undefined); + var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 24 /* CommaToken */ ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); @@ -30160,36 +30689,36 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 189 /* Block */) { + if (node && node.kind === 190 /* Block */) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { if (isSingleLineEmptyBlock(node)) { - emitToken(14 /* OpenBraceToken */, node.pos); + emitToken(15 /* OpenBraceToken */, node.pos); write(" "); - emitToken(15 /* CloseBraceToken */, node.statements.end); + emitToken(16 /* CloseBraceToken */, node.statements.end); return; } - emitToken(14 /* OpenBraceToken */, node.pos); + emitToken(15 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 216 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 215 /* ModuleDeclaration */); + if (node.kind === 217 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 216 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 216 /* ModuleBlock */) { - emitTempDeclarations(true); + if (node.kind === 217 /* ModuleBlock */) { + emitTempDeclarations(/*newLine*/ true); } decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.statements.end); + emitToken(16 /* CloseBraceToken */, node.statements.end); scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 189 /* Block */) { + if (node.kind === 190 /* Block */) { write(" "); emit(node); } @@ -30201,20 +30730,20 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 171 /* ArrowFunction */); + emitParenthesizedIf(node.expression, /*parenthesized*/ node.expression.kind === 172 /* ArrowFunction */); write(";"); } function emitIfStatement(node) { - var endPos = emitToken(85 /* IfKeyword */, node.pos); + var endPos = emitToken(86 /* IfKeyword */, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); + endPos = emitToken(17 /* OpenParenToken */, endPos); emit(node.expression); - emitToken(17 /* CloseParenToken */, node.expression.end); + emitToken(18 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.thenStatement); if (node.elseStatement) { writeLine(); - emitToken(77 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 193 /* IfStatement */) { + emitToken(78 /* ElseKeyword */, node.thenStatement.end); + if (node.elseStatement.kind === 194 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -30226,7 +30755,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 189 /* Block */) { + if (node.statement.kind === 190 /* Block */) { write(" "); } else { @@ -30248,17 +30777,17 @@ var ts; * in system modules where such variable declarations are hoisted. */ function tryEmitStartOfVariableDeclarationList(decl, startPos) { - if (shouldHoistVariable(decl, true)) { + if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) { // variables in variable declaration list were already hoisted return false; } - var tokenKind = 99 /* VarKeyword */; + var tokenKind = 100 /* VarKeyword */; if (decl && languageVersion >= 2 /* ES6 */) { if (ts.isLet(decl)) { - tokenKind = 105 /* LetKeyword */; + tokenKind = 106 /* LetKeyword */; } else if (ts.isConst(decl)) { - tokenKind = 71 /* ConstKeyword */; + tokenKind = 72 /* ConstKeyword */; } } if (startPos !== undefined) { @@ -30267,13 +30796,13 @@ var ts; } else { switch (tokenKind) { - case 99 /* VarKeyword */: + case 100 /* VarKeyword */: write("var "); break; - case 105 /* LetKeyword */: + case 106 /* LetKeyword */: write("let "); break; - case 71 /* ConstKeyword */: + case 72 /* ConstKeyword */: write("const "); break; } @@ -30298,10 +30827,10 @@ var ts; return started; } function emitForStatement(node) { - var endPos = emitToken(83 /* ForKeyword */, node.pos); + var endPos = emitToken(84 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 209 /* VariableDeclarationList */) { + endPos = emitToken(17 /* OpenParenToken */, endPos); + if (node.initializer && node.initializer.kind === 210 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); if (startIsEmitted) { @@ -30322,13 +30851,13 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 198 /* ForOfStatement */) { + if (languageVersion < 2 /* ES6 */ && node.kind === 199 /* ForOfStatement */) { return emitDownLevelForOfStatement(node); } - var endPos = emitToken(83 /* ForKeyword */, node.pos); + var endPos = emitToken(84 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + endPos = emitToken(17 /* OpenParenToken */, endPos); + if (node.initializer.kind === 210 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); @@ -30338,14 +30867,14 @@ var ts; else { emit(node.initializer); } - if (node.kind === 197 /* ForInStatement */) { + if (node.kind === 198 /* ForInStatement */) { write(" in "); } else { write(" of "); } emit(node.expression); - emitToken(17 /* CloseParenToken */, node.expression.end); + emitToken(18 /* CloseParenToken */, node.expression.end); emitEmbeddedStatement(node.statement); } function emitDownLevelForOfStatement(node) { @@ -30369,9 +30898,9 @@ var ts; // all destructuring. // Note also that because an extra statement is needed to assign to the LHS, // for-of bodies are always emitted as blocks. - var endPos = emitToken(83 /* ForKeyword */, node.pos); + var endPos = emitToken(84 /* ForKeyword */, node.pos); write(" "); - endPos = emitToken(16 /* OpenParenToken */, endPos); + endPos = emitToken(17 /* OpenParenToken */, endPos); // Do not emit the LHS let declaration yet, because it might contain destructuring. // Do not call recordTempDeclaration because we are declaring the temps // right here. Recording means they will be declared later. @@ -30380,7 +30909,7 @@ var ts; // for (let v of arr) { } // // we don't want to emit a temporary variable for the RHS, just use it directly. - var rhsIsIdentifier = node.expression.kind === 66 /* Identifier */; + var rhsIsIdentifier = node.expression.kind === 67 /* Identifier */; var counter = createTempVariable(268435456 /* _i */); var rhsReference = rhsIsIdentifier ? node.expression : createTempVariable(0 /* Auto */); // This is the let keyword for the counter and rhsReference. The let keyword for @@ -30405,7 +30934,7 @@ var ts; emitStart(node.initializer); emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); emitEnd(node.initializer); write("; "); @@ -30414,7 +30943,7 @@ var ts; emitNodeWithoutSourceMap(counter); write("++"); emitEnd(node.initializer); - emitToken(17 /* CloseParenToken */, node.expression.end); + emitToken(18 /* CloseParenToken */, node.expression.end); // Body write(" {"); writeLine(); @@ -30423,7 +30952,7 @@ var ts; // let v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 209 /* VariableDeclarationList */) { + if (node.initializer.kind === 210 /* VariableDeclarationList */) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -30431,12 +30960,12 @@ var ts; if (ts.isBindingPattern(declaration.name)) { // This works whether the declaration is a var, let, or const. // It will use rhsIterationValue _a[_i] as the initializer. - emitDestructuring(declaration, false, rhsIterationValue); + emitDestructuring(declaration, /*isAssignmentExpressionStatement*/ false, rhsIterationValue); } else { // The following call does not include the initializer, so we have // to emit it separately. - emitNodeWithoutSourceMap(declaration); + emitNodeWithCommentsAndWithoutSourcemap(declaration); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -30452,19 +30981,19 @@ var ts; else { // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. - var assignmentExpression = createBinaryExpression(node.initializer, 54 /* EqualsToken */, rhsIterationValue, false); - if (node.initializer.kind === 161 /* ArrayLiteralExpression */ || node.initializer.kind === 162 /* ObjectLiteralExpression */) { + var assignmentExpression = createBinaryExpression(node.initializer, 55 /* EqualsToken */, rhsIterationValue, /*startsOnNewLine*/ false); + if (node.initializer.kind === 162 /* ArrayLiteralExpression */ || node.initializer.kind === 163 /* ObjectLiteralExpression */) { // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. - emitDestructuring(assignmentExpression, true, undefined); + emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); } else { - emitNodeWithoutSourceMap(assignmentExpression); + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); } } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 189 /* Block */) { + if (node.statement.kind === 190 /* Block */) { emitLines(node.statement.statements); } else { @@ -30476,12 +31005,12 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 200 /* BreakStatement */ ? 67 /* BreakKeyword */ : 72 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 201 /* BreakStatement */ ? 68 /* BreakKeyword */ : 73 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } function emitReturnStatement(node) { - emitToken(91 /* ReturnKeyword */, node.pos); + emitToken(92 /* ReturnKeyword */, node.pos); emitOptional(" ", node.expression); write(";"); } @@ -30492,21 +31021,21 @@ var ts; emitEmbeddedStatement(node.statement); } function emitSwitchStatement(node) { - var endPos = emitToken(93 /* SwitchKeyword */, node.pos); + var endPos = emitToken(94 /* SwitchKeyword */, node.pos); write(" "); - emitToken(16 /* OpenParenToken */, endPos); + emitToken(17 /* OpenParenToken */, endPos); emit(node.expression); - endPos = emitToken(17 /* CloseParenToken */, node.expression.end); + endPos = emitToken(18 /* CloseParenToken */, node.expression.end); write(" "); emitCaseBlock(node.caseBlock, endPos); } function emitCaseBlock(node, startPos) { - emitToken(14 /* OpenBraceToken */, startPos); + emitToken(15 /* OpenBraceToken */, startPos); increaseIndent(); emitLines(node.clauses); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.clauses.end); + emitToken(16 /* CloseBraceToken */, node.clauses.end); } function nodeStartPositionsAreOnSameLine(node1, node2) { return ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === @@ -30521,7 +31050,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 238 /* CaseClause */) { + if (node.kind === 239 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -30556,16 +31085,16 @@ var ts; } function emitCatchClause(node) { writeLine(); - var endPos = emitToken(69 /* CatchKeyword */, node.pos); + var endPos = emitToken(70 /* CatchKeyword */, node.pos); write(" "); - emitToken(16 /* OpenParenToken */, endPos); + emitToken(17 /* OpenParenToken */, endPos); emit(node.variableDeclaration); - emitToken(17 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); + emitToken(18 /* CloseParenToken */, node.variableDeclaration ? node.variableDeclaration.end : endPos); write(" "); emitBlock(node.block); } function emitDebuggerStatement(node) { - emitToken(73 /* DebuggerKeyword */, node.pos); + emitToken(74 /* DebuggerKeyword */, node.pos); write(";"); } function emitLabelledStatement(node) { @@ -30576,7 +31105,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 215 /* ModuleDeclaration */); + } while (node && node.kind !== 216 /* ModuleDeclaration */); return node; } function emitContainingModuleName(node) { @@ -30595,16 +31124,35 @@ var ts; write("exports."); } } - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); emitEnd(node.name); } function createVoidZero() { - var zero = ts.createSynthesizedNode(7 /* NumericLiteral */); + var zero = ts.createSynthesizedNode(8 /* NumericLiteral */); zero.text = "0"; - var result = ts.createSynthesizedNode(174 /* VoidExpression */); + var result = ts.createSynthesizedNode(175 /* VoidExpression */); result.expression = zero; return result; } + function emitEs6ExportDefaultCompat(node) { + if (node.parent.kind === 246 /* SourceFile */) { + ts.Debug.assert(!!(node.flags & 1024 /* Default */) || node.kind === 225 /* ExportAssignment */); + // only allow export default at a source file level + if (compilerOptions.module === 1 /* CommonJS */ || compilerOptions.module === 2 /* AMD */ || compilerOptions.module === 3 /* UMD */) { + if (!currentSourceFile.symbol.exports["___esModule"]) { + if (languageVersion === 1 /* ES5 */) { + // default value of configurable, enumerable, writable are `false`. + write("Object.defineProperty(exports, \"__esModule\", { value: true });"); + writeLine(); + } + else if (languageVersion === 0 /* ES3 */) { + write("exports.__esModule = true;"); + writeLine(); + } + } + } + } + } function emitExportMemberAssignment(node) { if (node.flags & 1 /* Export */) { writeLine(); @@ -30618,7 +31166,7 @@ var ts; write("default"); } else { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } write("\", "); emitDeclarationName(node); @@ -30626,6 +31174,7 @@ var ts; } else { if (node.flags & 1024 /* Default */) { + emitEs6ExportDefaultCompat(node); if (languageVersion === 0 /* ES3 */) { write("exports[\"default\"]"); } @@ -30644,32 +31193,36 @@ var ts; } } function emitExportMemberAssignments(name) { + if (compilerOptions.module === 4 /* System */) { + return; + } if (!exportEquals && exportSpecifiers && ts.hasProperty(exportSpecifiers, name.text)) { for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); - if (compilerOptions.module === 4 /* System */) { - emitStart(specifier.name); - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(specifier.name); - write("\", "); - emitExpressionIdentifier(name); - write(")"); - emitEnd(specifier.name); - } - else { - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); - } + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); write(";"); } } } + function emitExportSpecifierInSystemModule(specifier) { + ts.Debug.assert(compilerOptions.module === 4 /* System */); + writeLine(); + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); + write("\", "); + emitExpressionIdentifier(specifier.propertyName || specifier.name); + write(")"); + emitEnd(specifier.name); + write(";"); + } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so @@ -30677,15 +31230,15 @@ var ts; // Also temporary variables should be explicitly allocated for source level declarations when module target is system // because actual variable declarations are hoisted var canDefineTempVariablesInPlace = false; - if (root.kind === 208 /* VariableDeclaration */) { + if (root.kind === 209 /* VariableDeclaration */) { var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; } - else if (root.kind === 135 /* Parameter */) { + else if (root.kind === 136 /* Parameter */) { canDefineTempVariablesInPlace = true; } - if (root.kind === 178 /* BinaryExpression */) { + if (root.kind === 179 /* BinaryExpression */) { emitAssignmentExpression(root); } else { @@ -30696,11 +31249,11 @@ var ts; if (emitCount++) { write(", "); } - var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 208 /* VariableDeclaration */ || name.parent.kind === 160 /* BindingElement */); + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 209 /* VariableDeclaration */ || name.parent.kind === 161 /* BindingElement */); var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); if (exportChanged) { write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(name); + emitNodeWithCommentsAndWithoutSourcemap(name); write("\", "); } if (isVariableDeclarationOrBindingElement) { @@ -30716,7 +31269,7 @@ var ts; } } function ensureIdentifier(expr) { - if (expr.kind !== 66 /* Identifier */) { + if (expr.kind !== 67 /* Identifier */) { var identifier = createTempVariable(0 /* Auto */); if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); @@ -30731,23 +31284,23 @@ var ts; // we need to generate a temporary variable value = ensureIdentifier(value); // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(178 /* BinaryExpression */); + var equals = ts.createSynthesizedNode(179 /* BinaryExpression */); equals.left = value; - equals.operatorToken = ts.createSynthesizedNode(31 /* EqualsEqualsEqualsToken */); + equals.operatorToken = ts.createSynthesizedNode(32 /* EqualsEqualsEqualsToken */); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(179 /* ConditionalExpression */); + var cond = ts.createSynthesizedNode(180 /* ConditionalExpression */); cond.condition = condition; - cond.questionToken = ts.createSynthesizedNode(51 /* QuestionToken */); + cond.questionToken = ts.createSynthesizedNode(52 /* QuestionToken */); cond.whenTrue = whenTrue; - cond.colonToken = ts.createSynthesizedNode(52 /* ColonToken */); + cond.colonToken = ts.createSynthesizedNode(53 /* ColonToken */); cond.whenFalse = whenFalse; return cond; } function createNumericLiteral(value) { - var node = ts.createSynthesizedNode(7 /* NumericLiteral */); + var node = ts.createSynthesizedNode(8 /* NumericLiteral */); node.text = "" + value; return node; } @@ -30756,14 +31309,14 @@ var ts; // otherwise occur when the identifier is emitted. var syntheticName = ts.createSynthesizedNode(propName.kind); syntheticName.text = propName.text; - if (syntheticName.kind !== 66 /* Identifier */) { + if (syntheticName.kind !== 67 /* Identifier */) { return createElementAccessExpression(object, syntheticName); } return createPropertyAccessExpression(object, syntheticName); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(165 /* CallExpression */); - var sliceIdentifier = ts.createSynthesizedNode(66 /* Identifier */); + var call = ts.createSynthesizedNode(166 /* CallExpression */); + var sliceIdentifier = ts.createSynthesizedNode(67 /* Identifier */); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); call.arguments = ts.createSynthesizedNodeArray(); @@ -30779,7 +31332,7 @@ var ts; } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 242 /* PropertyAssignment */ || p.kind === 243 /* ShorthandPropertyAssignment */) { + if (p.kind === 243 /* PropertyAssignment */ || p.kind === 244 /* ShorthandPropertyAssignment */) { var propName = p.name; emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); } @@ -30794,8 +31347,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 184 /* OmittedExpression */) { - if (e.kind !== 182 /* SpreadElementExpression */) { + if (e.kind !== 185 /* OmittedExpression */) { + if (e.kind !== 183 /* SpreadElementExpression */) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); } else if (i === elements.length - 1) { @@ -30805,14 +31358,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 178 /* BinaryExpression */ && target.operatorToken.kind === 54 /* EqualsToken */) { + if (target.kind === 179 /* BinaryExpression */ && target.operatorToken.kind === 55 /* EqualsToken */) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 162 /* ObjectLiteralExpression */) { + if (target.kind === 163 /* ObjectLiteralExpression */) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 161 /* ArrayLiteralExpression */) { + else if (target.kind === 162 /* ArrayLiteralExpression */) { emitArrayLiteralAssignment(target, value); } else { @@ -30822,18 +31375,21 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (isAssignmentExpressionStatement) { + if (ts.isEmptyObjectLiteralOrArrayLiteral(target)) { + emit(value); + } + else if (isAssignmentExpressionStatement) { emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 169 /* ParenthesizedExpression */) { + if (root.parent.kind !== 170 /* ParenthesizedExpression */) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 169 /* ParenthesizedExpression */) { + if (root.parent.kind !== 170 /* ParenthesizedExpression */) { write(")"); } } @@ -30857,12 +31413,12 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 158 /* ObjectBindingPattern */) { + if (pattern.kind === 159 /* ObjectBindingPattern */) { // Rewrite element to a declaration with an initializer that fetches property var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 184 /* OmittedExpression */) { + else if (element.kind !== 185 /* OmittedExpression */) { if (!element.dotDotDotToken) { // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); @@ -30881,7 +31437,7 @@ var ts; function emitVariableDeclaration(node) { if (ts.isBindingPattern(node.name)) { if (languageVersion < 2 /* ES6 */) { - emitDestructuring(node, false); + emitDestructuring(node, /*isAssignmentExpressionStatement*/ false); } else { emit(node.name); @@ -30901,15 +31457,15 @@ var ts; (getCombinedFlagsForIdentifier(node.name) & 16384 /* Let */); // NOTE: default initialization should not be added to let bindings in for-in\for-of statements if (isUninitializedLet && - node.parent.parent.kind !== 197 /* ForInStatement */ && - node.parent.parent.kind !== 198 /* ForOfStatement */) { + node.parent.parent.kind !== 198 /* ForInStatement */ && + node.parent.parent.kind !== 199 /* ForOfStatement */) { initializer = createVoidZero(); } } var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); if (exportChanged) { write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); write("\", "); } emitModuleMemberName(node); @@ -30920,11 +31476,11 @@ var ts; } } function emitExportVariableAssignments(node) { - if (node.kind === 184 /* OmittedExpression */) { + if (node.kind === 185 /* OmittedExpression */) { return; } var name = node.name; - if (name.kind === 66 /* Identifier */) { + if (name.kind === 67 /* Identifier */) { emitExportMemberAssignments(name); } else if (ts.isBindingPattern(name)) { @@ -30932,7 +31488,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 208 /* VariableDeclaration */ && node.parent.kind !== 160 /* BindingElement */)) { + if (!node.parent || (node.parent.kind !== 209 /* VariableDeclaration */ && node.parent.kind !== 161 /* BindingElement */)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -30940,7 +31496,7 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1 /* Export */) && languageVersion >= 2 /* ES6 */ && - node.parent.kind === 245 /* SourceFile */; + node.parent.kind === 246 /* SourceFile */; } function emitVariableStatement(node) { var startIsEmitted = false; @@ -31029,7 +31585,7 @@ var ts; writeLine(); write("var "); if (hasBindingElements) { - emitDestructuring(parameter, false, tempParameters[tempIndex]); + emitDestructuring(parameter, /*isAssignmentExpressionStatement*/ false, tempParameters[tempIndex]); } else { emit(tempParameters[tempIndex]); @@ -31049,9 +31605,9 @@ var ts; emitEnd(parameter); write(" { "); emitStart(parameter); - emitNodeWithoutSourceMap(paramName); + emitNodeWithCommentsAndWithoutSourcemap(paramName); write(" = "); - emitNodeWithoutSourceMap(initializer); + emitNodeWithCommentsAndWithoutSourcemap(initializer); emitEnd(parameter); write("; }"); } @@ -31071,7 +31627,7 @@ var ts; emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -31092,7 +31648,7 @@ var ts; increaseIndent(); writeLine(); emitStart(restParam); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -31101,27 +31657,27 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 142 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 143 /* GetAccessor */ ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 171 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 172 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; } function emitDeclarationName(node) { if (node.name) { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } else { write(getGeneratedNameForNode(node)); } } function shouldEmitFunctionName(node) { - if (node.kind === 170 /* FunctionExpression */) { + if (node.kind === 171 /* FunctionExpression */) { // Emit name if one is present return !!node.name; } - if (node.kind === 210 /* FunctionDeclaration */) { + if (node.kind === 211 /* FunctionDeclaration */) { // Emit name if one is present, or emit generated name in down-level case (for export default case) return !!node.name || languageVersion < 2 /* ES6 */; } @@ -31130,10 +31686,25 @@ var ts; if (ts.nodeIsMissing(node.body)) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== 140 /* MethodDeclaration */ && node.kind !== 139 /* MethodSignature */) { - // Methods will emit the comments as part of emitting method declaration + // TODO (yuisu) : we should not have special cases to condition emitting comments + // but have one place to fix check for these conditions. + if (node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */ && + node.parent && node.parent.kind !== 243 /* PropertyAssignment */ && + node.parent.kind !== 166 /* CallExpression */) { + // 1. Methods will emit the comments as part of emitting method declaration + // 2. If the function is a property of object literal, emitting leading-comments + // is done by emitNodeWithoutSourceMap which then call this function. + // In particular, we would like to avoid emit comments twice in following case: + // For example: + // var obj = { + // id: + // /*comment*/ () => void + // } + // 3. If the function is an argument in call expression, emitting of comments will be + // taken care of in emit list of arguments inside of emitCallexpression emitLeadingComments(node); } + emitStart(node); // For targeting below es6, emit functions-like declaration including arrow function using function keyword. // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead if (!shouldEmitAsArrowFunction(node)) { @@ -31153,10 +31724,11 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 /* ES6 */ && node.kind === 210 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 /* ES6 */ && node.kind === 211 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } - if (node.kind !== 140 /* MethodDeclaration */ && node.kind !== 139 /* MethodSignature */) { + emitEnd(node); + if (node.kind !== 141 /* MethodDeclaration */ && node.kind !== 140 /* MethodSignature */) { emitTrailingComments(node); } } @@ -31174,7 +31746,7 @@ var ts; if (node) { var parameters = node.parameters; var omitCount = languageVersion < 2 /* ES6 */ && ts.hasRestParameter(node) ? 1 : 0; - emitList(parameters, 0, parameters.length - omitCount, false, false); + emitList(parameters, 0, parameters.length - omitCount, /*multiLine*/ false, /*trailingComma*/ false); } write(")"); decreaseIndent(); @@ -31189,7 +31761,7 @@ var ts; } function emitAsyncFunctionBodyForES6(node) { var promiseConstructor = ts.getEntityNameFromTypeNode(node.type); - var isArrowFunction = node.kind === 171 /* ArrowFunction */; + var isArrowFunction = node.kind === 172 /* ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 4096 /* CaptureArguments */) !== 0; var args; // An async function is emit as an outer function that calls an inner @@ -31310,7 +31882,7 @@ var ts; write(" { }"); } else { - if (node.body.kind === 189 /* Block */) { + if (node.body.kind === 190 /* Block */) { emitBlockFunctionBody(node, node.body); } else { @@ -31365,10 +31937,10 @@ var ts; write(" "); // Unwrap all type assertions. var current = body; - while (current.kind === 168 /* TypeAssertionExpression */) { + while (current.kind === 169 /* TypeAssertionExpression */) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 162 /* ObjectLiteralExpression */); + emitParenthesizedIf(body, current.kind === 163 /* ObjectLiteralExpression */); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -31388,7 +31960,7 @@ var ts; emit(body); emitEnd(body); write(";"); - emitTempDeclarations(false); + emitTempDeclarations(/*newLine*/ false); write(" "); } else { @@ -31399,7 +31971,7 @@ var ts; emit(body); write(";"); emitTrailingComments(node.body); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); decreaseIndent(); writeLine(); } @@ -31416,7 +31988,7 @@ var ts; emitDetachedComments(body.statements); // Emit all the directive prologues (like "use strict"). These have to come before // any other preamble code we write (like parameter initializers). - var startIndex = emitDirectivePrologues(body.statements, true); + var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); emitFunctionBodyPreamble(node); decreaseIndent(); var preambleEmitted = writer.getTextPos() !== initialTextPos; @@ -31426,29 +31998,29 @@ var ts; write(" "); emit(statement); } - emitTempDeclarations(false); + emitTempDeclarations(/*newLine*/ false); write(" "); emitLeadingCommentsOfPosition(body.statements.end); } else { increaseIndent(); emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); writeLine(); emitLeadingCommentsOfPosition(body.statements.end); decreaseIndent(); } - emitToken(15 /* CloseBraceToken */, body.statements.end); + emitToken(16 /* CloseBraceToken */, body.statements.end); scopeEmitEnd(); } function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 192 /* ExpressionStatement */) { + if (statement && statement.kind === 193 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 165 /* CallExpression */) { + if (expr && expr.kind === 166 /* CallExpression */) { var func = expr.expression; - if (func && func.kind === 92 /* SuperKeyword */) { + if (func && func.kind === 93 /* SuperKeyword */) { return statement; } } @@ -31472,25 +32044,27 @@ var ts; }); } function emitMemberAccessForPropertyName(memberName) { - // TODO: (jfreeman,drosen): comment on why this is emitNodeWithoutSourceMap instead of emit here. - if (memberName.kind === 8 /* StringLiteral */ || memberName.kind === 7 /* NumericLiteral */) { + // This does not emit source map because it is emitted by caller as caller + // is aware how the property name changes to the property access + // eg. public x = 10; becomes this.x and static x = 10 becomes className.x + if (memberName.kind === 9 /* StringLiteral */ || memberName.kind === 8 /* NumericLiteral */) { write("["); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } - else if (memberName.kind === 133 /* ComputedPropertyName */) { + else if (memberName.kind === 134 /* ComputedPropertyName */) { emitComputedPropertyName(memberName); } else { write("."); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); } } function getInitializedProperties(node, isStatic) { var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 138 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { + if (member.kind === 139 /* PropertyDeclaration */ && isStatic === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { properties.push(member); } } @@ -31530,11 +32104,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 188 /* SemicolonClassElement */) { + if (member.kind === 189 /* SemicolonClassElement */) { writeLine(); write(";"); } - else if (member.kind === 140 /* MethodDeclaration */ || node.kind === 139 /* MethodSignature */) { + else if (member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -31546,14 +32120,12 @@ var ts; emitMemberAccessForPropertyName(member.name); emitEnd(member.name); write(" = "); - emitStart(member); emitFunctionDeclaration(member); emitEnd(member); - emitEnd(member); write(";"); emitTrailingComments(member); } - else if (member.kind === 142 /* GetAccessor */ || member.kind === 143 /* SetAccessor */) { + else if (member.kind === 143 /* GetAccessor */ || member.kind === 144 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -31603,22 +32175,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 140 /* MethodDeclaration */ || node.kind === 139 /* MethodSignature */) && !member.body) { + if ((member.kind === 141 /* MethodDeclaration */ || node.kind === 140 /* MethodSignature */) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 140 /* MethodDeclaration */ || - member.kind === 142 /* GetAccessor */ || - member.kind === 143 /* SetAccessor */) { + else if (member.kind === 141 /* MethodDeclaration */ || + member.kind === 143 /* GetAccessor */ || + member.kind === 144 /* SetAccessor */) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 128 /* Static */) { write("static "); } - if (member.kind === 142 /* GetAccessor */) { + if (member.kind === 143 /* GetAccessor */) { write("get "); } - else if (member.kind === 143 /* SetAccessor */) { + else if (member.kind === 144 /* SetAccessor */) { write("set "); } if (member.asteriskToken) { @@ -31629,7 +32201,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 188 /* SemicolonClassElement */) { + else if (member.kind === 189 /* SemicolonClassElement */) { writeLine(); write(";"); } @@ -31654,11 +32226,11 @@ var ts; var hasInstancePropertyWithInitializer = false; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { - if (member.kind === 141 /* Constructor */ && !member.body) { + if (member.kind === 142 /* Constructor */ && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } // Check if there is any non-static property assignment - if (member.kind === 138 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { + if (member.kind === 139 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -31697,18 +32269,23 @@ var ts; } } } + var startIndex = 0; write(" {"); scopeEmitStart(node, "constructor"); increaseIndent(); if (ctor) { + // Emit all the directive prologues (like "use strict"). These have to come before + // any other preamble code we write (like parameter initializers). + startIndex = emitDirectivePrologues(ctor.body.statements, /*startWithNewLine*/ true); emitDetachedComments(ctor.body.statements); } emitCaptureThisForNodeIfNecessary(node); + var superCall; if (ctor) { emitDefaultValueAssignments(ctor); emitRestParameter(ctor); if (baseTypeElement) { - var superCall = findInitialSuperCall(ctor); + superCall = findInitialSuperCall(ctor); if (superCall) { writeLine(); emit(superCall); @@ -31729,21 +32306,21 @@ var ts; emitEnd(baseTypeElement); } } - emitPropertyDeclarations(node, getInitializedProperties(node, false)); + emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); if (ctor) { var statements = ctor.body.statements; if (superCall) { statements = statements.slice(1); } - emitLines(statements); + emitLinesStartingAt(statements, startIndex); } - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); writeLine(); if (ctor) { emitLeadingCommentsOfPosition(ctor.body.statements.end); } decreaseIndent(); - emitToken(15 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); + emitToken(16 /* CloseBraceToken */, ctor ? ctor.body.statements.end : node.members.end); scopeEmitEnd(); emitEnd(ctor || node); if (ctor) { @@ -31766,7 +32343,7 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { if (thisNodeIsDecorated) { // To preserve the correct runtime semantics when decorators are applied to the class, // the emit needs to follow one of the following rules: @@ -31845,8 +32422,8 @@ var ts; // // This keeps the expression as an expression, while ensuring that the static parts // of it have been initialized by the time it is used. - var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 183 /* ClassExpression */; + var staticProperties = getInitializedProperties(node, /*static:*/ true); + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 184 /* ClassExpression */; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0 /* Auto */); @@ -31874,7 +32451,7 @@ var ts; emitMemberFunctionsForES6AndHigher(node); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end); + emitToken(16 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); // TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now. // For a decorated class, we need to assign its name (if it has one). This is because we emit @@ -31897,7 +32474,7 @@ var ts; var property = staticProperties[_a]; write(","); writeLine(); - emitPropertyDeclaration(node, property, tempVariable, true); + emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); } write(","); writeLine(); @@ -31930,7 +32507,7 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { // source file level classes in system modules are hoisted so 'var's for them are already defined if (!shouldHoistDeclarationInSystemJsModule(node)) { write("var "); @@ -31965,23 +32542,23 @@ var ts; writeLine(); emitConstructor(node, baseTypeNode); emitMemberFunctionsForES5AndLower(node); - emitPropertyDeclarations(node, getInitializedProperties(node, true)); + emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); writeLine(); emitDecoratorsOfClass(node); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end, function () { + emitToken(16 /* CloseBraceToken */, node.members.end, function () { write("return "); emitDeclarationName(node); }); write(";"); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); tempFlags = saveTempFlags; tempVariables = saveTempVariables; tempParameters = saveTempParameters; computedPropertyNamesToGeneratedNames = saveComputedPropertyNamesToGeneratedNames; decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end); + emitToken(16 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); emitStart(node); write(")("); @@ -31989,11 +32566,11 @@ var ts; emit(baseTypeNode.expression); } write(")"); - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { write(";"); } emitEnd(node); - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { emitExportMemberAssignment(node); } if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile && node.name) { @@ -32007,7 +32584,7 @@ var ts; } } function emitDecoratorsOfClass(node) { - emitDecoratorsOfMembers(node, 0); + emitDecoratorsOfMembers(node, /*staticFlag*/ 0); emitDecoratorsOfMembers(node, 128 /* Static */); emitDecoratorsOfConstructor(node); } @@ -32036,13 +32613,13 @@ var ts; increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { emitStart(decorator); emit(decorator.expression); emitEnd(decorator); }); - argumentsWritten += emitDecoratorsOfParameters(constructor, argumentsWritten > 0); - emitSerializedTypeMetadata(node, argumentsWritten >= 0); + argumentsWritten += emitDecoratorsOfParameters(constructor, /*leadingComma*/ argumentsWritten > 0); + emitSerializedTypeMetadata(node, /*leadingComma*/ argumentsWritten >= 0); decreaseIndent(); writeLine(); write("], "); @@ -32085,7 +32662,7 @@ var ts; else { decorators = member.decorators; // we only decorate the parameters here if this is a method - if (member.kind === 140 /* MethodDeclaration */) { + if (member.kind === 141 /* MethodDeclaration */) { functionLikeMember = member; } } @@ -32123,7 +32700,7 @@ var ts; // writeLine(); emitStart(member); - if (member.kind !== 138 /* PropertyDeclaration */) { + if (member.kind !== 139 /* PropertyDeclaration */) { write("Object.defineProperty("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -32138,7 +32715,7 @@ var ts; increaseIndent(); writeLine(); var decoratorCount = decorators ? decorators.length : 0; - var argumentsWritten = emitList(decorators, 0, decoratorCount, true, false, false, true, function (decorator) { + var argumentsWritten = emitList(decorators, 0, decoratorCount, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ false, /*noTrailingNewLine*/ true, function (decorator) { emitStart(decorator); emit(decorator.expression); emitEnd(decorator); @@ -32153,7 +32730,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - if (member.kind !== 138 /* PropertyDeclaration */) { + if (member.kind !== 139 /* PropertyDeclaration */) { write(", Object.getOwnPropertyDescriptor("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -32176,7 +32753,7 @@ var ts; var parameter = _b[_a]; if (ts.nodeIsDecorated(parameter)) { var decorators = parameter.decorators; - argumentsWritten += emitList(decorators, 0, decorators.length, true, false, leadingComma, true, function (decorator) { + argumentsWritten += emitList(decorators, 0, decorators.length, /*multiLine*/ true, /*trailingComma*/ false, /*leadingComma*/ leadingComma, /*noTrailingNewLine*/ true, function (decorator) { emitStart(decorator); write("__param(" + parameterIndex + ", "); emit(decorator.expression); @@ -32195,10 +32772,10 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 140 /* MethodDeclaration */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 138 /* PropertyDeclaration */: + case 141 /* MethodDeclaration */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 139 /* PropertyDeclaration */: return true; } return false; @@ -32208,7 +32785,7 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 140 /* MethodDeclaration */: + case 141 /* MethodDeclaration */: return true; } return false; @@ -32218,9 +32795,9 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 211 /* ClassDeclaration */: - case 140 /* MethodDeclaration */: - case 143 /* SetAccessor */: + case 212 /* ClassDeclaration */: + case 141 /* MethodDeclaration */: + case 144 /* SetAccessor */: return true; } return false; @@ -32238,19 +32815,19 @@ var ts; // // For rules on serializing type annotations, see `serializeTypeNode`. switch (node.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: write("Function"); return; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: emitSerializedTypeNode(node.type); return; - case 135 /* Parameter */: + case 136 /* Parameter */: emitSerializedTypeNode(node.type); return; - case 142 /* GetAccessor */: + case 143 /* GetAccessor */: emitSerializedTypeNode(node.type); return; - case 143 /* SetAccessor */: + case 144 /* SetAccessor */: emitSerializedTypeNode(ts.getSetAccessorTypeAnnotationNode(node)); return; } @@ -32261,43 +32838,46 @@ var ts; write("void 0"); } function emitSerializedTypeNode(node) { + if (!node) { + return; + } switch (node.kind) { - case 100 /* VoidKeyword */: + case 101 /* VoidKeyword */: write("void 0"); return; - case 157 /* ParenthesizedType */: + case 158 /* ParenthesizedType */: emitSerializedTypeNode(node.type); return; - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 150 /* FunctionType */: + case 151 /* ConstructorType */: write("Function"); return; - case 153 /* ArrayType */: - case 154 /* TupleType */: + case 154 /* ArrayType */: + case 155 /* TupleType */: write("Array"); return; - case 147 /* TypePredicate */: - case 117 /* BooleanKeyword */: + case 148 /* TypePredicate */: + case 118 /* BooleanKeyword */: write("Boolean"); return; - case 127 /* StringKeyword */: - case 8 /* StringLiteral */: + case 128 /* StringKeyword */: + case 9 /* StringLiteral */: write("String"); return; - case 125 /* NumberKeyword */: + case 126 /* NumberKeyword */: write("Number"); return; - case 128 /* SymbolKeyword */: + case 129 /* SymbolKeyword */: write("Symbol"); return; - case 148 /* TypeReference */: + case 149 /* TypeReference */: emitSerializedTypeReferenceNode(node); return; - case 151 /* TypeQuery */: - case 152 /* TypeLiteral */: - case 155 /* UnionType */: - case 156 /* IntersectionType */: - case 114 /* AnyKeyword */: + case 152 /* TypeQuery */: + case 153 /* TypeLiteral */: + case 156 /* UnionType */: + case 157 /* IntersectionType */: + case 115 /* AnyKeyword */: break; default: ts.Debug.fail("Cannot serialize unexpected type node."); @@ -32307,21 +32887,27 @@ var ts; } /** Serializes a TypeReferenceNode to an appropriate JS constructor value. Used by the __metadata decorator. */ function emitSerializedTypeReferenceNode(node) { - var typeName = node.typeName; - var result = resolver.getTypeReferenceSerializationKind(node); + var location = node.parent; + while (ts.isDeclaration(location) || ts.isTypeNode(location)) { + location = location.parent; + } + // Clone the type name and parent it to a location outside of the current declaration. + var typeName = ts.cloneEntityName(node.typeName); + typeName.parent = location; + var result = resolver.getTypeReferenceSerializationKind(typeName); switch (result) { case ts.TypeReferenceSerializationKind.Unknown: var temp = createAndRecordTempVariable(0 /* Auto */); write("(typeof ("); emitNodeWithoutSourceMap(temp); write(" = "); - emitEntityNameAsExpression(typeName, true); + emitEntityNameAsExpression(typeName, /*useFallback*/ true); write(") === 'function' && "); emitNodeWithoutSourceMap(temp); write(") || Object"); break; case ts.TypeReferenceSerializationKind.TypeWithConstructSignatureAndValue: - emitEntityNameAsExpression(typeName, false); + emitEntityNameAsExpression(typeName, /*useFallback*/ false); break; case ts.TypeReferenceSerializationKind.VoidType: write("void 0"); @@ -32364,7 +32950,7 @@ var ts; // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { var valueDeclaration; - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -32380,10 +32966,10 @@ var ts; } if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 153 /* ArrayType */) { + if (parameterType.kind === 154 /* ArrayType */) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 148 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 149 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -32401,7 +32987,7 @@ var ts; } /** Serializes the return type of function. Used by the __metadata decorator for a method. */ function emitSerializedReturnTypeOfNode(node) { - if (node && ts.isFunctionLike(node)) { + if (node && ts.isFunctionLike(node) && node.type) { emitSerializedTypeNode(node.type); return; } @@ -32482,7 +33068,7 @@ var ts; emitLines(node.members); decreaseIndent(); writeLine(); - emitToken(15 /* CloseBraceToken */, node.members.end); + emitToken(16 /* CloseBraceToken */, node.members.end); scopeEmitEnd(); write(")("); emitModuleMemberName(node); @@ -32543,7 +33129,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 215 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 216 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -32579,7 +33165,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 216 /* ModuleBlock */) { + if (node.body.kind === 217 /* ModuleBlock */) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -32598,7 +33184,7 @@ var ts; decreaseIndent(); writeLine(); var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; - emitToken(15 /* CloseBraceToken */, moduleBlock.statements.end); + emitToken(16 /* CloseBraceToken */, moduleBlock.statements.end); scopeEmitEnd(); } write(")("); @@ -32612,7 +33198,7 @@ var ts; emitModuleMemberName(node); write(" = {}));"); emitEnd(node); - if (!isES6ExportedDeclaration(node) && node.name.kind === 66 /* Identifier */ && node.parent === currentSourceFile) { + if (!isES6ExportedDeclaration(node) && node.name.kind === 67 /* Identifier */ && node.parent === currentSourceFile) { if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { writeLine(); write(exportFunctionForFile + "(\""); @@ -32624,29 +33210,45 @@ var ts; emitExportMemberAssignments(node.name); } } + /* + * Some bundlers (SystemJS builder) sometimes want to rename dependencies. + * Here we check if alternative name was provided for a given moduleName and return it if possible. + */ + function tryRenameExternalModule(moduleName) { + if (currentSourceFile.renamedDependencies && ts.hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return "\"" + currentSourceFile.renamedDependencies[moduleName.text] + "\""; + } + return undefined; + } function emitRequire(moduleName) { - if (moduleName.kind === 8 /* StringLiteral */) { + if (moduleName.kind === 9 /* StringLiteral */) { write("require("); - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); - emitToken(17 /* CloseParenToken */, moduleName.end); + var text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } + emitToken(18 /* CloseParenToken */, moduleName.end); } else { write("require()"); } } function getNamespaceDeclarationNode(node) { - if (node.kind === 218 /* ImportEqualsDeclaration */) { + if (node.kind === 219 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 222 /* NamespaceImport */) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 219 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 220 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -32661,7 +33263,7 @@ var ts; // ES6 import if (node.importClause) { var shouldEmitDefaultBindings = resolver.isReferencedAliasDeclaration(node.importClause); - var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, true); + var shouldEmitNamedBindings = node.importClause.namedBindings && resolver.isReferencedAliasDeclaration(node.importClause.namedBindings, /* checkChildren */ true); if (shouldEmitDefaultBindings || shouldEmitNamedBindings) { write("import "); emitStart(node.importClause); @@ -32674,7 +33276,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 222 /* NamespaceImport */) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -32700,7 +33302,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 218 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var isExportedImport = node.kind === 219 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2 /* AMD */) { emitLeadingComments(node); @@ -32719,7 +33321,7 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 219 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = 220 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -32770,16 +33372,33 @@ var ts; (!ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { emitLeadingComments(node); emitStart(node); - if (isES6ExportedDeclaration(node)) { - write("export "); - write("var "); + // variable declaration for import-equals declaration can be hoisted in system modules + // in this case 'var' should be omitted and emit should contain only initialization + var variableDeclarationIsHoisted = shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ true); + // is it top level export import v = a.b.c in system module? + // if yes - it needs to be rewritten as exporter('v', v = a.b.c) + var isExported = isSourceFileLevelDeclarationInSystemJsModule(node, /*isExported*/ true); + if (!variableDeclarationIsHoisted) { + ts.Debug.assert(!isExported); + if (isES6ExportedDeclaration(node)) { + write("export "); + write("var "); + } + else if (!(node.flags & 1 /* Export */)) { + write("var "); + } } - else if (!(node.flags & 1 /* Export */)) { - write("var "); + if (isExported) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); } emitModuleMemberName(node); write(" = "); emit(node.moduleReference); + if (isExported) { + write(")"); + } write(";"); emitEnd(node); emitExportImportAssignments(node); @@ -32808,11 +33427,11 @@ var ts; emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); write(" = "); write(generatedName); write("."); - emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); } @@ -32835,7 +33454,6 @@ var ts; } else { if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - emitStart(node); write("export "); if (node.exportClause) { // export { x, y, ... } @@ -32848,10 +33466,9 @@ var ts; } if (node.moduleSpecifier) { write(" from "); - emitNodeWithoutSourceMap(node.moduleSpecifier); + emit(node.moduleSpecifier); } write(";"); - emitEnd(node); } } } @@ -32864,13 +33481,11 @@ var ts; if (needsComma) { write(", "); } - emitStart(specifier); if (specifier.propertyName) { - emitNodeWithoutSourceMap(specifier.propertyName); + emit(specifier.propertyName); write(" as "); } - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier); + emit(specifier.name); needsComma = true; } } @@ -32883,8 +33498,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 210 /* FunctionDeclaration */ && - expression.kind !== 211 /* ClassDeclaration */) { + if (expression.kind !== 211 /* FunctionDeclaration */ && + expression.kind !== 212 /* ClassDeclaration */) { write(";"); } emitEnd(node); @@ -32898,6 +33513,7 @@ var ts; write(")"); } else { + emitEs6ExportDefaultCompat(node); emitContainingModuleName(node); if (languageVersion === 0 /* ES3 */) { write("[\"default\"] = "); @@ -32920,9 +33536,9 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: if (!node.importClause || - resolver.isReferencedAliasDeclaration(node.importClause, true)) { + resolver.isReferencedAliasDeclaration(node.importClause, /*checkChildren*/ true)) { // import "mod" // import x from "mod" where x is referenced // import * as x from "mod" where x is referenced @@ -32930,13 +33546,13 @@ var ts; externalImports.push(node); } break; - case 218 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 229 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + case 219 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 230 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { // import x = require("mod") where x is referenced externalImports.push(node); } break; - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -32957,7 +33573,7 @@ var ts; } } break; - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; @@ -32983,17 +33599,17 @@ var ts; if (namespaceDeclaration && !isDefaultImport(node)) { return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); } - if (node.kind === 219 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 220 /* ImportDeclaration */ && node.importClause) { return getGeneratedNameForNode(node); } - if (node.kind === 225 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 226 /* ExportDeclaration */ && node.moduleSpecifier) { return getGeneratedNameForNode(node); } } function getExternalModuleNameText(importNode) { var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 8 /* StringLiteral */) { - return getLiteralText(moduleName); + if (moduleName.kind === 9 /* StringLiteral */) { + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); } return undefined; } @@ -33006,8 +33622,8 @@ var ts; for (var _a = 0; _a < externalImports.length; _a++) { var importNode = externalImports[_a]; // do not create variable declaration for exports and imports that lack import clause - var skipNode = importNode.kind === 225 /* ExportDeclaration */ || - (importNode.kind === 219 /* ImportDeclaration */ && !importNode.importClause); + var skipNode = importNode.kind === 226 /* ExportDeclaration */ || + (importNode.kind === 220 /* ImportDeclaration */ && !importNode.importClause); if (skipNode) { continue; } @@ -33040,14 +33656,14 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _a = 0; _a < externalImports.length; _a++) { var externalImport = externalImports[_a]; - if (externalImport.kind === 225 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 226 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } } if (!hasExportDeclarationWithExportClause) { // we still need to emit exportStar helper - return emitExportStarFunction(undefined); + return emitExportStarFunction(/*localNames*/ undefined); } } var exportedNamesStorageRef = makeUniqueName("exportedNames"); @@ -33072,7 +33688,7 @@ var ts; } for (var _d = 0; _d < externalImports.length; _d++) { var externalImport = externalImports[_d]; - if (externalImport.kind !== 225 /* ExportDeclaration */) { + if (externalImport.kind !== 226 /* ExportDeclaration */) { continue; } var exportDecl = externalImport; @@ -33097,6 +33713,8 @@ var ts; write("function " + exportStarFunction + "(m) {"); increaseIndent(); writeLine(); + write("var exports = {};"); + writeLine(); write("for(var n in m) {"); increaseIndent(); writeLine(); @@ -33104,10 +33722,12 @@ var ts; if (localNames) { write("&& !" + localNames + ".hasOwnProperty(n)"); } - write(") " + exportFunctionForFile + "(n, m[n]);"); + write(") exports[n] = m[n];"); decreaseIndent(); writeLine(); write("}"); + writeLine(); + write(exportFunctionForFile + "(exports);"); decreaseIndent(); writeLine(); write("}"); @@ -33116,7 +33736,7 @@ var ts; function writeExportedName(node) { // do not record default exports // they are local to module and never overwritten (explicitly skipped) by star export - if (node.kind !== 66 /* Identifier */ && node.flags & 1024 /* Default */) { + if (node.kind !== 67 /* Identifier */ && node.flags & 1024 /* Default */) { return; } if (started) { @@ -33127,8 +33747,8 @@ var ts; } writeLine(); write("'"); - if (node.kind === 66 /* Identifier */) { - emitNodeWithoutSourceMap(node); + if (node.kind === 67 /* Identifier */) { + emitNodeWithCommentsAndWithoutSourcemap(node); } else { emitDeclarationName(node); @@ -33156,7 +33776,7 @@ var ts; var seen = {}; for (var i = 0; i < hoistedVars.length; ++i) { var local = hoistedVars[i]; - var name_25 = local.kind === 66 /* Identifier */ + var name_25 = local.kind === 67 /* Identifier */ ? local : local.name; if (name_25) { @@ -33172,13 +33792,13 @@ var ts; if (i !== 0) { write(", "); } - if (local.kind === 211 /* ClassDeclaration */ || local.kind === 215 /* ModuleDeclaration */ || local.kind === 214 /* EnumDeclaration */) { + if (local.kind === 212 /* ClassDeclaration */ || local.kind === 216 /* ModuleDeclaration */ || local.kind === 215 /* EnumDeclaration */) { emitDeclarationName(local); } else { emit(local); } - var flags = ts.getCombinedNodeFlags(local.kind === 66 /* Identifier */ ? local.parent : local); + var flags = ts.getCombinedNodeFlags(local.kind === 67 /* Identifier */ ? local.parent : local); if (flags & 1 /* Export */) { if (!exportedDeclarations) { exportedDeclarations = []; @@ -33206,21 +33826,21 @@ var ts; if (node.flags & 2 /* Ambient */) { return; } - if (node.kind === 210 /* FunctionDeclaration */) { + if (node.kind === 211 /* FunctionDeclaration */) { if (!hoistedFunctionDeclarations) { hoistedFunctionDeclarations = []; } hoistedFunctionDeclarations.push(node); return; } - if (node.kind === 211 /* ClassDeclaration */) { + if (node.kind === 212 /* ClassDeclaration */) { if (!hoistedVars) { hoistedVars = []; } hoistedVars.push(node); return; } - if (node.kind === 214 /* EnumDeclaration */) { + if (node.kind === 215 /* EnumDeclaration */) { if (shouldEmitEnumDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -33229,7 +33849,7 @@ var ts; } return; } - if (node.kind === 215 /* ModuleDeclaration */) { + if (node.kind === 216 /* ModuleDeclaration */) { if (shouldEmitModuleDeclaration(node)) { if (!hoistedVars) { hoistedVars = []; @@ -33238,10 +33858,10 @@ var ts; } return; } - if (node.kind === 208 /* VariableDeclaration */ || node.kind === 160 /* BindingElement */) { - if (shouldHoistVariable(node, false)) { + if (node.kind === 209 /* VariableDeclaration */ || node.kind === 161 /* BindingElement */) { + if (shouldHoistVariable(node, /*checkIfSourceFileLevelDecl*/ false)) { var name_26 = node.name; - if (name_26.kind === 66 /* Identifier */) { + if (name_26.kind === 67 /* Identifier */) { if (!hoistedVars) { hoistedVars = []; } @@ -33253,6 +33873,13 @@ var ts; } return; } + if (ts.isInternalModuleImportEqualsDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node.name); + return; + } if (ts.isBindingPattern(node)) { ts.forEach(node.elements, visit); return; @@ -33272,12 +33899,12 @@ var ts; // if block scoped variables are nested in some another block then // no other functions can use them except ones that are defined at least in the same block return (ts.getCombinedNodeFlags(node) & 49152 /* BlockScoped */) === 0 || - ts.getEnclosingBlockScopeContainer(node).kind === 245 /* SourceFile */; + ts.getEnclosingBlockScopeContainer(node).kind === 246 /* SourceFile */; } function isCurrentFileSystemExternalModule() { return compilerOptions.module === 4 /* System */ && ts.isExternalModule(currentSourceFile); } - function emitSystemModuleBody(node, startIndex) { + function emitSystemModuleBody(node, dependencyGroups, startIndex) { // shape of the body in system modules: // function (exports) { // @@ -33322,105 +33949,86 @@ var ts; write("return {"); increaseIndent(); writeLine(); - emitSetters(exportStarFunction); + emitSetters(exportStarFunction, dependencyGroups); writeLine(); emitExecute(node, startIndex); decreaseIndent(); writeLine(); write("}"); // return - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); } - function emitSetters(exportStarFunction) { + function emitSetters(exportStarFunction, dependencyGroups) { write("setters:["); - for (var i = 0; i < externalImports.length; ++i) { + for (var i = 0; i < dependencyGroups.length; ++i) { if (i !== 0) { write(","); } writeLine(); increaseIndent(); - var importNode = externalImports[i]; - var importVariableName = getLocalNameForExternalImport(importNode) || ""; - var parameterName = "_" + importVariableName; + var group = dependencyGroups[i]; + // derive a unique name for parameter from the first named entry in the group + var parameterName = makeUniqueName(ts.forEach(group, getLocalNameForExternalImport) || ""); write("function (" + parameterName + ") {"); - switch (importNode.kind) { - case 219 /* ImportDeclaration */: - if (!importNode.importClause) { - // 'import "..."' case - // module is imported only for side-effects, setter body will be empty - break; - } - // fall-through - case 218 /* ImportEqualsDeclaration */: - ts.Debug.assert(importVariableName !== ""); - increaseIndent(); - writeLine(); - // save import into the local - write(importVariableName + " = " + parameterName + ";"); - writeLine(); - var defaultName = importNode.kind === 219 /* ImportDeclaration */ - ? importNode.importClause.name - : importNode.name; - if (defaultName) { - // emit re-export for imported default name - // import n1 from 'foo1' - // import n2 = require('foo2') - // export {n1} - // export {n2} - emitExportMemberAssignments(defaultName); + increaseIndent(); + for (var _a = 0; _a < group.length; _a++) { + var entry = group[_a]; + var importVariableName = getLocalNameForExternalImport(entry) || ""; + switch (entry.kind) { + case 220 /* ImportDeclaration */: + if (!entry.importClause) { + // 'import "..."' case + // module is imported only for side-effects, no emit required + break; + } + // fall-through + case 219 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== ""); writeLine(); - } - if (importNode.kind === 219 /* ImportDeclaration */ && - importNode.importClause.namedBindings) { - var namedBindings = importNode.importClause.namedBindings; - if (namedBindings.kind === 221 /* NamespaceImport */) { - // emit re-export for namespace - // import * as n from 'foo' - // export {n} - emitExportMemberAssignments(namedBindings.name); + // save import into the local + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + break; + case 226 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== ""); + if (entry.exportClause) { + // export {a, b as c} from 'foo' + // emit as: + // exports_({ + // "a": _["a"], + // "c": _["b"] + // }); writeLine(); - } - else { - // emit re-exports for named imports - // import {a, b} from 'foo' - // export {a, b as c} - for (var _a = 0, _b = namedBindings.elements; _a < _b.length; _a++) { - var element = _b[_a]; - emitExportMemberAssignments(element.name || element.propertyName); - writeLine(); + write(exportFunctionForFile + "({"); + writeLine(); + increaseIndent(); + for (var i_2 = 0, len = entry.exportClause.elements.length; i_2 < len; ++i_2) { + if (i_2 !== 0) { + write(","); + writeLine(); + } + var e = entry.exportClause.elements[i_2]; + write("\""); + emitNodeWithCommentsAndWithoutSourcemap(e.name); + write("\": " + parameterName + "[\""); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); + write("\"]"); } + decreaseIndent(); + writeLine(); + write("});"); } - } - decreaseIndent(); - break; - case 225 /* ExportDeclaration */: - ts.Debug.assert(importVariableName !== ""); - increaseIndent(); - if (importNode.exportClause) { - // export {a, b as c} from 'foo' - // emit as: - // exports('a', _foo["a"]) - // exports('c', _foo["b"]) - for (var _c = 0, _d = importNode.exportClause.elements; _c < _d.length; _c++) { - var e = _d[_c]; + else { writeLine(); - write(exportFunctionForFile + "(\""); - emitNodeWithoutSourceMap(e.name); - write("\", " + parameterName + "[\""); - emitNodeWithoutSourceMap(e.propertyName || e.name); - write("\"]);"); + // export * from 'foo' + // emit as: + // exportStar(_foo); + write(exportStarFunction + "(" + parameterName + ");"); } - } - else { writeLine(); - // export * from 'foo' - // emit as: - // exportStar(_foo); - write(exportStarFunction + "(" + parameterName + ");"); - } - writeLine(); - decreaseIndent(); - break; + break; + } } + decreaseIndent(); write("}"); decreaseIndent(); } @@ -33432,17 +34040,33 @@ var ts; writeLine(); for (var i = startIndex; i < node.statements.length; ++i) { var statement = node.statements[i]; - // - imports/exports are not emitted for system modules - // - function declarations are not emitted because they were already hoisted switch (statement.kind) { - case 225 /* ExportDeclaration */: - case 219 /* ImportDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 210 /* FunctionDeclaration */: + // - function declarations are not emitted because they were already hoisted + // - import declarations are not emitted since they are already handled in setters + // - export declarations with module specifiers are not emitted since they were already written in setters + // - export declarations without module specifiers are emitted preserving the order + case 211 /* FunctionDeclaration */: + case 220 /* ImportDeclaration */: + continue; + case 226 /* ExportDeclaration */: + if (!statement.moduleSpecifier) { + for (var _a = 0, _b = statement.exportClause.elements; _a < _b.length; _a++) { + var element = _b[_a]; + // write call to exporter function for every export specifier in exports list + emitExportSpecifierInSystemModule(element); + } + } continue; + case 219 /* ImportEqualsDeclaration */: + if (!ts.isInternalModuleImportEqualsDeclaration(statement)) { + // - import equals declarations that import external modules are not emitted + continue; + } + // fall-though for import declarations that import internal modules + default: + writeLine(); + emit(statement); } - writeLine(); - emit(statement); } decreaseIndent(); writeLine(); @@ -33467,8 +34091,20 @@ var ts; write("\"" + node.moduleName + "\", "); } write("["); + var groupIndices = {}; + var dependencyGroups = []; for (var i = 0; i < externalImports.length; ++i) { var text = getExternalModuleNameText(externalImports[i]); + if (ts.hasProperty(groupIndices, text)) { + // deduplicate/group entries in dependency list by the dependency name + var groupIndex = groupIndices[text]; + dependencyGroups[groupIndex].push(externalImports[i]); + continue; + } + else { + groupIndices[text] = dependencyGroups.length; + dependencyGroups.push([externalImports[i]]); + } if (i !== 0) { write(", "); } @@ -33477,8 +34113,9 @@ var ts; write("], function(" + exportFunctionForFile + ") {"); writeLine(); increaseIndent(); + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); - emitSystemModuleBody(node, startIndex); + emitSystemModuleBody(node, dependencyGroups, startIndex); decreaseIndent(); writeLine(); write("});"); @@ -33543,33 +34180,36 @@ var ts; } } function emitAMDModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); writeLine(); write("define("); if (node.moduleName) { write("\"" + node.moduleName + "\", "); } - emitAMDDependencies(node, true); + emitAMDDependencies(node, /*includeNonAmdDependencies*/ true); write(") {"); increaseIndent(); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); decreaseIndent(); writeLine(); write("});"); } function emitCommonJSModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(false); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ false); } function emitUMDModule(node, startIndex) { + emitEmitHelpers(node); collectExternalModuleInfo(node); // Module is detected first to support Browserify users that load into a browser with an AMD loader writeLines("(function (deps, factory) {\n if (typeof module === 'object' && typeof module.exports === 'object') {\n var v = factory(require, exports); if (v !== undefined) module.exports = v;\n }\n else if (typeof define === 'function' && define.amd) {\n define(deps, factory);\n }\n})("); @@ -33579,8 +34219,8 @@ var ts; emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); - emitExportEquals(true); + emitTempDeclarations(/*newLine*/ true); + emitExportEquals(/*emitAsReturn*/ true); decreaseIndent(); writeLine(); write("});"); @@ -33590,9 +34230,10 @@ var ts; exportSpecifiers = undefined; exportEquals = undefined; hasExportStars = false; + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); // Emit exportDefault if it exists will happen as part // or normal statement emit. } @@ -33618,7 +34259,7 @@ var ts; break; } } - function trimReactWhitespace(node) { + function trimReactWhitespaceAndApplyEntities(node) { var result = undefined; var text = ts.getTextOfNode(node); var firstNonWhitespace = 0; @@ -33631,7 +34272,7 @@ var ts; if (ts.isLineBreak(c)) { if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) { var part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1); - result = (result ? result + '" + \' \' + "' : '') + part; + result = (result ? result + "\" + ' ' + \"" : "") + part; } firstNonWhitespace = -1; } @@ -33644,15 +34285,26 @@ var ts; } if (firstNonWhitespace !== -1) { var part = text.substr(firstNonWhitespace); - result = (result ? result + '" + \' \' + "' : '') + part; + result = (result ? result + "\" + ' ' + \"" : "") + part; + } + if (result) { + // Replace entities like   + result = result.replace(/&(\w+);/g, function (s, m) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); } return result; } function getTextToEmit(node) { switch (compilerOptions.jsx) { case 2 /* React */: - var text = trimReactWhitespace(node); - if (text.length === 0) { + var text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { return undefined; } else { @@ -33666,13 +34318,13 @@ var ts; function emitJsxText(node) { switch (compilerOptions.jsx) { case 2 /* React */: - write('"'); - write(trimReactWhitespace(node)); - write('"'); + write("\""); + write(trimReactWhitespaceAndApplyEntities(node)); + write("\""); break; case 1 /* Preserve */: default: - write(ts.getTextOfNode(node, true)); + writer.writeLiteral(ts.getTextOfNode(node, true)); break; } } @@ -33681,9 +34333,9 @@ var ts; switch (compilerOptions.jsx) { case 1 /* Preserve */: default: - write('{'); + write("{"); emit(node.expression); - write('}'); + write("}"); break; case 2 /* React */: emit(node.expression); @@ -33716,12 +34368,7 @@ var ts; } } } - function emitSourceFileNode(node) { - // Start new file on new line - writeLine(); - emitDetachedComments(node); - // emit prologue directives prior to __extends - var startIndex = emitDirectivePrologues(node.statements, false); + function emitEmitHelpers(node) { // Only emit helpers if the user did not say otherwise. if (!compilerOptions.noEmitHelpers) { // Only Emit __extends function when target ES5. @@ -33746,6 +34393,14 @@ var ts; awaiterEmitted = true; } } + } + function emitSourceFileNode(node) { + // Start new file on new line + writeLine(); + emitShebang(); + emitDetachedComments(node); + // emit prologue directives prior to __extends + var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); if (ts.isExternalModule(node) || compilerOptions.isolatedModules) { if (languageVersion >= 2 /* ES6 */) { emitES6Module(node, startIndex); @@ -33768,57 +34423,76 @@ var ts; exportSpecifiers = undefined; exportEquals = undefined; hasExportStars = false; + emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); - emitTempDeclarations(true); + emitTempDeclarations(/*newLine*/ true); } emitLeadingComments(node.endOfFileToken); } - function emitNodeWithoutSourceMap(node) { - if (!node) { - return; - } - if (node.flags & 2 /* Ambient */) { - return emitOnlyPinnedOrTripleSlashComments(node); - } - var emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { - emitLeadingComments(node); + function emitNodeWithCommentsAndWithoutSourcemap(node) { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } + function emitNodeConsideringCommentsOption(node, emitNodeConsideringSourcemap) { + if (node) { + if (node.flags & 2 /* Ambient */) { + return emitOnlyPinnedOrTripleSlashComments(node); + } + if (isSpecializedCommentHandling(node)) { + // This is the node that will handle its own comments and sourcemap + return emitNodeWithoutSourceMap(node); + } + var emitComments_1 = shouldEmitLeadingAndTrailingComments(node); + if (emitComments_1) { + emitLeadingComments(node); + } + emitNodeConsideringSourcemap(node); + if (emitComments_1) { + emitTrailingComments(node); + } } - emitJavaScriptWorker(node); - if (emitComments) { - emitTrailingComments(node); + } + function emitNodeWithoutSourceMap(node) { + if (node) { + emitJavaScriptWorker(node); } } - function shouldEmitLeadingAndTrailingComments(node) { + function isSpecializedCommentHandling(node) { switch (node.kind) { // All of these entities are emitted in a specialized fashion. As such, we allow // the specialized methods for each to handle the comments on the nodes. - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: - case 219 /* ImportDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 224 /* ExportAssignment */: - return false; - case 190 /* VariableStatement */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: + case 220 /* ImportDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 225 /* ExportAssignment */: + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 191 /* VariableStatement */: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); } + // If the node is emitted in specialized fashion, dont emit comments as this node will handle + // emitting comments when emitting itself + ts.Debug.assert(!isSpecializedCommentHandling(node)); // If this is the expression body of an arrow function that we're down-leveling, // then we don't want to emit comments when we emit the body. It will have already // been taken care of when we emitted the 'return' statement for the function // expression body. - if (node.kind !== 189 /* Block */ && + if (node.kind !== 190 /* Block */ && node.parent && - node.parent.kind === 171 /* ArrowFunction */ && + node.parent.kind === 172 /* ArrowFunction */ && node.parent.body === node && compilerOptions.target <= 1 /* ES5 */) { return false; @@ -33829,170 +34503,170 @@ var ts; function emitJavaScriptWorker(node) { // Check if the node can be emitted regardless of the ScriptTarget switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return emitIdentifier(node); - case 135 /* Parameter */: + case 136 /* Parameter */: return emitParameter(node); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return emitMethod(node); - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: return emitAccessor(node); - case 94 /* ThisKeyword */: + case 95 /* ThisKeyword */: return emitThis(node); - case 92 /* SuperKeyword */: + case 93 /* SuperKeyword */: return emitSuper(node); - case 90 /* NullKeyword */: + case 91 /* NullKeyword */: return write("null"); - case 96 /* TrueKeyword */: + case 97 /* TrueKeyword */: return write("true"); - case 81 /* FalseKeyword */: + case 82 /* FalseKeyword */: 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 8 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 10 /* RegularExpressionLiteral */: + case 11 /* NoSubstitutionTemplateLiteral */: + case 12 /* TemplateHead */: + case 13 /* TemplateMiddle */: + case 14 /* TemplateTail */: return emitLiteral(node); - case 180 /* TemplateExpression */: + case 181 /* TemplateExpression */: return emitTemplateExpression(node); - case 187 /* TemplateSpan */: + case 188 /* TemplateSpan */: return emitTemplateSpan(node); - case 230 /* JsxElement */: - case 231 /* JsxSelfClosingElement */: + case 231 /* JsxElement */: + case 232 /* JsxSelfClosingElement */: return emitJsxElement(node); - case 233 /* JsxText */: + case 234 /* JsxText */: return emitJsxText(node); - case 237 /* JsxExpression */: + case 238 /* JsxExpression */: return emitJsxExpression(node); - case 132 /* QualifiedName */: + case 133 /* QualifiedName */: return emitQualifiedName(node); - case 158 /* ObjectBindingPattern */: + case 159 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 159 /* ArrayBindingPattern */: + case 160 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 160 /* BindingElement */: + case 161 /* BindingElement */: return emitBindingElement(node); - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return emitArrayLiteral(node); - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return emitObjectLiteral(node); - case 242 /* PropertyAssignment */: + case 243 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 243 /* ShorthandPropertyAssignment */: + case 244 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 133 /* ComputedPropertyName */: + case 134 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 163 /* PropertyAccessExpression */: + case 164 /* PropertyAccessExpression */: return emitPropertyAccess(node); - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: return emitIndexedAccess(node); - case 165 /* CallExpression */: + case 166 /* CallExpression */: return emitCallExpression(node); - case 166 /* NewExpression */: + case 167 /* NewExpression */: return emitNewExpression(node); - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 168 /* TypeAssertionExpression */: + case 169 /* TypeAssertionExpression */: return emit(node.expression); - case 186 /* AsExpression */: + case 187 /* AsExpression */: return emit(node.expression); - case 169 /* ParenthesizedExpression */: + case 170 /* ParenthesizedExpression */: return emitParenExpression(node); - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 172 /* DeleteExpression */: + case 173 /* DeleteExpression */: return emitDeleteExpression(node); - case 173 /* TypeOfExpression */: + case 174 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 174 /* VoidExpression */: + case 175 /* VoidExpression */: return emitVoidExpression(node); - case 175 /* AwaitExpression */: + case 176 /* AwaitExpression */: return emitAwaitExpression(node); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 177 /* PostfixUnaryExpression */: + case 178 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return emitBinaryExpression(node); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return emitConditionalExpression(node); - case 182 /* SpreadElementExpression */: + case 183 /* SpreadElementExpression */: return emitSpreadElementExpression(node); - case 181 /* YieldExpression */: + case 182 /* YieldExpression */: return emitYieldExpression(node); - case 184 /* OmittedExpression */: + case 185 /* OmittedExpression */: return; - case 189 /* Block */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return emitBlock(node); - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: return emitVariableStatement(node); - case 191 /* EmptyStatement */: + case 192 /* EmptyStatement */: return write(";"); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: return emitExpressionStatement(node); - case 193 /* IfStatement */: + case 194 /* IfStatement */: return emitIfStatement(node); - case 194 /* DoStatement */: + case 195 /* DoStatement */: return emitDoStatement(node); - case 195 /* WhileStatement */: + case 196 /* WhileStatement */: return emitWhileStatement(node); - case 196 /* ForStatement */: + case 197 /* ForStatement */: return emitForStatement(node); - case 198 /* ForOfStatement */: - case 197 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 198 /* ForInStatement */: return emitForInOrForOfStatement(node); - case 199 /* ContinueStatement */: - case 200 /* BreakStatement */: + case 200 /* ContinueStatement */: + case 201 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: return emitReturnStatement(node); - case 202 /* WithStatement */: + case 203 /* WithStatement */: return emitWithStatement(node); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: return emitSwitchStatement(node); - case 238 /* CaseClause */: - case 239 /* DefaultClause */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: return emitLabelledStatement(node); - case 205 /* ThrowStatement */: + case 206 /* ThrowStatement */: return emitThrowStatement(node); - case 206 /* TryStatement */: + case 207 /* TryStatement */: return emitTryStatement(node); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return emitCatchClause(node); - case 207 /* DebuggerStatement */: + case 208 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 183 /* ClassExpression */: + case 184 /* ClassExpression */: return emitClassExpression(node); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return emitClassDeclaration(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return emitEnumMember(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: return emitImportDeclaration(node); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: return emitExportDeclaration(node); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: return emitExportAssignment(node); - case 245 /* SourceFile */: + case 246 /* SourceFile */: return emitSourceFileNode(node); } } @@ -34010,6 +34684,11 @@ var ts; } return leadingComments; } + /** + * Removes all but the pinned or triple slash comments. + * @param ranges The array to be filtered + * @param onlyPinnedOrTripleSlashComments whether the filtering should be performed. + */ function filterComments(ranges, onlyPinnedOrTripleSlashComments) { // If we're removing comments, then we want to strip out all but the pinned or // triple slash comments. @@ -34024,7 +34703,7 @@ var ts; function getLeadingCommentsToEmit(node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 245 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 246 /* SourceFile */ || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { // get comments without detached comments return getLeadingCommentsWithoutDetachedComments(); @@ -34039,16 +34718,16 @@ var ts; function getTrailingCommentsToEmit(node) { // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 245 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 246 /* SourceFile */ || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } } function emitOnlyPinnedOrTripleSlashComments(node) { - emitLeadingCommentsWorker(node, true); + emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ true); } function emitLeadingComments(node) { - return emitLeadingCommentsWorker(node, compilerOptions.removeComments); + return emitLeadingCommentsWorker(node, /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); } function emitLeadingCommentsWorker(node, onlyPinnedOrTripleSlashComments) { // If the caller only wants pinned or triple slash comments, then always filter @@ -34056,13 +34735,23 @@ var ts; var leadingComments = filterComments(getLeadingCommentsToEmit(node), onlyPinnedOrTripleSlashComments); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitTrailingComments(node) { // Emit the trailing comments only if the parent's end doesn't match - var trailingComments = filterComments(getTrailingCommentsToEmit(node), compilerOptions.removeComments); + var trailingComments = filterComments(getTrailingCommentsToEmit(node), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ - ts.emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); + } + /** + * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: + * x, /comment1/ y + * ^ => pos; the function will emit "comment1" in the emitJS + */ + function emitTrailingCommentsOfPosition(pos) { + var trailingComments = filterComments(ts.getTrailingCommentRanges(currentSourceFile.text, pos), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + ts.emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitLeadingCommentsOfPosition(pos) { var leadingComments; @@ -34077,7 +34766,7 @@ var ts; leadingComments = filterComments(leadingComments, compilerOptions.removeComments); ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - ts.emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedComments(node) { var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); @@ -34107,7 +34796,7 @@ var ts; if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); - ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + ts.emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: ts.lastOrUndefined(detachedComments).end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); @@ -34119,6 +34808,12 @@ var ts; } } } + function emitShebang() { + var shebang = ts.getShebang(currentSourceFile.text); + if (shebang) { + write(shebang); + } + } function isPinnedOrTripleSlashComment(comment) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42 /* asterisk */) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33 /* exclamation */; @@ -34139,6 +34834,261 @@ var ts; } } ts.emitFiles = emitFiles; + var entities = { + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + }; })(ts || (ts = {})); /// /// @@ -34149,7 +35099,8 @@ var ts; /* @internal */ ts.ioReadTime = 0; /* @internal */ ts.ioWriteTime = 0; /** The version of the TypeScript compiler release */ - ts.version = "1.5.3"; + var emptyArray = []; + ts.version = "1.6.0"; function findConfigFile(searchPath) { var fileName = "tsconfig.json"; while (true) { @@ -34166,6 +35117,53 @@ var ts; return undefined; } ts.findConfigFile = findConfigFile; + function resolveTripleslashReference(moduleName, containingFile) { + var basePath = ts.getDirectoryPath(containingFile); + var referencedFileName = ts.isRootedDiskPath(moduleName) ? moduleName : ts.combinePaths(basePath, moduleName); + return ts.normalizePath(referencedFileName); + } + ts.resolveTripleslashReference = resolveTripleslashReference; + function resolveModuleName(moduleName, containingFile, compilerOptions, host) { + // TODO: use different resolution strategy based on compiler options + return legacyNameResolver(moduleName, containingFile, compilerOptions, host); + } + ts.resolveModuleName = resolveModuleName; + function legacyNameResolver(moduleName, containingFile, compilerOptions, host) { + // module names that contain '!' are used to reference resources and are not resolved to actual files on disk + if (moduleName.indexOf('!') != -1) { + return { resolvedFileName: undefined, failedLookupLocations: [] }; + } + var searchPath = ts.getDirectoryPath(containingFile); + var searchName; + var failedLookupLocations = []; + var referencedSourceFile; + while (true) { + searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + referencedSourceFile = ts.forEach(ts.supportedExtensions, function (extension) { + if (extension === ".tsx" && !compilerOptions.jsx) { + // resolve .tsx files only if jsx support is enabled + // 'logical not' handles both undefined and None cases + return undefined; + } + var candidate = searchName + extension; + if (host.fileExists(candidate)) { + return candidate; + } + else { + failedLookupLocations.push(candidate); + } + }); + if (referencedSourceFile) { + break; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + return { resolvedFileName: referencedSourceFile, failedLookupLocations: failedLookupLocations }; + } function createCompilerHost(options, setParentNodes) { var currentDirectory; var existingDirectories = {}; @@ -34231,7 +35229,9 @@ var ts; getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, getCanonicalFileName: getCanonicalFileName, - getNewLine: function () { return newLine; } + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return ts.sys.fileExists(fileName); }, + readFile: function (fileName) { return ts.sys.readFile(fileName); } }; } ts.createCompilerHost = createCompilerHost; @@ -34266,7 +35266,7 @@ var ts; } } ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; - function createProgram(rootNames, options, host) { + function createProgram(rootNames, options, host, oldProgram) { var program; var files = []; var diagnostics = ts.createDiagnosticCollection(); @@ -34277,18 +35277,37 @@ var ts; var skipDefaultLib = options.noLib; var start = new Date().getTime(); host = host || createCompilerHost(options); + var resolveModuleNamesWorker = host.resolveModuleNames || + (function (moduleNames, containingFile) { return ts.map(moduleNames, function (moduleName) { return resolveModuleName(moduleName, containingFile, options, host).resolvedFileName; }); }); var filesByName = ts.createFileMap(function (fileName) { return host.getCanonicalFileName(fileName); }); - ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); - // Do not process the default library if: - // - The '--noLib' flag is used. - // - A 'no-default-lib' reference comment is encountered in - // processing the root files. - if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), true); + if (oldProgram) { + // check properties that can affect structure of the program or module resolution strategy + // if any of these properties has changed - structure cannot be reused + var oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx)) { + oldProgram = undefined; + } + } + if (!tryReuseStructureFromOldProgram()) { + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + // Do not process the default library if: + // - The '--noLib' flag is used. + // - A 'no-default-lib' reference comment is encountered in + // processing the root files. + if (!skipDefaultLib) { + processRootFile(host.getDefaultLibFileName(options), true); + } } verifyCompilerOptions(); + // unconditionally set oldProgram to undefined to prevent it from being captured in closure + oldProgram = undefined; ts.programTime += new Date().getTime() - start; program = { + getRootFileNames: function () { return rootNames; }, getSourceFile: getSourceFile, getSourceFiles: function () { return files; }, getCompilerOptions: function () { return options; }, @@ -34321,6 +35340,71 @@ var ts; } return classifiableNames; } + function tryReuseStructureFromOldProgram() { + if (!oldProgram) { + return false; + } + ts.Debug.assert(!oldProgram.structureIsReused); + // there is an old program, check if we can reuse its structure + var oldRootNames = oldProgram.getRootFileNames(); + if (!ts.arrayIsEqualTo(oldRootNames, rootNames)) { + return false; + } + // check if program source files has changed in the way that can affect structure of the program + var newSourceFiles = []; + for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { + var oldSourceFile = _a[_i]; + var newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + if (!newSourceFile) { + return false; + } + if (oldSourceFile !== newSourceFile) { + if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { + // value of no-default-lib has changed + // this will affect if default library is injected into the list of files + return false; + } + // check tripleslash references + if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { + // tripleslash references has changed + return false; + } + // check imports + collectExternalModuleReferences(newSourceFile); + if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { + // imports has changed + return false; + } + if (resolveModuleNamesWorker) { + var moduleNames = ts.map(newSourceFile.imports, function (name) { return name.text; }); + var resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); + // ensure that module resolution results are still correct + for (var i = 0; i < moduleNames.length; ++i) { + var oldResolution = ts.getResolvedModuleFileName(oldSourceFile, moduleNames[i]); + if (oldResolution !== resolutions[i]) { + return false; + } + } + } + // pass the cache of module resolutions from the old source file + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + } + else { + // file has no changes - use it as is + newSourceFile = oldSourceFile; + } + // if file has passed all checks it should be safe to reuse it + newSourceFiles.push(newSourceFile); + } + // update fileName -> file mapping + for (var _b = 0; _b < newSourceFiles.length; _b++) { + var file = newSourceFiles[_b]; + filesByName.set(file.fileName, file); + } + files = newSourceFiles; + oldProgram.structureIsReused = true; + return true; + } function getEmitHost(writeFileCallback) { return { getCanonicalFileName: function (fileName) { return host.getCanonicalFileName(fileName); }, @@ -34334,10 +35418,10 @@ var ts; }; } function getDiagnosticsProducingTypeChecker() { - return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); + return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ true)); } function getTypeChecker() { - return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); + return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, /*produceDiagnostics:*/ false)); } function emit(sourceFile, writeFileCallback, cancellationToken) { var _this = this; @@ -34347,7 +35431,7 @@ var ts; // If the noEmitOnError flag is set, then check if we have any errors so far. If so, // immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we // get any preEmit diagnostics, not just the ones - if (options.noEmitOnError && getPreEmitDiagnostics(program, undefined, cancellationToken).length > 0) { + if (options.noEmitOnError && getPreEmitDiagnostics(program, /*sourceFile:*/ undefined, cancellationToken).length > 0) { return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; } // Create the emit resolver outside of the "emitTime" tracking code below. That way @@ -34358,7 +35442,7 @@ var ts; // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); + var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile); var start = new Date().getTime(); var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile); ts.emitTime += new Date().getTime() - start; @@ -34449,14 +35533,59 @@ var ts; function processRootFile(fileName, isDefaultLib) { processSourceFile(ts.normalizePath(fileName), isDefaultLib); } + function fileReferenceIsEqualTo(a, b) { + return a.fileName === b.fileName; + } + function moduleNameIsEqualTo(a, b) { + return a.text === b.text; + } + function collectExternalModuleReferences(file) { + if (file.imports) { + return; + } + var imports; + for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 220 /* ImportDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 226 /* ExportDeclaration */: + var moduleNameExpr = ts.getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== 9 /* StringLiteral */) { + break; + } + if (!moduleNameExpr.text) { + break; + } + (imports || (imports = [])).push(moduleNameExpr); + break; + case 216 /* ModuleDeclaration */: + if (node.name.kind === 9 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An AmbientExternalModuleDeclaration declares an external module. + // This type of declaration is permitted only in the global module. + // The StringLiteral must specify a top - level external module name. + // Relative external module names are not permitted + ts.forEachChild(node.body, function (node) { + if (ts.isExternalModuleImportEqualsDeclaration(node) && + ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 9 /* StringLiteral */) { + var moduleName = ts.getExternalModuleImportEqualsDeclarationExpression(node); + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + if (moduleName) { + (imports || (imports = [])).push(moduleName); + } + } + }); + } + break; + } + } + file.imports = imports || emptyArray; + } function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - var start; - var length; var diagnosticArgument; - if (refEnd !== undefined && refPos !== undefined) { - start = refPos; - length = refEnd - refPos; - } var diagnostic; if (hasExtension(fileName)) { if (!options.allowNonTsExtensions && !ts.forEach(ts.supportedExtensions, function (extension) { return ts.fileExtensionIs(host.getCanonicalFileName(fileName), extension); })) { @@ -34487,8 +35616,8 @@ var ts; } } if (diagnostic) { - if (refFile) { - diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, start, length, diagnostic].concat(diagnosticArgument))); + if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { + diagnostics.add(ts.createFileDiagnostic.apply(void 0, [refFile, refPos, refEnd - refPos, diagnostic].concat(diagnosticArgument))); } else { diagnostics.add(ts.createCompilerDiagnostic.apply(void 0, [diagnostic].concat(diagnosticArgument))); @@ -34496,22 +35625,22 @@ var ts; } } // Get source file from normalized fileName - function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { + function findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { var canonicalName = host.getCanonicalFileName(ts.normalizeSlashes(fileName)); if (filesByName.contains(canonicalName)) { // We've already looked for this file, use cached result - return getSourceFileFromCache(fileName, canonicalName, false); + return getSourceFileFromCache(fileName, canonicalName, /*useAbsolutePath*/ false); } else { var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); if (filesByName.contains(canonicalAbsolutePath)) { - return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); + return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, /*useAbsolutePath*/ true); } // We haven't looked for this file, do so now and cache result var file = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { - if (refFile) { - diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, 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)); @@ -34522,11 +35651,12 @@ var ts; skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; // Set the source file for normalized absolute path filesByName.set(canonicalAbsolutePath, file); + var basePath = ts.getDirectoryPath(fileName); if (!options.noResolve) { - var basePath = ts.getDirectoryPath(fileName); processReferencedFiles(file, basePath); - processImportedModules(file, basePath); } + // always process imported modules to record module name resolutions + processImportedModules(file, basePath); if (isDefaultLib) { file.isDefaultLib = true; files.unshift(file); @@ -34542,7 +35672,12 @@ var ts; 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)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(ts.createFileDiagnostic(refFile, refPos, refEnd - refPos, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } + else { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } } } return file; @@ -34550,57 +35685,31 @@ var ts; } 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); + var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); + processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end); }); } function processImportedModules(file, basePath) { - ts.forEach(file.statements, function (node) { - if (node.kind === 219 /* ImportDeclaration */ || node.kind === 218 /* ImportEqualsDeclaration */ || node.kind === 225 /* ExportDeclaration */) { - var moduleNameExpr = ts.getExternalModuleName(node); - if (moduleNameExpr && moduleNameExpr.kind === 8 /* StringLiteral */) { - var moduleNameText = moduleNameExpr.text; - if (moduleNameText) { - var searchPath = basePath; - var searchName; - while (true) { - searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleNameText)); - if (ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, moduleNameExpr); })) { - break; - } - var parentPath = ts.getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } - } + collectExternalModuleReferences(file); + if (file.imports.length) { + file.resolvedModules = {}; + var moduleNames = ts.map(file.imports, function (name) { return name.text; }); + var resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); + for (var i = 0; i < file.imports.length; ++i) { + var resolution = resolutions[i]; + ts.setResolvedModuleName(file, moduleNames[i], resolution); + if (resolution && !options.noResolve) { + findModuleSourceFile(resolution, file.imports[i]); } } - else if (node.kind === 215 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An AmbientExternalModuleDeclaration declares an external module. - // This type of declaration is permitted only in the global module. - // The StringLiteral must specify a top - level external module name. - // Relative external module names are not permitted - ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportEqualsDeclaration(node) && - ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8 /* StringLiteral */) { - var nameLiteral = ts.getExternalModuleImportEqualsDeclarationExpression(node); - var moduleName = nameLiteral.text; - if (moduleName) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); - ts.forEach(ts.supportedExtensions, function (extension) { return findModuleSourceFile(searchName + extension, nameLiteral); }); - } - } - }); - } - }); + } + else { + // no imports - drop cached module resolutions + file.resolvedModules = undefined; + } + return; function findModuleSourceFile(fileName, nameLiteral) { - return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end); } } function computeCommonSourceDirectory(sourceFiles) { @@ -34656,28 +35765,28 @@ var ts; } function verifyCompilerOptions() { if (options.isolatedModules) { - if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_isolatedModules)); - } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + } + if (options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } if (options.inlineSources) { @@ -34685,17 +35794,21 @@ var ts; diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); } } + if (options.out && options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } var languageVersion = options.target || 0 /* ES3 */; + var outFile = options.outFile || options.out; var firstExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); if (options.isolatedModules) { if (!options.module && languageVersion < 2 /* ES6 */) { @@ -34721,7 +35834,7 @@ var ts; if (options.outDir || options.sourceRoot || (options.mapRoot && - (!options.out || firstExternalModuleSourceFile !== undefined))) { + (!outFile || firstExternalModuleSourceFile !== undefined))) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory commonSourceDirectory = ts.getNormalizedAbsolutePath(options.rootDir, host.getCurrentDirectory()); @@ -34738,16 +35851,22 @@ var ts; } } 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.out) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + } + if (options.outFile) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + } + if (options.outDir) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && options.target !== 2 /* ES6 */) { @@ -34879,6 +35998,13 @@ var ts; { name: "out", type: "string", + isFilePath: false, + // for correct behaviour, please use outFile + paramType: ts.Diagnostics.FILE + }, + { + name: "outFile", + type: "string", isFilePath: true, description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, paramType: ts.Diagnostics.FILE @@ -35088,7 +36214,7 @@ var ts; * @param fileName The path to the config file */ function readConfigFile(fileName) { - var text = ''; + var text = ""; try { text = ts.sys.readFile(fileName); } @@ -35172,6 +36298,9 @@ var ts; if (json["files"] instanceof Array) { fileNames = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); + } } else { var exclude = json["exclude"] instanceof Array ? ts.map(json["exclude"], ts.normalizeSlashes) : undefined; @@ -35250,7 +36379,7 @@ var ts; } else if (currentComment.kind === 3 /* MultiLineCommentTrivia */) { combineAndAddMultipleSingleLineComments(singleLineCommentCount, firstSingleLineCommentStart, lastSingleLineCommentEnd); - addOutliningSpanComments(currentComment, false); + addOutliningSpanComments(currentComment, /*autoCollapse*/ false); singleLineCommentCount = 0; lastSingleLineCommentEnd = -1; isFirstSingleLineComment = true; @@ -35267,11 +36396,11 @@ var ts; end: end, kind: 2 /* SingleLineCommentTrivia */ }; - addOutliningSpanComments(multipleSingleLineComments, false); + addOutliningSpanComments(multipleSingleLineComments, /*autoCollapse*/ false); } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 171 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 172 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -35283,34 +36412,34 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 189 /* Block */: + case 190 /* Block */: if (!ts.isFunctionBlock(n)) { - var parent_8 = n.parent; - var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); + var parent_7 = n.parent; + var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collaps the block, but consider its hint span // to be the entire span of the parent. - if (parent_8.kind === 194 /* DoStatement */ || - parent_8.kind === 197 /* ForInStatement */ || - parent_8.kind === 198 /* ForOfStatement */ || - parent_8.kind === 196 /* ForStatement */ || - parent_8.kind === 193 /* IfStatement */ || - parent_8.kind === 195 /* WhileStatement */ || - parent_8.kind === 202 /* WithStatement */ || - parent_8.kind === 241 /* CatchClause */) { - addOutliningSpan(parent_8, openBrace, closeBrace, autoCollapse(n)); + if (parent_7.kind === 195 /* DoStatement */ || + parent_7.kind === 198 /* ForInStatement */ || + parent_7.kind === 199 /* ForOfStatement */ || + parent_7.kind === 197 /* ForStatement */ || + parent_7.kind === 194 /* IfStatement */ || + parent_7.kind === 196 /* WhileStatement */ || + parent_7.kind === 203 /* WithStatement */ || + parent_7.kind === 242 /* CatchClause */) { + addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_8.kind === 206 /* TryStatement */) { + if (parent_7.kind === 207 /* TryStatement */) { // Could be the try-block, or the finally-block. - var tryStatement = parent_8; + var tryStatement = parent_7; if (tryStatement.tryBlock === n) { - addOutliningSpan(parent_8, openBrace, closeBrace, autoCollapse(n)); + addOutliningSpan(parent_7, openBrace, closeBrace, autoCollapse(n)); break; } else if (tryStatement.finallyBlock === n) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 82 /* FinallyKeyword */, sourceFile); + var finallyKeyword = ts.findChildOfKind(tryStatement, 83 /* FinallyKeyword */, sourceFile); if (finallyKeyword) { addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); break; @@ -35329,25 +36458,25 @@ var ts; break; } // Fallthrough. - case 216 /* ModuleBlock */: { - var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); + case 217 /* ModuleBlock */: { + var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 162 /* ObjectLiteralExpression */: - case 217 /* CaseBlock */: { - var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); - var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 163 /* ObjectLiteralExpression */: + case 218 /* CaseBlock */: { + var openBrace = ts.findChildOfKind(n, 15 /* OpenBraceToken */, sourceFile); + var closeBrace = ts.findChildOfKind(n, 16 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 161 /* ArrayLiteralExpression */: - var openBracket = ts.findChildOfKind(n, 18 /* OpenBracketToken */, sourceFile); - var closeBracket = ts.findChildOfKind(n, 19 /* CloseBracketToken */, sourceFile); + case 162 /* ArrayLiteralExpression */: + var openBracket = ts.findChildOfKind(n, 19 /* OpenBracketToken */, sourceFile); + var closeBracket = ts.findChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); break; } @@ -35422,9 +36551,9 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 66 /* Identifier */ || - node.kind === 8 /* StringLiteral */ || - node.kind === 7 /* NumericLiteral */) { + if (node.kind === 67 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + node.kind === 8 /* NumericLiteral */) { return node.text; } } @@ -35436,8 +36565,8 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 133 /* ComputedPropertyName */) { - return tryAddComputedPropertyName(declaration.name.expression, containers, true); + else if (declaration.name.kind === 134 /* ComputedPropertyName */) { + return tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ true); } else { // Don't know how to add this. @@ -35457,12 +36586,12 @@ var ts; } return true; } - if (expression.kind === 163 /* PropertyAccessExpression */) { + if (expression.kind === 164 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); } - return tryAddComputedPropertyName(propertyAccess.expression, containers, true); + return tryAddComputedPropertyName(propertyAccess.expression, containers, /*includeLastPortion:*/ true); } return false; } @@ -35470,8 +36599,8 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 133 /* ComputedPropertyName */) { - if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { + if (declaration.name.kind === 134 /* ComputedPropertyName */) { + if (!tryAddComputedPropertyName(declaration.name.expression, containers, /*includeLastPortion:*/ false)) { return undefined; } } @@ -35546,17 +36675,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 215 /* ModuleDeclaration */); + } while (current.kind === 216 /* ModuleDeclaration */); // fall through - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -35567,21 +36696,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -35593,7 +36722,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -35602,21 +36731,21 @@ var ts; } } break; - case 160 /* BindingElement */: - case 208 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 209 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 212 /* InterfaceDeclaration */: - case 215 /* ModuleDeclaration */: - case 210 /* FunctionDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 223 /* ImportSpecifier */: - case 227 /* ExportSpecifier */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 213 /* InterfaceDeclaration */: + case 216 /* ModuleDeclaration */: + case 211 /* FunctionDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 224 /* ImportSpecifier */: + case 228 /* ExportSpecifier */: childNodes.push(node); break; } @@ -35664,17 +36793,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 213 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -35685,12 +36814,12 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 210 /* FunctionDeclaration */) { + if (functionDeclaration.kind === 211 /* FunctionDeclaration */) { // A function declaration is 'top level' if it contains any function declarations // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 189 /* Block */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 190 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 210 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 211 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { return true; } // Or if it is not parented by another function. i.e all functions @@ -35750,7 +36879,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 135 /* Parameter */: + case 136 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } @@ -35758,36 +36887,36 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 142 /* GetAccessor */: + case 143 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 143 /* SetAccessor */: + case 144 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 146 /* IndexSignature */: + case 147 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 244 /* EnumMember */: + case 245 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 144 /* CallSignature */: + case 145 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 145 /* ConstructSignature */: + case 146 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: var variableDeclarationNode; var name_29; - if (node.kind === 160 /* BindingElement */) { + if (node.kind === 161 /* BindingElement */) { name_29 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 208 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 209 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -35806,13 +36935,13 @@ var ts; else { return createItem(node, getTextOfNode(name_29), ts.ScriptElementKind.variableElement); } - case 141 /* Constructor */: + case 142 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 227 /* ExportSpecifier */: - case 223 /* ImportSpecifier */: - case 218 /* ImportEqualsDeclaration */: - case 220 /* ImportClause */: - case 221 /* NamespaceImport */: + case 228 /* ExportSpecifier */: + case 224 /* ImportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportClause */: + case 222 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -35842,29 +36971,29 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 245 /* SourceFile */: + case 246 /* SourceFile */: return createSourceFileItem(node); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: return createClassItem(node); - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: return createEnumItem(node); - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return createIterfaceItem(node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: return createModuleItem(node); - case 210 /* FunctionDeclaration */: + case 211 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; function getModuleName(moduleDeclaration) { // We want to maintain quotation marks. - if (moduleDeclaration.name.kind === 8 /* StringLiteral */) { + if (moduleDeclaration.name.kind === 9 /* StringLiteral */) { return getTextOfNode(moduleDeclaration.name); } // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 215 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 216 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -35876,7 +37005,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 189 /* Block */) { + if (node.body && node.body.kind === 190 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -35897,7 +37026,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 141 /* Constructor */ && member; + return member.kind === 142 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -35921,7 +37050,7 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 133 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 134 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -35930,13 +37059,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 215 /* ModuleDeclaration */) { + while (node.body.kind === 216 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 245 /* SourceFile */ + return node.kind === 246 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -36039,12 +37168,12 @@ var ts; 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, candidate === chunk.text); + 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, startsWith(candidate, chunk.text)); + return createPatternMatch(PatternMatchKind.prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text)); } } var isLowercase = chunk.isLowerCase; @@ -36060,9 +37189,9 @@ var ts; var wordSpans = getWordSpans(candidate); for (var _i = 0; _i < wordSpans.length; _i++) { var span = wordSpans[_i]; - if (partStartsWith(candidate, span, chunk.text, true)) { + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { return createPatternMatch(PatternMatchKind.substring, punctuationStripped, - /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, false)); + /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); } } } @@ -36072,20 +37201,20 @@ var ts; // 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, true); + 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, false); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, true, camelCaseWeight); + return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); } - camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true); + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); if (camelCaseWeight !== undefined) { - return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, false, camelCaseWeight); + return createPatternMatch(PatternMatchKind.camelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); } } } @@ -36098,7 +37227,7 @@ var ts; // (Pattern: fogbar, Candidate: quuxfogbarFogBar). if (chunk.text.length < candidate.length) { if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { - return createPatternMatch(PatternMatchKind.substring, punctuationStripped, false); + return createPatternMatch(PatternMatchKind.substring, punctuationStripped, /*isCaseSensitive:*/ false); } } } @@ -36122,7 +37251,7 @@ var ts; // 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, false); + var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); if (match) { return [match]; } @@ -36168,7 +37297,7 @@ var ts; for (var _i = 0; _i < subWordTextChunks.length; _i++) { var subWordTextChunk = subWordTextChunks[_i]; // Try to match the candidate with this word - var result = matchTextChunk(candidate, subWordTextChunk, true); + var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); if (!result) { return undefined; } @@ -36434,11 +37563,11 @@ var ts; }; } /* @internal */ function breakIntoCharacterSpans(identifier) { - return breakIntoSpans(identifier, false); + return breakIntoSpans(identifier, /*word:*/ false); } ts.breakIntoCharacterSpans = breakIntoCharacterSpans; /* @internal */ function breakIntoWordSpans(identifier) { - return breakIntoSpans(identifier, true); + return breakIntoSpans(identifier, /*word:*/ true); } ts.breakIntoWordSpans = breakIntoWordSpans; function breakIntoSpans(identifier, word) { @@ -36731,15 +37860,15 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 165 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 166 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. var callExpression = argumentInfo.invocation; var expression = callExpression.expression; - var name = expression.kind === 66 /* Identifier */ + var name = expression.kind === 67 /* Identifier */ ? expression - : expression.kind === 163 /* PropertyAccessExpression */ + : expression.kind === 164 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -36772,7 +37901,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 165 /* CallExpression */ || node.parent.kind === 166 /* NewExpression */) { + if (node.parent.kind === 166 /* CallExpression */ || node.parent.kind === 167 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -36788,8 +37917,8 @@ var ts; // Case 3: // foo(a#, #b#) -> The token is buried inside a list, and should give sig help // Find out if 'node' is an argument, a type argument, or neither - if (node.kind === 24 /* LessThanToken */ || - node.kind === 16 /* OpenParenToken */) { + if (node.kind === 25 /* LessThanToken */ || + node.kind === 17 /* OpenParenToken */) { // Find the list that starts right *after* the < or ( token. // If the user has just opened a list, consider this item 0. var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); @@ -36825,27 +37954,27 @@ var ts; }; } } - else if (node.kind === 10 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 167 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 168 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { - return getArgumentListInfoForTemplate(node.parent, 0); + return getArgumentListInfoForTemplate(node.parent, /*argumentIndex*/ 0); } } - else if (node.kind === 11 /* TemplateHead */ && node.parent.parent.kind === 167 /* TaggedTemplateExpression */) { + else if (node.kind === 12 /* TemplateHead */ && node.parent.parent.kind === 168 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 180 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 181 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 187 /* TemplateSpan */ && node.parent.parent.parent.kind === 167 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 188 /* TemplateSpan */ && node.parent.parent.parent.kind === 168 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 180 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 181 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. - if (node.kind === 13 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { + if (node.kind === 14 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); @@ -36873,7 +38002,7 @@ var ts; if (child === node) { break; } - if (child.kind !== 23 /* CommaToken */) { + if (child.kind !== 24 /* CommaToken */) { argumentIndex++; } } @@ -36892,8 +38021,8 @@ var ts; // That will give us 2 non-commas. We then add one for the last comma, givin us an // arg count of 3. var listChildren = argumentsList.getChildren(); - var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 23 /* CommaToken */; }); - if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 23 /* CommaToken */) { + var argumentCount = ts.countWhere(listChildren, function (arg) { return arg.kind !== 24 /* CommaToken */; }); + if (listChildren.length > 0 && ts.lastOrUndefined(listChildren).kind === 24 /* CommaToken */) { argumentCount++; } return argumentCount; @@ -36923,7 +38052,7 @@ var ts; } function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { // argumentCount is either 1 or (numSpans + 1) to account for the template strings array argument. - var argumentCount = tagExpression.template.kind === 10 /* NoSubstitutionTemplateLiteral */ + var argumentCount = tagExpression.template.kind === 11 /* NoSubstitutionTemplateLiteral */ ? 1 : tagExpression.template.templateSpans.length + 1; ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); @@ -36945,7 +38074,7 @@ var ts; // The applicable span is from the first bar to the second bar (inclusive, // but not including parentheses) var applicableSpanStart = argumentsList.getFullStart(); - var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false); + var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), /*stopAfterLineBreak*/ false); return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getApplicableSpanForTaggedTemplate(taggedTemplate) { @@ -36961,16 +38090,16 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 180 /* TemplateExpression */) { + if (template.kind === 181 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { - applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); + applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); } } return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 245 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 246 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -37021,7 +38150,7 @@ var ts; var invocation = argumentListInfo.invocation; var callTarget = ts.getInvokedExpression(invocation); var callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget); - var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, undefined, undefined); + var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, /*enclosingDeclaration*/ undefined, /*meaning*/ undefined); var items = ts.map(candidates, function (candidateSignature) { var signatureHelpParameters; var prefixDisplayParts = []; @@ -37030,10 +38159,10 @@ var ts; ts.addRange(prefixDisplayParts, callTargetDisplayParts); } if (isTypeParameterList) { - prefixDisplayParts.push(ts.punctuationPart(24 /* LessThanToken */)); + prefixDisplayParts.push(ts.punctuationPart(25 /* LessThanToken */)); var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; - suffixDisplayParts.push(ts.punctuationPart(26 /* GreaterThanToken */)); + suffixDisplayParts.push(ts.punctuationPart(27 /* GreaterThanToken */)); var parameterParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); }); @@ -37044,10 +38173,10 @@ var ts; return typeChecker.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); }); ts.addRange(prefixDisplayParts, typeParameterParts); - prefixDisplayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); + prefixDisplayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; - suffixDisplayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + suffixDisplayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); } var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); @@ -37057,7 +38186,7 @@ var ts; isVariadic: candidateSignature.hasRestParameter, prefixDisplayParts: prefixDisplayParts, suffixDisplayParts: suffixDisplayParts, - separatorDisplayParts: [ts.punctuationPart(23 /* CommaToken */), ts.spacePart()], + separatorDisplayParts: [ts.punctuationPart(24 /* CommaToken */), ts.spacePart()], parameters: signatureHelpParameters, documentation: candidateSignature.getDocumentationComment() }; @@ -37081,12 +38210,11 @@ var ts; var displayParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); }); - var isOptional = ts.hasQuestionToken(parameter.valueDeclaration); return { name: parameter.name, documentation: parameter.getDocumentationComment(), displayParts: displayParts, - isOptional: isOptional + isOptional: typeChecker.isOptionalParameter(parameter.valueDeclaration) }; } function createSignatureHelpParameterForTypeParameter(typeParameter) { @@ -37171,40 +38299,40 @@ var ts; return false; } switch (n.kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 162 /* ObjectLiteralExpression */: - case 158 /* ObjectBindingPattern */: - case 152 /* TypeLiteral */: - case 189 /* Block */: - case 216 /* ModuleBlock */: - case 217 /* CaseBlock */: - return nodeEndsWith(n, 15 /* CloseBraceToken */, sourceFile); - case 241 /* CatchClause */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 163 /* ObjectLiteralExpression */: + case 159 /* ObjectBindingPattern */: + case 153 /* TypeLiteral */: + case 190 /* Block */: + case 217 /* ModuleBlock */: + case 218 /* CaseBlock */: + return nodeEndsWith(n, 16 /* CloseBraceToken */, sourceFile); + case 242 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 166 /* NewExpression */: + case 167 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 165 /* CallExpression */: - case 169 /* ParenthesizedExpression */: - case 157 /* ParenthesizedType */: - return nodeEndsWith(n, 17 /* CloseParenToken */, sourceFile); - case 149 /* FunctionType */: - case 150 /* ConstructorType */: + case 166 /* CallExpression */: + case 170 /* ParenthesizedExpression */: + case 158 /* ParenthesizedType */: + return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); + case 150 /* FunctionType */: + case 151 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 145 /* ConstructSignature */: - case 144 /* CallSignature */: - case 171 /* ArrowFunction */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 146 /* ConstructSignature */: + case 145 /* CallSignature */: + case 172 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -37213,64 +38341,64 @@ var ts; } // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. - return hasChildOfKind(n, 17 /* CloseParenToken */, sourceFile); - case 215 /* ModuleDeclaration */: + return hasChildOfKind(n, 18 /* CloseParenToken */, sourceFile); + case 216 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 193 /* IfStatement */: + case 194 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile); - case 161 /* ArrayLiteralExpression */: - case 159 /* ArrayBindingPattern */: - case 164 /* ElementAccessExpression */: - case 133 /* ComputedPropertyName */: - case 154 /* TupleType */: - return nodeEndsWith(n, 19 /* CloseBracketToken */, sourceFile); - case 146 /* IndexSignature */: + case 162 /* ArrayLiteralExpression */: + case 160 /* ArrayBindingPattern */: + case 165 /* ElementAccessExpression */: + case 134 /* ComputedPropertyName */: + case 155 /* TupleType */: + return nodeEndsWith(n, 20 /* CloseBracketToken */, sourceFile); + case 147 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } - return hasChildOfKind(n, 19 /* CloseBracketToken */, sourceFile); - case 238 /* CaseClause */: - case 239 /* DefaultClause */: + return hasChildOfKind(n, 20 /* CloseBracketToken */, sourceFile); + case 239 /* CaseClause */: + case 240 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed return false; - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 195 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 196 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 194 /* DoStatement */: + case 195 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; - var hasWhileKeyword = findChildOfKind(n, 101 /* WhileKeyword */, sourceFile); + var hasWhileKeyword = findChildOfKind(n, 102 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { - return nodeEndsWith(n, 17 /* CloseParenToken */, sourceFile); + return nodeEndsWith(n, 18 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 151 /* TypeQuery */: + case 152 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 173 /* TypeOfExpression */: - case 172 /* DeleteExpression */: - case 174 /* VoidExpression */: - case 181 /* YieldExpression */: - case 182 /* SpreadElementExpression */: + case 174 /* TypeOfExpression */: + case 173 /* DeleteExpression */: + case 175 /* VoidExpression */: + case 182 /* YieldExpression */: + case 183 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 167 /* TaggedTemplateExpression */: + case 168 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 180 /* TemplateExpression */: + case 181 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 187 /* TemplateSpan */: + case 188 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 176 /* PrefixUnaryExpression */: + case 177 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 178 /* BinaryExpression */: + case 179 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 179 /* ConditionalExpression */: + case 180 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -37288,7 +38416,7 @@ var ts; if (last.kind === expectedLastToken) { return true; } - else if (last.kind === 22 /* SemicolonToken */ && children.length !== 1) { + else if (last.kind === 23 /* SemicolonToken */ && children.length !== 1) { return children[children.length - 2].kind === expectedLastToken; } } @@ -37326,7 +38454,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 268 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 269 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -37351,12 +38479,12 @@ var ts; ts.getTouchingPropertyName = getTouchingPropertyName; /** Returns the token if position is in [start, end) or if position === end and includeItemAtEndPosition(token) === true */ function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { - return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition); + return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ false, includeItemAtEndPosition); } ts.getTouchingToken = getTouchingToken; /** Returns a token if position is in [start-of-leading-trivia, end) */ function getTokenAtPosition(sourceFile, position) { - return getTokenAtPositionWorker(sourceFile, position, true, undefined); + return getTokenAtPositionWorker(sourceFile, position, /*allowPositionInLeadingTrivia*/ true, /*includeItemAtEndPosition*/ undefined); } ts.getTokenAtPosition = getTokenAtPosition; /** Get the token whose text contains the position */ @@ -37436,7 +38564,7 @@ var ts; return n; } var children = n.getChildren(); - var candidate = findRightmostChildNodeWithTokens(children, children.length); + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); return candidate && findRightmostToken(candidate); } function find(n) { @@ -37450,7 +38578,7 @@ var ts; if (position <= child.end) { if (child.getStart(sourceFile) >= position) { // actual start of the node is past the position - previous token should be at the end of previous child - var candidate = findRightmostChildNodeWithTokens(children, i); + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i); return candidate && findRightmostToken(candidate); } else { @@ -37460,13 +38588,13 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 245 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 246 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. // Namely we are skipping the check: 'position < node.end' if (children.length) { - var candidate = findRightmostChildNodeWithTokens(children, children.length); + var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length); return candidate && findRightmostToken(candidate); } } @@ -37480,6 +38608,54 @@ var ts; } } ts.findPrecedingToken = findPrecedingToken; + function isInString(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + return token && token.kind === 9 /* StringLiteral */ && position > token.getStart(); + } + ts.isInString = isInString; + function isInComment(sourceFile, position) { + return isInCommentHelper(sourceFile, position, /*predicate*/ undefined); + } + ts.isInComment = isInComment; + /** + * Returns true if the cursor at position in sourceFile is within a comment that additionally + * satisfies predicate, and false otherwise. + */ + function isInCommentHelper(sourceFile, position, predicate) { + var token = getTokenAtPosition(sourceFile, position); + if (token && position <= token.getStart()) { + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + // The end marker of a single-line comment does not include the newline character. + // In the following case, we are inside a comment (^ denotes the cursor position): + // + // // asdf ^\n + // + // But for multi-line comments, we don't want to be inside the comment in the following case: + // + // /* asdf */^ + // + // Internally, we represent the end of the comment at the newline and closing '/', respectively. + return predicate ? + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end) && + predicate(c); }) : + ts.forEach(commentRanges, function (c) { return c.pos < position && + (c.kind == 2 /* SingleLineCommentTrivia */ ? position <= c.end : position < c.end); }); + } + return false; + } + ts.isInCommentHelper = isInCommentHelper; + function hasDocComment(sourceFile, position) { + var token = getTokenAtPosition(sourceFile, position); + // First, we have to see if this position actually landed in a comment. + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return ts.forEach(commentRanges, jsDocPrefix); + function jsDocPrefix(c) { + var text = sourceFile.text; + return text.length >= c.pos + 3 && text[c.pos] === '/' && text[c.pos + 1] === '*' && text[c.pos + 2] === '*'; + } + } + ts.hasDocComment = hasDocComment; function nodeHasTokens(n) { // If we have a token or node that has a non-zero width, it must have tokens. // Note, that getWidth() does not take trivia into account. @@ -37506,32 +38682,32 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 148 /* TypeReference */ || node.kind === 165 /* CallExpression */) { + if (node.kind === 149 /* TypeReference */ || node.kind === 166 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 211 /* ClassDeclaration */ || node.kind === 212 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 212 /* ClassDeclaration */ || node.kind === 213 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 131 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 132 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { - return kind === 66 /* Identifier */ || ts.isKeyword(kind); + return kind === 67 /* Identifier */ || ts.isKeyword(kind); } ts.isWord = isWord; function isPropertyName(kind) { - return kind === 8 /* StringLiteral */ || kind === 7 /* NumericLiteral */ || isWord(kind); + return kind === 9 /* StringLiteral */ || kind === 8 /* NumericLiteral */ || isWord(kind); } function isComment(kind) { return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; } ts.isComment = isComment; function isPunctuation(kind) { - return 14 /* FirstPunctuation */ <= kind && kind <= 65 /* LastPunctuation */; + return 15 /* FirstPunctuation */ <= kind && kind <= 66 /* LastPunctuation */; } ts.isPunctuation = isPunctuation; function isInsideTemplateLiteral(node, position) { @@ -37541,9 +38717,9 @@ var ts; ts.isInsideTemplateLiteral = isInsideTemplateLiteral; function isAccessibilityModifier(kind) { switch (kind) { - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: return true; } return false; @@ -37571,7 +38747,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 135 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 136 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -37706,6 +38882,14 @@ var ts; return displayPart(text, ts.SymbolDisplayPartKind.text); } ts.textPart = textPart; + var carriageReturnLineFeed = "\r\n"; + /** + * The default is CRLF. + */ + function getNewLineOrDefaultFromHost(host) { + return host.getNewLine ? host.getNewLine() : carriageReturnLineFeed; + } + ts.getNewLineOrDefaultFromHost = getNewLineOrDefaultFromHost; function lineBreakPart() { return displayPart("\n", ts.SymbolDisplayPartKind.lineBreak); } @@ -37750,7 +38934,7 @@ var ts; ts.getDeclaredName = getDeclaredName; function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 223 /* ImportSpecifier */ || location.parent.kind === 227 /* ExportSpecifier */) && + (location.parent.kind === 224 /* ImportSpecifier */ || location.parent.kind === 228 /* ExportSpecifier */) && location.parent.propertyName === location; } ts.isImportOrExportSpecifierName = isImportOrExportSpecifierName; @@ -37778,7 +38962,7 @@ var ts; (function (ts) { var formatting; (function (formatting) { - var scanner = ts.createScanner(2 /* Latest */, false); + var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false); var ScanAction; (function (ScanAction) { ScanAction[ScanAction["Scan"] = 0] = "Scan"; @@ -37848,25 +39032,25 @@ var ts; function shouldRescanGreaterThanToken(node) { if (node) { switch (node.kind) { - case 28 /* GreaterThanEqualsToken */: - case 61 /* GreaterThanGreaterThanEqualsToken */: - case 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 43 /* GreaterThanGreaterThanGreaterThanToken */: - case 42 /* GreaterThanGreaterThanToken */: + case 29 /* GreaterThanEqualsToken */: + case 62 /* GreaterThanGreaterThanEqualsToken */: + case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 43 /* GreaterThanGreaterThanToken */: return true; } } return false; } function shouldRescanSlashToken(container) { - return container.kind === 9 /* RegularExpressionLiteral */; + return container.kind === 10 /* RegularExpressionLiteral */; } function shouldRescanTemplateToken(container) { - return container.kind === 12 /* TemplateMiddle */ || - container.kind === 13 /* TemplateTail */; + return container.kind === 13 /* TemplateMiddle */ || + container.kind === 14 /* TemplateTail */; } function startsWithSlashToken(t) { - return t === 37 /* SlashToken */ || t === 58 /* SlashEqualsToken */; + return t === 38 /* SlashToken */ || t === 59 /* SlashEqualsToken */; } function readTokenInfo(n) { if (!isOnToken()) { @@ -37902,7 +39086,7 @@ var ts; scanner.scan(); } var currentToken = scanner.getToken(); - if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 26 /* GreaterThanToken */) { + if (expectedScanAction === 1 /* RescanGreaterThanToken */ && currentToken === 27 /* GreaterThanToken */) { currentToken = scanner.reScanGreaterToken(); ts.Debug.assert(n.kind === currentToken); lastScanAction = 1 /* RescanGreaterThanToken */; @@ -37912,7 +39096,7 @@ var ts; ts.Debug.assert(n.kind === currentToken); lastScanAction = 2 /* RescanSlashToken */; } - else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 15 /* CloseBraceToken */) { + else if (expectedScanAction === 3 /* RescanTemplateToken */ && currentToken === 16 /* CloseBraceToken */) { currentToken = scanner.reScanTemplateToken(); lastScanAction = 3 /* RescanTemplateToken */; } @@ -38041,8 +39225,8 @@ var ts; return startLine === endLine; }; FormattingContext.prototype.BlockIsOnOneLine = function (node) { - var openBrace = ts.findChildOfKind(node, 14 /* OpenBraceToken */, this.sourceFile); - var closeBrace = ts.findChildOfKind(node, 15 /* CloseBraceToken */, this.sourceFile); + var openBrace = ts.findChildOfKind(node, 15 /* OpenBraceToken */, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 16 /* CloseBraceToken */, this.sourceFile); if (openBrace && closeBrace) { var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; @@ -38233,112 +39417,112 @@ var ts; this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1 /* Ignore */)); this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2 /* SingleLineCommentTrivia */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1 /* Ignore */)); // Space after keyword but not before ; or : or ? - this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 51 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); - this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(51 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); - this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(51 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* ColonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.NoSpaceBeforeQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52 /* QuestionToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* ColonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2 /* Space */)); + this.SpaceAfterQuestionMarkInConditionalOperator = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsConditionalOperatorContext), 2 /* Space */)); + this.NoSpaceAfterQuestionMark = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Space after }. - this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2 /* Space */)); // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied - this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* CloseBraceToken */, 77 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* CloseBraceToken */, 101 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([17 /* CloseParenToken */, 19 /* CloseBracketToken */, 23 /* CommaToken */, 22 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - // No space for indexer and dot - this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(18 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 78 /* ElseKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* CloseBraceToken */, 102 /* WhileKeyword */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* CloseBraceToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 20 /* CloseBracketToken */, 24 /* CommaToken */, 23 /* SemicolonToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + // No space for dot + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 21 /* DotToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(21 /* DotToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + // No space before and after indexer + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19 /* OpenBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(20 /* CloseBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8 /* Delete */)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([66 /* Identifier */, 3 /* MultiLineCommentTrivia */]); - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 3 /* MultiLineCommentTrivia */]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Place a space before open brace in a control flow construct - this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 76 /* DoKeyword */, 97 /* TryKeyword */, 82 /* FinallyKeyword */, 77 /* ElseKeyword */]); - this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 77 /* DoKeyword */, 98 /* TryKeyword */, 83 /* FinallyKeyword */, 78 /* ElseKeyword */]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2 /* Space */), 1 /* CanDeleteNewLines */); // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); - this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14 /* OpenBraceToken */, 15 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2 /* Space */)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8 /* Delete */)); // Insert new line after { and before } in multi-line contexts. - this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(14 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(15 /* OpenBraceToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); // For functions and control block place } on a new line [multi-line rule] - this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 15 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); + this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4 /* NewLine */)); // Special handling of unary operators. // Prefix operators generally shouldn't have a space between // them and their target unary expression. this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(39 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 39 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 40 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(40 /* PlusPlusToken */, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(41 /* MinusMinusToken */, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 40 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(39 /* PlusPlusToken */, 34 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(34 /* PlusToken */, 34 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(34 /* PlusToken */, 39 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* MinusMinusToken */, 35 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* MinusToken */, 35 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* MinusToken */, 40 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); - this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([99 /* VarKeyword */, 95 /* ThrowKeyword */, 89 /* NewKeyword */, 75 /* DeleteKeyword */, 91 /* ReturnKeyword */, 98 /* TypeOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([105 /* LetKeyword */, 71 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); - this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(84 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); - this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(100 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); - this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(91 /* ReturnKeyword */, 22 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(40 /* PlusPlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 35 /* PlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(35 /* PlusToken */, 40 /* PlusPlusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(41 /* MinusMinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 36 /* MinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(36 /* MinusToken */, 41 /* MinusMinusToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 24 /* CommaToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([100 /* VarKeyword */, 96 /* ThrowKeyword */, 90 /* NewKeyword */, 76 /* DeleteKeyword */, 92 /* ReturnKeyword */, 99 /* TypeOfKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterLetConstInVariableDeclaration = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([106 /* LetKeyword */, 72 /* ConstKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsStartOfVariableDeclarationList), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8 /* Delete */)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(85 /* FunctionKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(101 /* VoidKeyword */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2 /* Space */)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(92 /* ReturnKeyword */, 23 /* SemicolonToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] - this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17 /* CloseParenToken */, 76 /* DoKeyword */, 77 /* ElseKeyword */, 68 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 77 /* DoKeyword */, 78 /* ElseKeyword */, 69 /* CaseKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2 /* Space */)); // This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([97 /* TryKeyword */, 82 /* FinallyKeyword */]), 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([98 /* TryKeyword */, 83 /* FinallyKeyword */]), 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([120 /* GetKeyword */, 126 /* SetKeyword */]), 66 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([121 /* GetKeyword */, 127 /* SetKeyword */]), 67 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2 /* Space */)); // TypeScript-specific higher priority rules // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(118 /* ConstructorKeyword */, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(119 /* ConstructorKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([122 /* ModuleKeyword */, 124 /* RequireKeyword */]), 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([123 /* ModuleKeyword */, 125 /* RequireKeyword */]), 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112 /* AbstractKeyword */, 70 /* ClassKeyword */, 119 /* DeclareKeyword */, 74 /* DefaultKeyword */, 78 /* EnumKeyword */, 79 /* ExportKeyword */, 80 /* ExtendsKeyword */, 120 /* GetKeyword */, 103 /* ImplementsKeyword */, 86 /* ImportKeyword */, 104 /* InterfaceKeyword */, 122 /* ModuleKeyword */, 123 /* NamespaceKeyword */, 107 /* PrivateKeyword */, 109 /* PublicKeyword */, 108 /* ProtectedKeyword */, 126 /* SetKeyword */, 110 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([80 /* ExtendsKeyword */, 103 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 71 /* ClassKeyword */, 120 /* DeclareKeyword */, 75 /* DefaultKeyword */, 79 /* EnumKeyword */, 80 /* ExportKeyword */, 81 /* ExtendsKeyword */, 121 /* GetKeyword */, 104 /* ImplementsKeyword */, 87 /* ImportKeyword */, 105 /* InterfaceKeyword */, 123 /* ModuleKeyword */, 124 /* NamespaceKeyword */, 108 /* PrivateKeyword */, 110 /* PublicKeyword */, 109 /* ProtectedKeyword */, 127 /* SetKeyword */, 111 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([81 /* ExtendsKeyword */, 104 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { - this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8 /* StringLiteral */, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(9 /* StringLiteral */, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); // Lambda expressions - this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(33 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(34 /* EqualsGreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Optional parameters and let args - this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21 /* DotDotDotToken */, 66 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(51 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([17 /* CloseParenToken */, 23 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); - // generics - this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); - this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* CloseParenToken */, 24 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); - this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* LessThanToken */, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 26 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); - this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(26 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([16 /* OpenParenToken */, 18 /* OpenBracketToken */, 26 /* GreaterThanToken */, 23 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8 /* Delete */)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(22 /* DotDotDotToken */, 67 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* QuestionToken */, formatting.Shared.TokenRange.FromTokens([18 /* CloseParenToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8 /* Delete */)); + // generics and type assertions + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(18 /* CloseParenToken */, 25 /* LessThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25 /* LessThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 27 /* GreaterThanToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.FromTokens([17 /* OpenParenToken */, 19 /* OpenBracketToken */, 27 /* GreaterThanToken */, 24 /* CommaToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterOrAssertionContext), 8 /* Delete */)); + this.NoSpaceAfterTypeAssertion = new formatting.Rule(formatting.RuleDescriptor.create3(27 /* GreaterThanToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeAssertionContext), 8 /* Delete */)); // Remove spaces in empty interface literals. e.g.: x: {} - this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14 /* OpenBraceToken */, 15 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(15 /* OpenBraceToken */, 16 /* CloseBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8 /* Delete */)); // decorators - this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 53 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(53 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([112 /* AbstractKeyword */, 66 /* Identifier */, 79 /* ExportKeyword */, 74 /* DefaultKeyword */, 70 /* ClassKeyword */, 110 /* StaticKeyword */, 109 /* PublicKeyword */, 107 /* PrivateKeyword */, 108 /* ProtectedKeyword */, 120 /* GetKeyword */, 126 /* SetKeyword */, 18 /* OpenBracketToken */, 36 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); - this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(84 /* FunctionKeyword */, 36 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); - this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(36 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([66 /* Identifier */, 16 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); - this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(111 /* YieldKeyword */, 36 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); - this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([111 /* YieldKeyword */, 36 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); + this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 54 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(54 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([113 /* AbstractKeyword */, 67 /* Identifier */, 80 /* ExportKeyword */, 75 /* DefaultKeyword */, 71 /* ClassKeyword */, 111 /* StaticKeyword */, 110 /* PublicKeyword */, 108 /* PrivateKeyword */, 109 /* ProtectedKeyword */, 121 /* GetKeyword */, 127 /* SetKeyword */, 19 /* OpenBracketToken */, 37 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.NoSpaceBetweenFunctionKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 8 /* Delete */)); + this.SpaceAfterStarInGeneratorDeclaration = new formatting.Rule(formatting.RuleDescriptor.create3(37 /* AsteriskToken */, formatting.Shared.TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclarationOrFunctionExpressionContext), 2 /* Space */)); + this.NoSpaceBetweenYieldKeywordAndStar = new formatting.Rule(formatting.RuleDescriptor.create1(112 /* YieldKeyword */, 37 /* AsteriskToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 8 /* Delete */)); + this.SpaceBetweenYieldOrYieldStarAndOperand = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([112 /* YieldKeyword */, 37 /* AsteriskToken */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsYieldOrYieldStarWithOperand), 2 /* Space */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -38378,6 +39562,7 @@ var ts; this.NoSpaceAfterOpenAngularBracket, this.NoSpaceBeforeCloseAngularBracket, this.NoSpaceAfterCloseAngularBracket, + this.NoSpaceAfterTypeAssertion, this.SpaceBeforeAt, this.NoSpaceAfterAt, this.SpaceAfterDecorator, @@ -38388,8 +39573,8 @@ var ts; this.NoSpaceBeforeSemicolon, this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally @@ -38398,35 +39583,41 @@ var ts; /// Rules controlled by user options /// // Insert space after comma delimiter - this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(24 /* CommaToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Insert space before and after binary operators 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 /* Space */)); 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 /* Space */)); 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 /* Delete */)); 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 /* Delete */)); // Insert space after keywords in control flow statements - this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); - this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2 /* Space */)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8 /* Delete */)); // Open Brace braces after function //TypeScript: Function can have return types, which can be made of tons of different token kinds - this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Open Brace braces after TypeScript module/class/interface - this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Open Brace braces after control block - this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 15 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4 /* NewLine */), 1 /* CanDeleteNewLines */); // Insert space after semicolon in for statement - this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); - this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(22 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2 /* Space */)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(23 /* SemicolonToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8 /* Delete */)); // Insert space after opening and before closing nonempty parenthesis - this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); - this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(16 /* OpenParenToken */, 17 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(16 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(17 /* OpenParenToken */, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(17 /* OpenParenToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18 /* CloseParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + // Insert space after opening and before closing nonempty brackets + this.SpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.NoSpaceBetweenBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(19 /* OpenBracketToken */, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19 /* OpenBracketToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20 /* CloseBracketToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Insert space after function keyword for anonymous functions - this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(84 /* FunctionKeyword */, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); - this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(84 /* FunctionKeyword */, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(85 /* FunctionKeyword */, 17 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8 /* Delete */)); } Rules.prototype.getRuleName = function (rule) { var o = this; @@ -38441,38 +39632,38 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 196 /* ForStatement */; + return context.contextNode.kind === 197 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 178 /* BinaryExpression */: - case 179 /* ConditionalExpression */: - case 186 /* AsExpression */: - case 147 /* TypePredicate */: + case 179 /* BinaryExpression */: + case 180 /* ConditionalExpression */: + case 187 /* AsExpression */: + case 148 /* TypePredicate */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 160 /* BindingElement */: + case 161 /* BindingElement */: // equals in type X = ... - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: // equal in p = 0; - case 135 /* Parameter */: - case 244 /* EnumMember */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - return context.currentTokenSpan.kind === 54 /* EqualsToken */ || context.nextTokenSpan.kind === 54 /* EqualsToken */; + case 136 /* Parameter */: + case 245 /* EnumMember */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + return context.currentTokenSpan.kind === 55 /* EqualsToken */ || context.nextTokenSpan.kind === 55 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 197 /* ForInStatement */: - return context.currentTokenSpan.kind === 87 /* InKeyword */ || context.nextTokenSpan.kind === 87 /* InKeyword */; + case 198 /* ForInStatement */: + return context.currentTokenSpan.kind === 88 /* InKeyword */ || context.nextTokenSpan.kind === 88 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 198 /* ForOfStatement */: - return context.currentTokenSpan.kind === 131 /* OfKeyword */ || context.nextTokenSpan.kind === 131 /* OfKeyword */; + case 199 /* ForOfStatement */: + return context.currentTokenSpan.kind === 132 /* OfKeyword */ || context.nextTokenSpan.kind === 132 /* OfKeyword */; } return false; }; @@ -38480,7 +39671,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 179 /* ConditionalExpression */; + return context.contextNode.kind === 180 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -38524,98 +39715,98 @@ var ts; return true; } switch (node.kind) { - case 189 /* Block */: - case 217 /* CaseBlock */: - case 162 /* ObjectLiteralExpression */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 218 /* CaseBlock */: + case 163 /* ObjectLiteralExpression */: + case 217 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 144 /* CallSignature */: - case 170 /* FunctionExpression */: - case 141 /* Constructor */: - case 171 /* ArrowFunction */: + case 145 /* CallSignature */: + case 171 /* FunctionExpression */: + case 142 /* Constructor */: + case 172 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: return true; } return false; }; Rules.IsFunctionDeclarationOrFunctionExpressionContext = function (context) { - return context.contextNode.kind === 210 /* FunctionDeclaration */ || context.contextNode.kind === 170 /* FunctionExpression */; + return context.contextNode.kind === 211 /* FunctionDeclaration */ || context.contextNode.kind === 171 /* FunctionExpression */; }; Rules.IsTypeScriptDeclWithBlockContext = function (context) { return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 152 /* TypeLiteral */: - case 215 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 153 /* TypeLiteral */: + case 216 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 211 /* ClassDeclaration */: - case 215 /* ModuleDeclaration */: - case 214 /* EnumDeclaration */: - case 189 /* Block */: - case 241 /* CatchClause */: - case 216 /* ModuleBlock */: - case 203 /* SwitchStatement */: + case 212 /* ClassDeclaration */: + case 216 /* ModuleDeclaration */: + case 215 /* EnumDeclaration */: + case 190 /* Block */: + case 242 /* CatchClause */: + case 217 /* ModuleBlock */: + case 204 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 193 /* IfStatement */: - case 203 /* SwitchStatement */: - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 195 /* WhileStatement */: - case 206 /* TryStatement */: - case 194 /* DoStatement */: - case 202 /* WithStatement */: + case 194 /* IfStatement */: + case 204 /* SwitchStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 196 /* WhileStatement */: + case 207 /* TryStatement */: + case 195 /* DoStatement */: + case 203 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 241 /* CatchClause */: + case 242 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 162 /* ObjectLiteralExpression */; + return context.contextNode.kind === 163 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 165 /* CallExpression */; + return context.contextNode.kind === 166 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 166 /* NewExpression */; + return context.contextNode.kind === 167 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); }; Rules.IsPreviousTokenNotComma = function (context) { - return context.currentTokenSpan.kind !== 23 /* CommaToken */; + return context.currentTokenSpan.kind !== 24 /* CommaToken */; }; Rules.IsSameLineTokenContext = function (context) { return context.TokensAreOnSameLine(); @@ -38633,52 +39824,58 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 136 /* Decorator */; + return node.kind === 137 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 209 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 210 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 215 /* ModuleDeclaration */; + return context.contextNode.kind === 216 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 152 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 153 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; - Rules.IsTypeArgumentOrParameter = function (token, parent) { - if (token.kind !== 24 /* LessThanToken */ && token.kind !== 26 /* GreaterThanToken */) { + Rules.IsTypeArgumentOrParameterOrAssertion = function (token, parent) { + if (token.kind !== 25 /* LessThanToken */ && token.kind !== 27 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 148 /* TypeReference */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 149 /* TypeReference */: + case 169 /* TypeAssertionExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 186 /* ExpressionWithTypeArguments */: return true; default: return false; } }; - Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || - Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + Rules.IsTypeArgumentOrParameterOrAssertionContext = function (context) { + return Rules.IsTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); + }; + Rules.IsTypeAssertionContext = function (context) { + return context.contextNode.kind === 169 /* TypeAssertionExpression */; }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 100 /* VoidKeyword */ && context.currentTokenParent.kind === 174 /* VoidExpression */; + return context.currentTokenSpan.kind === 101 /* VoidKeyword */ && context.currentTokenParent.kind === 175 /* VoidExpression */; }; Rules.IsYieldOrYieldStarWithOperand = function (context) { - return context.contextNode.kind === 181 /* YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 182 /* YieldExpression */ && context.contextNode.expression !== undefined; }; return Rules; })(); @@ -38702,7 +39899,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 131 /* LastToken */ + 1; + this.mapRowLength = 132 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); //new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); //new Array(this.map.length); @@ -38897,7 +40094,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 131 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 132 /* LastToken */; token++) { result.push(token); } return result; @@ -38939,17 +40136,17 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(67 /* FirstKeyword */, 131 /* LastKeyword */); - TokenRange.BinaryOperators = TokenRange.FromRange(24 /* FirstBinaryOperator */, 65 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([87 /* InKeyword */, 88 /* InstanceOfKeyword */, 131 /* OfKeyword */, 113 /* AsKeyword */, 121 /* IsKeyword */]); - TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([39 /* PlusPlusToken */, 40 /* MinusMinusToken */, 48 /* TildeToken */, 47 /* ExclamationToken */]); - TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7 /* NumericLiteral */, 66 /* Identifier */, 16 /* OpenParenToken */, 18 /* OpenBracketToken */, 14 /* OpenBraceToken */, 94 /* ThisKeyword */, 89 /* NewKeyword */]); - TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([66 /* Identifier */, 16 /* OpenParenToken */, 94 /* ThisKeyword */, 89 /* NewKeyword */]); - TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([66 /* Identifier */, 17 /* CloseParenToken */, 19 /* CloseBracketToken */, 89 /* NewKeyword */]); - TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([66 /* Identifier */, 16 /* OpenParenToken */, 94 /* ThisKeyword */, 89 /* NewKeyword */]); - TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([66 /* Identifier */, 17 /* CloseParenToken */, 19 /* CloseBracketToken */, 89 /* NewKeyword */]); + TokenRange.Keywords = TokenRange.FromRange(68 /* FirstKeyword */, 132 /* LastKeyword */); + TokenRange.BinaryOperators = TokenRange.FromRange(25 /* FirstBinaryOperator */, 66 /* LastBinaryOperator */); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([88 /* InKeyword */, 89 /* InstanceOfKeyword */, 132 /* OfKeyword */, 114 /* AsKeyword */, 122 /* IsKeyword */]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([40 /* PlusPlusToken */, 41 /* MinusMinusToken */, 49 /* TildeToken */, 48 /* ExclamationToken */]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([8 /* NumericLiteral */, 67 /* Identifier */, 17 /* OpenParenToken */, 19 /* OpenBracketToken */, 15 /* OpenBraceToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 90 /* NewKeyword */]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 17 /* OpenParenToken */, 95 /* ThisKeyword */, 90 /* NewKeyword */]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([67 /* Identifier */, 18 /* CloseParenToken */, 20 /* CloseBracketToken */, 90 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([66 /* Identifier */, 125 /* NumberKeyword */, 127 /* StringKeyword */, 117 /* BooleanKeyword */, 128 /* SymbolKeyword */, 100 /* VoidKeyword */, 114 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([67 /* Identifier */, 126 /* NumberKeyword */, 128 /* StringKeyword */, 118 /* BooleanKeyword */, 129 /* SymbolKeyword */, 101 /* VoidKeyword */, 115 /* AnyKeyword */]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -39027,6 +40224,16 @@ var ts; rules.push(this.globalRules.NoSpaceBeforeCloseParen); rules.push(this.globalRules.NoSpaceBetweenParens); } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets) { + rules.push(this.globalRules.SpaceAfterOpenBracket); + rules.push(this.globalRules.SpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenBracket); + rules.push(this.globalRules.NoSpaceBeforeCloseBracket); + rules.push(this.globalRules.NoSpaceBetweenBrackets); + } if (options.InsertSpaceAfterSemicolonInForStatements) { rules.push(this.globalRules.SpaceAfterSemicolonInFor); } @@ -39085,11 +40292,11 @@ var ts; } formatting.formatOnEnter = formatOnEnter; function formatOnSemicolon(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 22 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */); + return formatOutermostParent(position, 23 /* SemicolonToken */, sourceFile, options, rulesProvider, 3 /* FormatOnSemicolon */); } formatting.formatOnSemicolon = formatOnSemicolon; function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 15 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */); + return formatOutermostParent(position, 16 /* CloseBraceToken */, sourceFile, options, rulesProvider, 4 /* FormatOnClosingCurlyBrace */); } formatting.formatOnClosingCurly = formatOnClosingCurly; function formatDocument(sourceFile, rulesProvider, options) { @@ -39153,17 +40360,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 189 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 245 /* SourceFile */: - case 189 /* Block */: - case 216 /* ModuleBlock */: + return body && body.kind === 190 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 246 /* SourceFile */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -39336,9 +40543,9 @@ var ts; // - source file // - switch\default clauses if (isSomeBlock(parent.kind) || - parent.kind === 245 /* SourceFile */ || - parent.kind === 238 /* CaseClause */ || - parent.kind === 239 /* DefaultClause */) { + parent.kind === 246 /* SourceFile */ || + parent.kind === 239 /* CaseClause */ || + parent.kind === 240 /* DefaultClause */) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -39374,19 +40581,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 211 /* ClassDeclaration */: return 70 /* ClassKeyword */; - case 212 /* InterfaceDeclaration */: return 104 /* InterfaceKeyword */; - case 210 /* FunctionDeclaration */: return 84 /* FunctionKeyword */; - case 214 /* EnumDeclaration */: return 214 /* EnumDeclaration */; - case 142 /* GetAccessor */: return 120 /* GetKeyword */; - case 143 /* SetAccessor */: return 126 /* SetKeyword */; - case 140 /* MethodDeclaration */: + case 212 /* ClassDeclaration */: return 71 /* ClassKeyword */; + case 213 /* InterfaceDeclaration */: return 105 /* InterfaceKeyword */; + case 211 /* FunctionDeclaration */: return 85 /* FunctionKeyword */; + case 215 /* EnumDeclaration */: return 215 /* EnumDeclaration */; + case 143 /* GetAccessor */: return 121 /* GetKeyword */; + case 144 /* SetAccessor */: return 127 /* SetKeyword */; + case 141 /* MethodDeclaration */: if (node.asteriskToken) { - return 36 /* AsteriskToken */; + return 37 /* AsteriskToken */; } // fall-through - case 138 /* PropertyDeclaration */: - case 135 /* Parameter */: + case 139 /* PropertyDeclaration */: + case 136 /* Parameter */: return node.name.kind; } } @@ -39398,8 +40605,8 @@ var ts; // .. { // // comment // } - case 15 /* CloseBraceToken */: - case 19 /* CloseBracketToken */: + case 16 /* CloseBraceToken */: + case 20 /* CloseBracketToken */: return indentation + delta; } return indentation; @@ -39413,15 +40620,15 @@ var ts; } switch (kind) { // open and close brace, 'else' and 'while' (in do statement) tokens has indentation of the parent - case 14 /* OpenBraceToken */: - case 15 /* CloseBraceToken */: - case 18 /* OpenBracketToken */: - case 19 /* CloseBracketToken */: - case 16 /* OpenParenToken */: - case 17 /* CloseParenToken */: - case 77 /* ElseKeyword */: - case 101 /* WhileKeyword */: - case 53 /* AtToken */: + case 15 /* OpenBraceToken */: + case 16 /* CloseBraceToken */: + case 19 /* OpenBracketToken */: + case 20 /* CloseBracketToken */: + case 17 /* OpenParenToken */: + case 18 /* CloseParenToken */: + case 78 /* ElseKeyword */: + case 102 /* WhileKeyword */: + case 54 /* AtToken */: return indentation; default: // if token line equals to the line of containing node (this is a first token in the node) - use node indentation @@ -39468,7 +40675,7 @@ var ts; // if there are any tokens that logically belong to node and interleave child nodes // such tokens will be consumed in processChildNode for for the child that follows them ts.forEachChild(node, function (child) { - processChildNode(child, -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, false); + processChildNode(child, /*inheritedIndentation*/ -1 /* Unknown */, node, nodeDynamicIndentation, nodeStartLine, undecoratedNodeStartLine, /*isListElement*/ false); }, function (nodes) { processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); }); @@ -39521,7 +40728,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 136 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 137 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -39556,7 +40763,7 @@ var ts; var inheritedIndentation = -1 /* Unknown */; for (var _i = 0; _i < nodes.length; _i++) { var child = nodes[_i]; - inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, true); + inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListElement*/ true); } if (listEndToken !== 0 /* Unknown */) { if (formattingScanner.isOnToken()) { @@ -39614,13 +40821,13 @@ var ts; switch (triviaItem.kind) { case 3 /* MultiLineCommentTrivia */: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + indentMultilineComment(triviaItem, commentIndentation, /*firstLineIsIndented*/ !indentNextTokenOrTrivia); indentNextTokenOrTrivia = false; break; case 2 /* SingleLineCommentTrivia */: if (indentNextTokenOrTrivia) { var commentIndentation_1 = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); - insertIndentation(triviaItem.pos, commentIndentation_1, false); + insertIndentation(triviaItem.pos, commentIndentation_1, /*lineAdded*/ false); indentNextTokenOrTrivia = false; } break; @@ -39683,7 +40890,7 @@ var ts; // Handle the case where the next line is moved to be the end of this line. // In this case we don't indent the next line in the next pass. if (currentParent.getStart(sourceFile) === currentItem.pos) { - dynamicIndentation.recomputeIndentation(false); + dynamicIndentation.recomputeIndentation(/*lineAdded*/ false); } } else if (rule.Operation.Action & 4 /* NewLine */ && currentStartLine === previousStartLine) { @@ -39692,7 +40899,7 @@ var ts; // In this case we indent token2 in the next pass but we set // sameLineIndent flag to notify the indenter that the indentation is within the line. if (currentParent.getStart(sourceFile) === currentItem.pos) { - dynamicIndentation.recomputeIndentation(true); + dynamicIndentation.recomputeIndentation(/*lineAdded*/ true); } } // We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line @@ -39732,7 +40939,7 @@ var ts; if (startLine === endLine) { if (!firstLineIsIndented) { // treat as single line comment - insertIndentation(commentRange.pos, indentation, false); + insertIndentation(commentRange.pos, indentation, /*lineAdded*/ false); } return; } @@ -39844,49 +41051,49 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 189 /* Block */: - case 216 /* ModuleBlock */: + case 190 /* Block */: + case 217 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 141 /* Constructor */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 171 /* ArrowFunction */: + case 142 /* Constructor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 172 /* ArrowFunction */: if (node.typeParameters === list) { - return 24 /* LessThanToken */; + return 25 /* LessThanToken */; } else if (node.parameters === list) { - return 16 /* OpenParenToken */; + return 17 /* OpenParenToken */; } break; - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: if (node.typeArguments === list) { - return 24 /* LessThanToken */; + return 25 /* LessThanToken */; } else if (node.arguments === list) { - return 16 /* OpenParenToken */; + return 17 /* OpenParenToken */; } break; - case 148 /* TypeReference */: + case 149 /* TypeReference */: if (node.typeArguments === list) { - return 24 /* LessThanToken */; + return 25 /* LessThanToken */; } } return 0 /* Unknown */; } function getCloseTokenForOpenToken(kind) { switch (kind) { - case 16 /* OpenParenToken */: - return 17 /* CloseParenToken */; - case 24 /* LessThanToken */: - return 26 /* GreaterThanToken */; + case 17 /* OpenParenToken */: + return 18 /* CloseParenToken */; + case 25 /* LessThanToken */: + return 27 /* GreaterThanToken */; } return 0 /* Unknown */; } @@ -39963,17 +41170,17 @@ var ts; return 0; } // no indentation in string \regex\template literals - var precedingTokenIsLiteral = precedingToken.kind === 8 /* StringLiteral */ || - precedingToken.kind === 9 /* RegularExpressionLiteral */ || - precedingToken.kind === 10 /* NoSubstitutionTemplateLiteral */ || - precedingToken.kind === 11 /* TemplateHead */ || - precedingToken.kind === 12 /* TemplateMiddle */ || - precedingToken.kind === 13 /* TemplateTail */; + var precedingTokenIsLiteral = precedingToken.kind === 9 /* StringLiteral */ || + precedingToken.kind === 10 /* RegularExpressionLiteral */ || + precedingToken.kind === 11 /* NoSubstitutionTemplateLiteral */ || + precedingToken.kind === 12 /* TemplateHead */ || + precedingToken.kind === 13 /* TemplateMiddle */ || + precedingToken.kind === 14 /* TemplateTail */; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 23 /* CommaToken */ && precedingToken.parent.kind !== 178 /* BinaryExpression */) { + if (precedingToken.kind === 24 /* CommaToken */ && precedingToken.parent.kind !== 179 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -40013,12 +41220,12 @@ var ts; // no parent was found - return 0 to be indented on the level of SourceFile return 0; } - return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options); + return getIndentationForNodeWorker(current, currentStart, /*ignoreActualIndentationRange*/ 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); + return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } SmartIndenter.getIndentationForNode = getIndentationForNode; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { @@ -40092,7 +41299,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 245 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 246 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -40103,11 +41310,11 @@ var ts; if (!nextToken) { return false; } - if (nextToken.kind === 14 /* OpenBraceToken */) { + if (nextToken.kind === 15 /* OpenBraceToken */) { // open braces are always indented at the parent level return true; } - else if (nextToken.kind === 15 /* CloseBraceToken */) { + else if (nextToken.kind === 16 /* CloseBraceToken */) { // close braces are indented at the parent level if they are located on the same line with cursor // this means that if new line will be added at $ position, this case will be indented // class A { @@ -40125,8 +41332,8 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 193 /* IfStatement */ && parent.elseStatement === child) { - var elseKeyword = ts.findChildOfKind(parent, 77 /* ElseKeyword */, sourceFile); + if (parent.kind === 194 /* IfStatement */ && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 78 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -40137,23 +41344,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 148 /* TypeReference */: + case 149 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 162 /* ObjectLiteralExpression */: + case 163 /* ObjectLiteralExpression */: return node.parent.properties; - case 161 /* ArrayLiteralExpression */: + case 162 /* ArrayLiteralExpression */: return node.parent.elements; - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: { + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -40164,8 +41371,8 @@ var ts; } break; } - case 166 /* NewExpression */: - case 165 /* CallExpression */: { + case 167 /* NewExpression */: + case 166 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -40192,11 +41399,11 @@ var ts; function getLineIndentationWhenExpressionIsInMultiLine(node, sourceFile, options) { // actual indentation should not be used when: // - node is close parenthesis - this is the end of the expression - if (node.kind === 17 /* CloseParenToken */) { + if (node.kind === 18 /* CloseParenToken */) { return -1 /* Unknown */; } - if (node.parent && (node.parent.kind === 165 /* CallExpression */ || - node.parent.kind === 166 /* NewExpression */) && + if (node.parent && (node.parent.kind === 166 /* CallExpression */ || + node.parent.kind === 167 /* NewExpression */) && node.parent.expression !== node) { var fullCallOrNewExpression = node.parent.expression; var startingExpression = getStartingExpression(fullCallOrNewExpression); @@ -40214,10 +41421,10 @@ var ts; function getStartingExpression(node) { while (true) { switch (node.kind) { - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 163 /* PropertyAccessExpression */: - case 164 /* ElementAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 164 /* PropertyAccessExpression */: + case 165 /* ElementAccessExpression */: node = node.expression; break; default: @@ -40234,7 +41441,7 @@ var ts; // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i] var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); for (var i = index - 1; i >= 0; --i) { - if (list[i].kind === 23 /* CommaToken */) { + if (list[i].kind === 24 /* CommaToken */) { continue; } // skip list items that ends on the same line with the current list element @@ -40282,28 +41489,30 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 161 /* ArrayLiteralExpression */: - case 189 /* Block */: - case 216 /* ModuleBlock */: - case 162 /* ObjectLiteralExpression */: - case 152 /* TypeLiteral */: - case 154 /* TupleType */: - case 217 /* CaseBlock */: - case 239 /* DefaultClause */: - case 238 /* CaseClause */: - case 169 /* ParenthesizedExpression */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: - case 190 /* VariableStatement */: - case 208 /* VariableDeclaration */: - case 224 /* ExportAssignment */: - case 201 /* ReturnStatement */: - case 179 /* ConditionalExpression */: - case 159 /* ArrayBindingPattern */: - case 158 /* ObjectBindingPattern */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 162 /* ArrayLiteralExpression */: + case 190 /* Block */: + case 217 /* ModuleBlock */: + case 163 /* ObjectLiteralExpression */: + case 153 /* TypeLiteral */: + case 155 /* TupleType */: + case 218 /* CaseBlock */: + case 240 /* DefaultClause */: + case 239 /* CaseClause */: + case 170 /* ParenthesizedExpression */: + case 164 /* PropertyAccessExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: + case 191 /* VariableStatement */: + case 209 /* VariableDeclaration */: + case 225 /* ExportAssignment */: + case 202 /* ReturnStatement */: + case 180 /* ConditionalExpression */: + case 160 /* ArrayBindingPattern */: + case 159 /* ObjectBindingPattern */: + case 231 /* JsxElement */: return true; } return false; @@ -40313,22 +41522,22 @@ var ts; return true; } switch (parent) { - case 194 /* DoStatement */: - case 195 /* WhileStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 196 /* ForStatement */: - case 193 /* IfStatement */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 144 /* CallSignature */: - case 171 /* ArrowFunction */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - return child !== 189 /* Block */; + case 195 /* DoStatement */: + case 196 /* WhileStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 197 /* ForStatement */: + case 194 /* IfStatement */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 145 /* CallSignature */: + case 172 /* ArrowFunction */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + return child !== 190 /* Block */; default: return false; } @@ -40380,7 +41589,7 @@ var ts; } ScriptSnapshot.fromString = fromString; })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); - var scanner = ts.createScanner(2 /* Latest */, true); + var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ true); var emptyArray = []; function createNode(kind, pos, end, flags, parent) { var node = new (ts.getNodeConstructor(kind))(); @@ -40431,7 +41640,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(268 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); + var list = createNode(269 /* SyntaxList */, nodes.pos, nodes.end, 4096 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -40450,7 +41659,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 132 /* FirstNode */) { + if (this.kind >= 133 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -40492,24 +41701,20 @@ var ts; 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 < 132 /* FirstNode */) { - return child; - } - return child.getFirstToken(sourceFile); + var children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; } + var child = children[0]; + return child.kind < 133 /* FirstNode */ ? child : 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 < 132 /* FirstNode */) { - return child; - } - return child.getLastToken(sourceFile); + var child = ts.lastOrUndefined(children); + if (!child) { + return undefined; } + return child.kind < 133 /* FirstNode */ ? child : child.getLastToken(sourceFile); }; return NodeObject; })(); @@ -40550,15 +41755,15 @@ var ts; var jsDocCommentParts = []; ts.forEach(declarations, function (declaration, indexOfDeclaration) { // Make sure we are collecting doc comment from declaration once, - // In case of union property there might be same declaration multiple times + // In case of union property there might be same declaration multiple times // which only varies in type parameter // Eg. let a: Array | Array; a.length - // The property length will have two declarations of property length coming + // The property length will have two declarations of property length coming // from Array - Array and Array if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 135 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 136 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -40567,15 +41772,15 @@ var ts; }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 215 /* ModuleDeclaration */ && declaration.body.kind === 215 /* ModuleDeclaration */) { + if (declaration.kind === 216 /* ModuleDeclaration */ && declaration.body.kind === 216 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 215 /* ModuleDeclaration */ && declaration.parent.kind === 215 /* ModuleDeclaration */) { + while (declaration.kind === 216 /* ModuleDeclaration */ && declaration.parent.kind === 216 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 208 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 209 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { ts.addRange(jsDocCommentParts, cleanedJsDocComment); @@ -40588,7 +41793,7 @@ var ts; return ts.map(ts.getJsDocComments(node, sourceFile), function (jsDocComment) { return { pos: jsDocComment.pos + "/*".length, - end: jsDocComment.end - "*/".length // Trim off comment end indicator + end: jsDocComment.end - "*/".length // Trim off comment end indicator }; }); } @@ -40690,7 +41895,7 @@ var ts; if (isParamTag(pos, end, sourceFile)) { var blankLineCount = 0; var recordedParamTag = false; - // Consume leading spaces + // Consume leading spaces pos = consumeWhiteSpaces(pos + paramTag.length); if (pos >= end) { break; @@ -40740,7 +41945,7 @@ var ts; var firstLineParamHelpStringPos = pos; while (pos < end) { var ch = sourceFile.text.charCodeAt(pos); - // at line break, set this comment line text and go to next line + // at line break, set this comment line text and go to next line if (ts.isLineBreak(ch)) { if (paramHelpString) { pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); @@ -40793,7 +41998,7 @@ var ts; if (paramHelpStringMargin === undefined) { paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } - // Now consume white spaces max + // Now consume white spaces max var startOfLinePos = pos; pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); if (pos >= end) { @@ -40843,6 +42048,11 @@ var ts; TypeObject.prototype.getNumberIndexType = function () { return this.checker.getIndexTypeOfType(this, 1 /* Number */); }; + TypeObject.prototype.getBaseTypes = function () { + return this.flags & (1024 /* Class */ | 2048 /* Interface */) + ? this.checker.getBaseTypes(this) + : undefined; + }; return TypeObject; })(); var SignatureObject = (function () { @@ -40914,9 +42124,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 133 /* ComputedPropertyName */) { + if (declaration.name.kind === 134 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 163 /* PropertyAccessExpression */) { + if (expr.kind === 164 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -40926,9 +42136,9 @@ var ts; } function getTextOfIdentifierOrLiteral(node) { if (node) { - if (node.kind === 66 /* Identifier */ || - node.kind === 8 /* StringLiteral */ || - node.kind === 7 /* NumericLiteral */) { + if (node.kind === 67 /* Identifier */ || + node.kind === 9 /* StringLiteral */ || + node.kind === 8 /* NumericLiteral */) { return node.text; } } @@ -40936,9 +42146,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -40958,60 +42168,60 @@ var ts; ts.forEachChild(node, visit); } break; - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 214 /* EnumDeclaration */: - case 215 /* ModuleDeclaration */: - case 218 /* ImportEqualsDeclaration */: - case 227 /* ExportSpecifier */: - case 223 /* ImportSpecifier */: - case 218 /* ImportEqualsDeclaration */: - case 220 /* ImportClause */: - case 221 /* NamespaceImport */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 152 /* TypeLiteral */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 215 /* EnumDeclaration */: + case 216 /* ModuleDeclaration */: + case 219 /* ImportEqualsDeclaration */: + case 228 /* ExportSpecifier */: + case 224 /* ImportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 221 /* ImportClause */: + case 222 /* NamespaceImport */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 153 /* TypeLiteral */: addDeclaration(node); // fall through - case 141 /* Constructor */: - case 190 /* VariableStatement */: - case 209 /* VariableDeclarationList */: - case 158 /* ObjectBindingPattern */: - case 159 /* ArrayBindingPattern */: - case 216 /* ModuleBlock */: + case 142 /* Constructor */: + case 191 /* VariableStatement */: + case 210 /* VariableDeclarationList */: + case 159 /* ObjectBindingPattern */: + case 160 /* ArrayBindingPattern */: + case 217 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 189 /* Block */: + case 190 /* Block */: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 135 /* Parameter */: + case 136 /* Parameter */: // Only consider properties defined as constructor parameters if (!(node.flags & 112 /* AccessibilityModifier */)) { break; } // fall through - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 244 /* EnumMember */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 245 /* EnumMember */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: addDeclaration(node); break; - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -41023,7 +42233,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 221 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 222 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -41227,16 +42437,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 170 /* FunctionExpression */) { + if (declaration.kind === 171 /* FunctionExpression */) { return true; } - if (declaration.kind !== 208 /* VariableDeclaration */ && declaration.kind !== 210 /* FunctionDeclaration */) { + if (declaration.kind !== 209 /* VariableDeclaration */ && declaration.kind !== 211 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable - for (var parent_9 = declaration.parent; !ts.isFunctionBlock(parent_9); parent_9 = parent_9.parent) { + for (var parent_8 = declaration.parent; !ts.isFunctionBlock(parent_8); parent_8 = parent_8.parent) { // Reached source file or module block - if (parent_9.kind === 245 /* SourceFile */ || parent_9.kind === 216 /* ModuleBlock */) { + if (parent_8.kind === 246 /* SourceFile */ || parent_8.kind === 217 /* ModuleBlock */) { return false; } } @@ -41253,8 +42463,8 @@ var ts; }; } ts.getDefaultCompilerOptions = getDefaultCompilerOptions; - // Cache host information about scrip Should be refreshed - // at each language service public entry point, since we don't know when + // Cache host information about scrip Should be refreshed + // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. var HostCache = (function () { function HostCache(host, getCanonicalFileName) { @@ -41331,7 +42541,7 @@ var ts; var sourceFile; if (this.currentFileName !== fileName) { // This is a new file, just parse it - sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, true); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2 /* Latest */, version, /*setNodeParents:*/ true); } else if (this.currentFileVersion !== version) { // This is the same file, just a newer version. Incrementally parse the file. @@ -41356,52 +42566,76 @@ var ts; /* * This function will compile source text from 'input' argument using specified compiler options. * If not options are provided - it will use a set of default compiler options. - * Extra compiler options that will unconditionally be used bu this function are: + * Extra compiler options that will unconditionally be used by this function are: * - isolatedModules = true * - allowNonTsExtensions = true * - noLib = true * - noResolve = true */ - function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { - var options = compilerOptions ? ts.clone(compilerOptions) : getDefaultCompilerOptions(); + function transpileModule(input, transpileOptions) { + var options = transpileOptions.compilerOptions ? ts.clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions(); options.isolatedModules = true; // Filename can be non-ts file. options.allowNonTsExtensions = true; - // We are not returning a sourceFile for lib file when asked by the program, + // We are not returning a sourceFile for lib file when asked by the program, // so pass --noLib to avoid reporting a file not found error. options.noLib = true; // We are not doing a full typecheck, we are not resolving the whole context, // so pass --noResolve to avoid reporting missing file errors. options.noResolve = true; // Parse - var inputFileName = fileName || "module.ts"; + var inputFileName = transpileOptions.fileName || "module.ts"; var sourceFile = ts.createSourceFile(inputFileName, input, options.target); - if (moduleName) { - sourceFile.moduleName = moduleName; + if (transpileOptions.moduleName) { + sourceFile.moduleName = transpileOptions.moduleName; } + sourceFile.renamedDependencies = transpileOptions.renamedDependencies; var newLine = ts.getNewLineCharacter(options); // Output var outputText; + var sourceMapText; // Create a compilerHost object to allow the compiler to read and write files var compilerHost = { getSourceFile: function (fileName, target) { return fileName === inputFileName ? sourceFile : undefined; }, writeFile: function (name, text, writeByteOrderMark) { - ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); - outputText = text; + if (ts.fileExtensionIs(name, ".map")) { + ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); + sourceMapText = text; + } + else { + ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name); + outputText = text; + } }, getDefaultLibFileName: function () { return "lib.d.ts"; }, useCaseSensitiveFileNames: function () { return false; }, getCanonicalFileName: function (fileName) { return fileName; }, getCurrentDirectory: function () { return ""; }, - getNewLine: function () { return newLine; } + getNewLine: function () { return newLine; }, + fileExists: function (fileName) { return fileName === inputFileName; }, + readFile: function (fileName) { return ""; } }; var program = ts.createProgram([inputFileName], options, compilerHost); - ts.addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile)); - ts.addRange(diagnostics, program.getOptionsDiagnostics()); + var diagnostics; + if (transpileOptions.reportDiagnostics) { + diagnostics = []; + ts.addRange(/*to*/ diagnostics, /*from*/ program.getSyntacticDiagnostics(sourceFile)); + ts.addRange(/*to*/ diagnostics, /*from*/ program.getOptionsDiagnostics()); + } // Emit program.emit(); ts.Debug.assert(outputText !== undefined, "Output generation failed"); - return outputText; + return { outputText: outputText, diagnostics: diagnostics, sourceMapText: sourceMapText }; + } + ts.transpileModule = transpileModule; + /* + * This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result. + */ + function transpile(input, compilerOptions, fileName, diagnostics, moduleName) { + var output = transpileModule(input, { compilerOptions: compilerOptions, fileName: fileName, reportDiagnostics: !!diagnostics, moduleName: moduleName }); + // addRange correctly handles cases when wither 'from' or 'to' argument is missing + ts.addRange(diagnostics, output.diagnostics); + return output.outputText; } ts.transpile = transpile; function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { @@ -41415,7 +42649,7 @@ var ts; ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; ts.disableIncrementalParsing = false; function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) { - // If we were given a text change range, and our version or open-ness changed, then + // If we were given a text change range, and our version or open-ness changed, then // incrementally parse this file. if (textChangeRange) { if (version !== sourceFile.version) { @@ -41461,7 +42695,7 @@ var ts; } } // Otherwise, just create a new source file. - return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true); + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true); } ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; function createGetCanonicalFileName(useCaseSensitivefileNames) { @@ -41469,13 +42703,14 @@ var ts; ? (function (fileName) { return fileName; }) : (function (fileName) { return fileName.toLowerCase(); }); } + ts.createGetCanonicalFileName = createGetCanonicalFileName; function createDocumentRegistry(useCaseSensitiveFileNames) { // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. var buckets = {}; var getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); function getKeyFromCompilationSettings(settings) { - return "_" + settings.target; // + "|" + settings.propagateEnumConstantoString() + return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx; } function getBucketForCompilationSettings(settings, createIfMissing) { var key = getKeyFromCompilationSettings(settings); @@ -41506,18 +42741,18 @@ var ts; return JSON.stringify(bucketInfoArray, null, 2); } function acquireDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, true); + return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ true); } function updateDocument(fileName, compilationSettings, scriptSnapshot, version) { - return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, false); + return acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, /*acquiring:*/ false); } function acquireOrUpdateDocument(fileName, compilationSettings, scriptSnapshot, version, acquiring) { - var bucket = getBucketForCompilationSettings(compilationSettings, true); + var bucket = getBucketForCompilationSettings(compilationSettings, /*createIfMissing*/ true); var entry = bucket.get(fileName); if (!entry) { ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); // Have never seen this file with these settings. Create a new source file for it. - var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false); + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, /*setNodeParents:*/ false); entry = { sourceFile: sourceFile, languageServiceRefCount: 0, @@ -41526,7 +42761,7 @@ var ts; bucket.set(fileName, entry); } else { - // We have an entry for this file. However, it may be for a different version of + // We have an entry for this file. However, it may be for a different version of // the script snapshot. If so, update it appropriately. Otherwise, we can just // return it as is. if (entry.sourceFile.version !== version) { @@ -41565,6 +42800,7 @@ var ts; if (readImportFiles === void 0) { readImportFiles = true; } var referencedFiles = []; var importedFiles = []; + var ambientExternalModules; var isNoDefaultLib = false; function processTripleSlashDirectives() { var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); @@ -41580,6 +42816,12 @@ var ts; } }); } + function recordAmbientExternalModule() { + if (!ambientExternalModules) { + ambientExternalModules = []; + } + ambientExternalModules.push(scanner.getTokenValue()); + } function recordModuleName() { var importPath = scanner.getTokenValue(); var pos = scanner.getTokenPos(); @@ -41603,31 +42845,42 @@ var ts; // export * from "mod" // export {a as b} from "mod" while (token !== 1 /* EndOfFileToken */) { - if (token === 86 /* ImportKeyword */) { + if (token === 120 /* DeclareKeyword */) { + // declare module "mod" token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 123 /* ModuleKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { + recordAmbientExternalModule(); + continue; + } + } + } + else if (token === 87 /* ImportKeyword */) { + token = scanner.scan(); + if (token === 9 /* StringLiteral */) { // import "mod"; recordModuleName(); continue; } else { - if (token === 66 /* Identifier */) { + if (token === 67 /* Identifier */ || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // import d from "mod"; recordModuleName(); continue; } } - else if (token === 54 /* EqualsToken */) { + else if (token === 55 /* EqualsToken */) { token = scanner.scan(); - if (token === 124 /* RequireKeyword */) { + if (token === 125 /* RequireKeyword */) { token = scanner.scan(); - if (token === 16 /* OpenParenToken */) { + if (token === 17 /* OpenParenToken */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // import i = require("mod"); recordModuleName(); continue; @@ -41635,7 +42888,7 @@ var ts; } } } - else if (token === 23 /* CommaToken */) { + else if (token === 24 /* CommaToken */) { // consume comma and keep going token = scanner.scan(); } @@ -41644,17 +42897,17 @@ var ts; continue; } } - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { token = scanner.scan(); // consume "{ a as B, c, d as D}" clauses - while (token !== 15 /* CloseBraceToken */) { + while (token !== 16 /* CloseBraceToken */) { token = scanner.scan(); } - if (token === 15 /* CloseBraceToken */) { + if (token === 16 /* CloseBraceToken */) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // import {a as A} from "mod"; // import d, {a, b as B} from "mod" recordModuleName(); @@ -41662,15 +42915,15 @@ var ts; } } } - else if (token === 36 /* AsteriskToken */) { + else if (token === 37 /* AsteriskToken */) { token = scanner.scan(); - if (token === 113 /* AsKeyword */) { + if (token === 114 /* AsKeyword */) { token = scanner.scan(); - if (token === 66 /* Identifier */) { + if (token === 67 /* Identifier */ || ts.isKeyword(token)) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // import * as NS from "mod" // import d, * as NS from "mod" recordModuleName(); @@ -41681,19 +42934,19 @@ var ts; } } } - else if (token === 79 /* ExportKeyword */) { + else if (token === 80 /* ExportKeyword */) { token = scanner.scan(); - if (token === 14 /* OpenBraceToken */) { + if (token === 15 /* OpenBraceToken */) { token = scanner.scan(); // consume "{ a as B, c, d as D}" clauses - while (token !== 15 /* CloseBraceToken */) { + while (token !== 16 /* CloseBraceToken */) { token = scanner.scan(); } - if (token === 15 /* CloseBraceToken */) { + if (token === 16 /* CloseBraceToken */) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // export {a as A} from "mod"; // export {a, b as B} from "mod" recordModuleName(); @@ -41701,11 +42954,11 @@ var ts; } } } - else if (token === 36 /* AsteriskToken */) { + else if (token === 37 /* AsteriskToken */) { token = scanner.scan(); - if (token === 130 /* FromKeyword */) { + if (token === 131 /* FromKeyword */) { token = scanner.scan(); - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // export * from "mod" recordModuleName(); } @@ -41720,13 +42973,13 @@ var ts; processImport(); } processTripleSlashDirectives(); - return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules: ambientExternalModules }; } ts.preProcessFile = preProcessFile; /// Helpers function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 204 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 205 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -41734,13 +42987,13 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 66 /* Identifier */ && - (node.parent.kind === 200 /* BreakStatement */ || node.parent.kind === 199 /* ContinueStatement */) && + return node.kind === 67 /* Identifier */ && + (node.parent.kind === 201 /* BreakStatement */ || node.parent.kind === 200 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 66 /* Identifier */ && - node.parent.kind === 204 /* LabeledStatement */ && + return node.kind === 67 /* Identifier */ && + node.parent.kind === 205 /* LabeledStatement */ && node.parent.label === node; } /** @@ -41748,7 +43001,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 204 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 205 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -41759,56 +43012,56 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 132 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 163 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 164 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 165 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 166 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 166 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 167 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 215 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 216 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 66 /* Identifier */ && + return node.kind === 67 /* Identifier */ && ts.isFunctionLike(node.parent) && node.parent.name === node; } /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node) { - return (node.kind === 66 /* Identifier */ || node.kind === 8 /* StringLiteral */ || node.kind === 7 /* NumericLiteral */) && - (node.parent.kind === 242 /* PropertyAssignment */ || node.parent.kind === 243 /* ShorthandPropertyAssignment */) && node.parent.name === node; + return (node.kind === 67 /* Identifier */ || node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) && + (node.parent.kind === 243 /* PropertyAssignment */ || node.parent.kind === 244 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { - if (node.kind === 8 /* StringLiteral */ || node.kind === 7 /* NumericLiteral */) { + if (node.kind === 9 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) { switch (node.parent.kind) { - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 242 /* PropertyAssignment */: - case 244 /* EnumMember */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 215 /* ModuleDeclaration */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 243 /* PropertyAssignment */: + case 245 /* EnumMember */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 216 /* ModuleDeclaration */: return node.parent.name === node; - case 164 /* ElementAccessExpression */: + case 165 /* ElementAccessExpression */: return node.parent.argumentExpression === node; } } return false; } function isNameOfExternalModuleImportOrDeclaration(node) { - if (node.kind === 8 /* StringLiteral */) { + if (node.kind === 9 /* StringLiteral */) { return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } @@ -41860,7 +43113,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 67 /* FirstKeyword */; i <= 131 /* LastKeyword */; i++) { + for (var i = 68 /* FirstKeyword */; i <= 132 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -41875,17 +43128,17 @@ var ts; return undefined; } switch (node.kind) { - case 245 /* SourceFile */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 214 /* EnumDeclaration */: - case 215 /* ModuleDeclaration */: + case 246 /* SourceFile */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 215 /* EnumDeclaration */: + case 216 /* ModuleDeclaration */: return node; } } @@ -41893,38 +43146,38 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 215 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 211 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 212 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 213 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 214 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 208 /* VariableDeclaration */: + case 216 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 212 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 213 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 214 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 215 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 209 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 210 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 142 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 143 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 211 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 143 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 144 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 146 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 145 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 144 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 141 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 134 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 244 /* EnumMember */: return ScriptElementKind.variableElement; - case 135 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 218 /* ImportEqualsDeclaration */: - case 223 /* ImportSpecifier */: - case 220 /* ImportClause */: - case 227 /* ExportSpecifier */: - case 221 /* NamespaceImport */: + case 147 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 146 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 145 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 142 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 135 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 245 /* EnumMember */: return ScriptElementKind.variableElement; + case 136 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 219 /* ImportEqualsDeclaration */: + case 224 /* ImportSpecifier */: + case 221 /* ImportClause */: + case 228 /* ExportSpecifier */: + case 222 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -41995,26 +43248,44 @@ var ts; if (programUpToDate()) { return; } - // IMPORTANT - It is critical from this moment onward that we do not check + // IMPORTANT - It is critical from this moment onward that we do not check // cancellation tokens. We are about to mutate source files from a previous program // instance. If we cancel midway through, we may end up in an inconsistent state where - // the program points to old source files that have been invalidated because of + // the program points to old source files that have been invalidated because of // incremental parsing. var oldSettings = program && program.getCompilerOptions(); var newSettings = hostCache.compilationSettings(); - var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; + var changesInCompilationSettingsAffectSyntax = oldSettings && + (oldSettings.target !== newSettings.target || + oldSettings.module !== newSettings.module || + oldSettings.noResolve !== newSettings.noResolve || + oldSettings.jsx !== newSettings.jsx); // Now create a new compiler - var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { + var compilerHost = { getSourceFile: getOrCreateSourceFile, getCancellationToken: function () { return cancellationToken; }, getCanonicalFileName: getCanonicalFileName, useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, - getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, + getNewLine: function () { return ts.getNewLineOrDefaultFromHost(host); }, getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, writeFile: function (fileName, data, writeByteOrderMark) { }, - getCurrentDirectory: function () { return host.getCurrentDirectory(); } - }); - // Release any files we have acquired in the old program but are + getCurrentDirectory: function () { return host.getCurrentDirectory(); }, + fileExists: function (fileName) { + // stub missing host functionality + ts.Debug.assert(!host.resolveModuleNames); + return hostCache.getOrCreateEntry(fileName) !== undefined; + }, + readFile: function (fileName) { + // stub missing host functionality + var entry = hostCache.getOrCreateEntry(fileName); + return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + } + }; + if (host.resolveModuleNames) { + compilerHost.resolveModuleNames = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile); }; + } + var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); + // Release any files we have acquired in the old program but are // not part of the new program. if (program) { var oldSourceFiles = program.getSourceFiles(); @@ -42030,7 +43301,7 @@ var ts; // It needs to be cleared to allow all collected snapshots to be released hostCache = undefined; program = newProgram; - // Make sure all the nodes in the program are both bound, and have their parent + // Make sure all the nodes in the program are both bound, and have their parent // pointers set property. program.getTypeChecker(); return; @@ -42050,7 +43321,7 @@ var ts; // Check if the old program had this file already var oldSourceFile = program && program.getSourceFile(fileName); if (oldSourceFile) { - // We already had a source file for this file name. Go to the registry to + // We already had a source file for this file name. Go to the registry to // ensure that we get the right up to date version of it. We need this to // address the following 'race'. Specifically, say we have the following: // @@ -42061,15 +43332,15 @@ var ts; // LS2 // // Each LS has a reference to file 'foo.ts' at version 1. LS2 then updates - // it's version of 'foo.ts' to version 2. This will cause LS2 and the - // DocumentRegistry to have version 2 of the document. HOwever, LS1 will + // it's version of 'foo.ts' to version 2. This will cause LS2 and the + // DocumentRegistry to have version 2 of the document. HOwever, LS1 will // have version 1. And *importantly* this source file will be *corrupt*. // The act of creating version 2 of the file irrevocably damages the version // 1 file. // // So, later when we call into LS1, we need to make sure that it doesn't use // it's source file any more, and instead defers to DocumentRegistry to get - // either version 1, version 2 (or some other version) depending on what the + // either version 1, version 2 (or some other version) depending on what the // host says should be used. return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } @@ -42128,7 +43399,7 @@ var ts; synchronizeHostData(); var targetSourceFile = getValidSourceFile(fileName); // For JavaScript files, we don't want to report the normal typescript semantic errors. - // Instead, we just report errors for using TypeScript-only constructs from within a + // Instead, we just report errors for using TypeScript-only constructs from within a // JavaScript file. if (ts.isJavaScript(fileName)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); @@ -42152,44 +43423,44 @@ var ts; return false; } switch (node.kind) { - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 240 /* HeritageClause */: + case 241 /* HeritageClause */: var heritageClause = node; - if (heritageClause.token === 103 /* ImplementsKeyword */) { + if (heritageClause.token === 104 /* ImplementsKeyword */) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 213 /* TypeAliasDeclaration */: + case 214 /* TypeAliasDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: - case 210 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -42197,20 +43468,20 @@ var ts; return true; } break; - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 208 /* VariableDeclaration */: + case 209 /* VariableDeclaration */: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -42218,7 +43489,7 @@ var ts; return true; } break; - case 135 /* Parameter */: + case 136 /* Parameter */: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -42234,17 +43505,17 @@ var ts; return true; } break; - case 138 /* PropertyDeclaration */: + case 139 /* PropertyDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 168 /* TypeAssertionExpression */: + case 169 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 136 /* Decorator */: + case 137 /* Decorator */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -42270,18 +43541,18 @@ var ts; for (var _i = 0; _i < modifiers.length; _i++) { var modifier = modifiers[_i]; switch (modifier.kind) { - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - case 119 /* DeclareKeyword */: + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + case 120 /* DeclareKeyword */: diagnostics.push(ts.createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind))); return true; // These are all legal modifiers. - case 110 /* StaticKeyword */: - case 79 /* ExportKeyword */: - case 71 /* ConstKeyword */: - case 74 /* DefaultKeyword */: - case 112 /* AbstractKeyword */: + case 111 /* StaticKeyword */: + case 80 /* ExportKeyword */: + case 72 /* ConstKeyword */: + case 75 /* DefaultKeyword */: + case 113 /* AbstractKeyword */: } } } @@ -42380,13 +43651,13 @@ var ts; log("Returning an empty list because completion was requested in an invalid position."); return undefined; } - var parent_10 = contextToken.parent, kind = contextToken.kind; - if (kind === 20 /* DotToken */) { - if (parent_10.kind === 163 /* PropertyAccessExpression */) { + var parent_9 = contextToken.parent, kind = contextToken.kind; + if (kind === 21 /* DotToken */) { + if (parent_9.kind === 164 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (parent_10.kind === 132 /* QualifiedName */) { + else if (parent_9.kind === 133 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -42396,7 +43667,7 @@ var ts; return undefined; } } - else if (kind === 24 /* LessThanToken */ && sourceFile.languageVariant === 1 /* JSX */) { + else if (kind === 25 /* LessThanToken */ && sourceFile.languageVariant === 1 /* JSX */) { isRightOfOpenTag = true; location = contextToken; } @@ -42433,7 +43704,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 66 /* Identifier */ || node.kind === 132 /* QualifiedName */ || node.kind === 163 /* PropertyAccessExpression */) { + if (node.kind === 67 /* Identifier */ || node.kind === 133 /* QualifiedName */ || node.kind === 164 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -42462,7 +43733,7 @@ var ts; } } if (isJavaScriptFile && type.flags & 16384 /* Union */) { - // In javascript files, for union types, we don't just get the members that + // In javascript files, for union types, we don't just get the members that // the individual types have in common, we also include all the members that // each individual type has. This is because we're going to add all identifiers // anyways. So we might as well elevate the members that were at least part @@ -42489,7 +43760,7 @@ var ts; } if (jsxContainer = tryGetContainingJsxElement(contextToken)) { var attrsType; - if ((jsxContainer.kind === 231 /* JsxSelfClosingElement */) || (jsxContainer.kind === 232 /* JsxOpeningElement */)) { + if ((jsxContainer.kind === 232 /* JsxSelfClosingElement */) || (jsxContainer.kind === 233 /* JsxOpeningElement */)) { // Cursor is inside a JSX self-closing element or opening element attrsType = typeChecker.getJsxElementAttributesType(jsxContainer); if (attrsType) { @@ -42510,10 +43781,10 @@ var ts; // aggregating completion candidates. This is achieved in 'getScopeNode' // by finding the first node that encompasses a position, accounting for whether a node // is "complete" to decide whether a position belongs to the node. - // + // // However, at the end of an identifier, we are interested in the scope of the identifier // itself, but fall outside of the identifier. For instance: - // + // // xyz => x$ // // the cursor is outside of both the 'x' and the arrow function 'xyz => x', @@ -42563,41 +43834,41 @@ var ts; if (previousToken) { var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { - case 23 /* CommaToken */: - return containingNodeKind === 165 /* CallExpression */ // func( a, | - || containingNodeKind === 141 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 166 /* NewExpression */ // new C(a, | - || containingNodeKind === 161 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 178 /* BinaryExpression */ // let x = (a, | - || containingNodeKind === 149 /* FunctionType */; // var x: (s: string, list| - case 16 /* OpenParenToken */: - return containingNodeKind === 165 /* CallExpression */ // func( | - || containingNodeKind === 141 /* Constructor */ // constructor( | - || containingNodeKind === 166 /* NewExpression */ // new C(a| - || containingNodeKind === 169 /* ParenthesizedExpression */ // let x = (a| - || containingNodeKind === 157 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ - case 18 /* OpenBracketToken */: - return containingNodeKind === 161 /* ArrayLiteralExpression */ // [ | - || containingNodeKind === 146 /* IndexSignature */ // [ | : string ] - || containingNodeKind === 133 /* ComputedPropertyName */; // [ | /* this can become an index signature */ - case 122 /* ModuleKeyword */: // module | - case 123 /* NamespaceKeyword */: + case 24 /* CommaToken */: + return containingNodeKind === 166 /* CallExpression */ // func( a, | + || containingNodeKind === 142 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 167 /* NewExpression */ // new C(a, | + || containingNodeKind === 162 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 179 /* BinaryExpression */ // let x = (a, | + || containingNodeKind === 150 /* FunctionType */; // var x: (s: string, list| + case 17 /* OpenParenToken */: + return containingNodeKind === 166 /* CallExpression */ // func( | + || containingNodeKind === 142 /* Constructor */ // constructor( | + || containingNodeKind === 167 /* NewExpression */ // new C(a| + || containingNodeKind === 170 /* ParenthesizedExpression */ // let x = (a| + || containingNodeKind === 158 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + case 19 /* OpenBracketToken */: + return containingNodeKind === 162 /* ArrayLiteralExpression */ // [ | + || containingNodeKind === 147 /* IndexSignature */ // [ | : string ] + || containingNodeKind === 134 /* ComputedPropertyName */; // [ | /* this can become an index signature */ + case 123 /* ModuleKeyword */: // module | + case 124 /* NamespaceKeyword */: return true; - case 20 /* DotToken */: - return containingNodeKind === 215 /* ModuleDeclaration */; // module A.| - case 14 /* OpenBraceToken */: - return containingNodeKind === 211 /* ClassDeclaration */; // class A{ | - case 54 /* EqualsToken */: - return containingNodeKind === 208 /* VariableDeclaration */ // let x = a| - || containingNodeKind === 178 /* BinaryExpression */; // x = a| - case 11 /* TemplateHead */: - return containingNodeKind === 180 /* TemplateExpression */; // `aa ${| - case 12 /* TemplateMiddle */: - return containingNodeKind === 187 /* TemplateSpan */; // `aa ${10} dd ${| - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - return containingNodeKind === 138 /* PropertyDeclaration */; // class A{ public | + case 21 /* DotToken */: + return containingNodeKind === 216 /* ModuleDeclaration */; // module A.| + case 15 /* OpenBraceToken */: + return containingNodeKind === 212 /* ClassDeclaration */; // class A{ | + case 55 /* EqualsToken */: + return containingNodeKind === 209 /* VariableDeclaration */ // let x = a| + || containingNodeKind === 179 /* BinaryExpression */; // x = a| + case 12 /* TemplateHead */: + return containingNodeKind === 181 /* TemplateExpression */; // `aa ${| + case 13 /* TemplateMiddle */: + return containingNodeKind === 188 /* TemplateSpan */; // `aa ${10} dd ${| + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + return containingNodeKind === 139 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -42610,8 +43881,8 @@ var ts; return false; } function isInStringOrRegularExpressionOrTemplateLiteral(contextToken) { - if (contextToken.kind === 8 /* StringLiteral */ - || contextToken.kind === 9 /* RegularExpressionLiteral */ + if (contextToken.kind === 9 /* StringLiteral */ + || contextToken.kind === 10 /* RegularExpressionLiteral */ || ts.isTemplateLiteralKind(contextToken.kind)) { var start_3 = contextToken.getStart(); var end = contextToken.getEnd(); @@ -42624,7 +43895,7 @@ var ts; } if (position === end) { return !!contextToken.isUnterminated - || contextToken.kind === 9 /* RegularExpressionLiteral */; + || contextToken.kind === 10 /* RegularExpressionLiteral */; } } return false; @@ -42640,18 +43911,29 @@ var ts; isMemberCompletion = true; var typeForObject; var existingMembers; - if (objectLikeContainer.kind === 162 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 163 /* ObjectLiteralExpression */) { // We are completing on contextual types, but may also include properties // other than those within the declared type. isNewIdentifierLocation = true; typeForObject = typeChecker.getContextualType(objectLikeContainer); existingMembers = objectLikeContainer.properties; } - else if (objectLikeContainer.kind === 158 /* ObjectBindingPattern */) { + else if (objectLikeContainer.kind === 159 /* ObjectBindingPattern */) { // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; - typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); - existingMembers = objectLikeContainer.elements; + var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); + if (ts.isVariableLike(rootDeclaration)) { + // We don't want to complete using the type acquired by the shape + // of the binding pattern; we are only interested in types acquired + // through type declaration or inference. + if (rootDeclaration.initializer || rootDeclaration.type) { + typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); + existingMembers = objectLikeContainer.elements; + } + } + else { + ts.Debug.fail("Root declaration is not variable-like."); + } } else { ts.Debug.fail("Expected object literal or binding pattern, got " + objectLikeContainer.kind); @@ -42682,9 +43964,9 @@ var ts; * @returns true if 'symbols' was successfully populated; false otherwise. */ function tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports) { - var declarationKind = namedImportsOrExports.kind === 222 /* NamedImports */ ? - 219 /* ImportDeclaration */ : - 225 /* ExportDeclaration */; + var declarationKind = namedImportsOrExports.kind === 223 /* NamedImports */ ? + 220 /* ImportDeclaration */ : + 226 /* ExportDeclaration */; var importOrExportDeclaration = ts.getAncestor(namedImportsOrExports, declarationKind); var moduleSpecifier = importOrExportDeclaration.moduleSpecifier; if (!moduleSpecifier) { @@ -42707,11 +43989,11 @@ var ts; function tryGetObjectLikeCompletionContainer(contextToken) { if (contextToken) { switch (contextToken.kind) { - case 14 /* OpenBraceToken */: // let x = { | - case 23 /* CommaToken */: - var parent_11 = contextToken.parent; - if (parent_11 && (parent_11.kind === 162 /* ObjectLiteralExpression */ || parent_11.kind === 158 /* ObjectBindingPattern */)) { - return parent_11; + case 15 /* OpenBraceToken */: // let x = { | + case 24 /* CommaToken */: + var parent_10 = contextToken.parent; + if (parent_10 && (parent_10.kind === 163 /* ObjectLiteralExpression */ || parent_10.kind === 159 /* ObjectBindingPattern */)) { + return parent_10; } break; } @@ -42725,11 +44007,11 @@ var ts; function tryGetNamedImportsOrExportsForCompletion(contextToken) { if (contextToken) { switch (contextToken.kind) { - case 14 /* OpenBraceToken */: // import { | - case 23 /* CommaToken */: + case 15 /* OpenBraceToken */: // import { | + case 24 /* CommaToken */: switch (contextToken.parent.kind) { - case 222 /* NamedImports */: - case 226 /* NamedExports */: + case 223 /* NamedImports */: + case 227 /* NamedExports */: return contextToken.parent; } } @@ -42738,24 +44020,34 @@ var ts; } function tryGetContainingJsxElement(contextToken) { if (contextToken) { - var parent_12 = contextToken.parent; + var parent_11 = contextToken.parent; switch (contextToken.kind) { - case 25 /* LessThanSlashToken */: - case 37 /* SlashToken */: - case 66 /* Identifier */: - if (parent_12 && (parent_12.kind === 231 /* JsxSelfClosingElement */ || parent_12.kind === 232 /* JsxOpeningElement */)) { - return parent_12; + case 26 /* LessThanSlashToken */: + case 38 /* SlashToken */: + case 67 /* Identifier */: + case 236 /* JsxAttribute */: + case 237 /* JsxSpreadAttribute */: + if (parent_11 && (parent_11.kind === 232 /* JsxSelfClosingElement */ || parent_11.kind === 233 /* JsxOpeningElement */)) { + return parent_11; + } + break; + // The context token is the closing } or " of an attribute, which means + // its parent is a JsxExpression, whose parent is a JsxAttribute, + // whose parent is a JsxOpeningLikeElement + case 9 /* StringLiteral */: + if (parent_11 && ((parent_11.kind === 236 /* JsxAttribute */) || (parent_11.kind === 237 /* JsxSpreadAttribute */))) { + return parent_11.parent; } break; - case 15 /* CloseBraceToken */: - // The context token is the closing } of an attribute, which means - // its parent is a JsxExpression, whose parent is a JsxAttribute, - // whose parent is a JsxOpeningLikeElement - if (parent_12 && - parent_12.kind === 237 /* JsxExpression */ && - parent_12.parent && - parent_12.parent.kind === 235 /* JsxAttribute */) { - return parent_12.parent.parent; + case 16 /* CloseBraceToken */: + if (parent_11 && + parent_11.kind === 238 /* JsxExpression */ && + parent_11.parent && + (parent_11.parent.kind === 236 /* JsxAttribute */)) { + return parent_11.parent.parent; + } + if (parent_11 && parent_11.kind === 237 /* JsxSpreadAttribute */) { + return parent_11.parent; } break; } @@ -42764,16 +44056,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 144 /* CallSignature */: - case 145 /* ConstructSignature */: - case 146 /* IndexSignature */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 145 /* CallSignature */: + case 146 /* ConstructSignature */: + case 147 /* IndexSignature */: return true; } return false; @@ -42784,65 +44076,65 @@ var ts; function isSolelyIdentifierDefinitionLocation(contextToken) { var containingNodeKind = contextToken.parent.kind; switch (contextToken.kind) { - case 23 /* CommaToken */: - return containingNodeKind === 208 /* VariableDeclaration */ || - containingNodeKind === 209 /* VariableDeclarationList */ || - containingNodeKind === 190 /* VariableStatement */ || - containingNodeKind === 214 /* EnumDeclaration */ || + case 24 /* CommaToken */: + return containingNodeKind === 209 /* VariableDeclaration */ || + containingNodeKind === 210 /* VariableDeclarationList */ || + containingNodeKind === 191 /* VariableStatement */ || + containingNodeKind === 215 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 211 /* ClassDeclaration */ || - containingNodeKind === 210 /* FunctionDeclaration */ || - containingNodeKind === 212 /* InterfaceDeclaration */ || - containingNodeKind === 159 /* ArrayBindingPattern */; // var [x, y| - case 20 /* DotToken */: - return containingNodeKind === 159 /* ArrayBindingPattern */; // var [.| - case 52 /* ColonToken */: - return containingNodeKind === 160 /* BindingElement */; // var {x :html| - case 18 /* OpenBracketToken */: - return containingNodeKind === 159 /* ArrayBindingPattern */; // var [x| - case 16 /* OpenParenToken */: - return containingNodeKind === 241 /* CatchClause */ || + containingNodeKind === 212 /* ClassDeclaration */ || + containingNodeKind === 211 /* FunctionDeclaration */ || + containingNodeKind === 213 /* InterfaceDeclaration */ || + containingNodeKind === 160 /* ArrayBindingPattern */; // var [x, y| + case 21 /* DotToken */: + return containingNodeKind === 160 /* ArrayBindingPattern */; // var [.| + case 53 /* ColonToken */: + return containingNodeKind === 161 /* BindingElement */; // var {x :html| + case 19 /* OpenBracketToken */: + return containingNodeKind === 160 /* ArrayBindingPattern */; // var [x| + case 17 /* OpenParenToken */: + return containingNodeKind === 242 /* CatchClause */ || isFunction(containingNodeKind); - case 14 /* OpenBraceToken */: - return containingNodeKind === 214 /* EnumDeclaration */ || - containingNodeKind === 212 /* InterfaceDeclaration */ || - containingNodeKind === 152 /* TypeLiteral */; // let x : { | - case 22 /* SemicolonToken */: - return containingNodeKind === 137 /* PropertySignature */ && + case 15 /* OpenBraceToken */: + return containingNodeKind === 215 /* EnumDeclaration */ || + containingNodeKind === 213 /* InterfaceDeclaration */ || + containingNodeKind === 153 /* TypeLiteral */; // let x : { | + case 23 /* SemicolonToken */: + return containingNodeKind === 138 /* PropertySignature */ && contextToken.parent && contextToken.parent.parent && - (contextToken.parent.parent.kind === 212 /* InterfaceDeclaration */ || - contextToken.parent.parent.kind === 152 /* TypeLiteral */); // let x : { a; | - case 24 /* LessThanToken */: - return containingNodeKind === 211 /* ClassDeclaration */ || - containingNodeKind === 210 /* FunctionDeclaration */ || - containingNodeKind === 212 /* InterfaceDeclaration */ || + (contextToken.parent.parent.kind === 213 /* InterfaceDeclaration */ || + contextToken.parent.parent.kind === 153 /* TypeLiteral */); // let x : { a; | + case 25 /* LessThanToken */: + return containingNodeKind === 212 /* ClassDeclaration */ || + containingNodeKind === 211 /* FunctionDeclaration */ || + containingNodeKind === 213 /* InterfaceDeclaration */ || isFunction(containingNodeKind); - case 110 /* StaticKeyword */: - return containingNodeKind === 138 /* PropertyDeclaration */; - case 21 /* DotDotDotToken */: - return containingNodeKind === 135 /* Parameter */ || + case 111 /* StaticKeyword */: + return containingNodeKind === 139 /* PropertyDeclaration */; + case 22 /* DotDotDotToken */: + return containingNodeKind === 136 /* Parameter */ || (contextToken.parent && contextToken.parent.parent && - contextToken.parent.parent.kind === 159 /* ArrayBindingPattern */); // var [...z| - case 109 /* PublicKeyword */: - case 107 /* PrivateKeyword */: - case 108 /* ProtectedKeyword */: - return containingNodeKind === 135 /* Parameter */; - case 113 /* AsKeyword */: - containingNodeKind === 223 /* ImportSpecifier */ || - containingNodeKind === 227 /* ExportSpecifier */ || - containingNodeKind === 221 /* NamespaceImport */; - case 70 /* ClassKeyword */: - case 78 /* EnumKeyword */: - case 104 /* InterfaceKeyword */: - case 84 /* FunctionKeyword */: - case 99 /* VarKeyword */: - case 120 /* GetKeyword */: - case 126 /* SetKeyword */: - case 86 /* ImportKeyword */: - case 105 /* LetKeyword */: - case 71 /* ConstKeyword */: - case 111 /* YieldKeyword */: - case 129 /* TypeKeyword */: + contextToken.parent.parent.kind === 160 /* ArrayBindingPattern */); // var [...z| + case 110 /* PublicKeyword */: + case 108 /* PrivateKeyword */: + case 109 /* ProtectedKeyword */: + return containingNodeKind === 136 /* Parameter */; + case 114 /* AsKeyword */: + containingNodeKind === 224 /* ImportSpecifier */ || + containingNodeKind === 228 /* ExportSpecifier */ || + containingNodeKind === 222 /* NamespaceImport */; + case 71 /* ClassKeyword */: + case 79 /* EnumKeyword */: + case 105 /* InterfaceKeyword */: + case 85 /* FunctionKeyword */: + case 100 /* VarKeyword */: + case 121 /* GetKeyword */: + case 127 /* SetKeyword */: + case 87 /* ImportKeyword */: + case 106 /* LetKeyword */: + case 72 /* ConstKeyword */: + case 112 /* YieldKeyword */: + case 130 /* TypeKeyword */: return true; } // Previous token may have been a keyword that was converted to an identifier. @@ -42861,7 +44153,7 @@ var ts; return false; } function isDotOfNumericLiteral(contextToken) { - if (contextToken.kind === 7 /* NumericLiteral */) { + if (contextToken.kind === 8 /* NumericLiteral */) { var text = contextToken.getFullText(); return text.charAt(text.length - 1) === "."; } @@ -42906,9 +44198,9 @@ var ts; for (var _i = 0; _i < existingMembers.length; _i++) { var m = existingMembers[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 242 /* PropertyAssignment */ && - m.kind !== 243 /* ShorthandPropertyAssignment */ && - m.kind !== 160 /* BindingElement */) { + if (m.kind !== 243 /* PropertyAssignment */ && + m.kind !== 244 /* ShorthandPropertyAssignment */ && + m.kind !== 161 /* BindingElement */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -42916,7 +44208,7 @@ var ts; continue; } var existingName = void 0; - if (m.kind === 160 /* BindingElement */ && m.propertyName) { + if (m.kind === 161 /* BindingElement */ && m.propertyName) { existingName = m.propertyName.text; } else { @@ -42943,7 +44235,7 @@ var ts; if (attr.getStart() <= position && position <= attr.getEnd()) { continue; } - if (attr.kind === 235 /* JsxAttribute */) { + if (attr.kind === 236 /* JsxAttribute */) { seenNames[attr.name.text] = true; } } @@ -42983,7 +44275,7 @@ var ts; for (var name_32 in nameTable) { if (!allNames[name_32]) { allNames[name_32] = name_32; - var displayName = getCompletionEntryDisplayName(name_32, target, true); + var displayName = getCompletionEntryDisplayName(name_32, target, /*performCharacterChecks:*/ true); if (displayName) { var entry = { name: displayName, @@ -42999,17 +44291,17 @@ var ts; return entries; } function createCompletionEntry(symbol, location) { - // Try to get a valid display name for this symbol, if we could not find one, then ignore it. + // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) - var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, true, location); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks:*/ true, location); if (!displayName) { return undefined; } - // TODO(drosen): Right now we just permit *all* semantic meanings when calling - // 'getSymbolKind' which is permissible given that it is backwards compatible; but + // TODO(drosen): Right now we just permit *all* semantic meanings when calling + // 'getSymbolKind' which is permissible given that it is backwards compatible; but // really we should consider passing the meaning for the node so that we don't report - // that a suggestion for a value is an interface. We COULD also just do what + // that a suggestion for a value is an interface. We COULD also just do what // 'getSymbolModifiers' does, which is to use the first declaration. // Use a 'sortText' of 0' so that all symbol completion entries come before any other // entries (like JavaScript identifier entries). @@ -43049,10 +44341,10 @@ var ts; var symbols = completionData.symbols, location_2 = completionData.location; // Find the symbol with the matching entry name. var target = program.getCompilerOptions().target; - // We don't need to perform character checks here because we're only comparing the - // name against 'entryName' (which is known to be good), not building a new + // We don't need to perform character checks here because we're only comparing the + // name against 'entryName' (which is known to be good), not building a new // completion entry. - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target, false, location_2) === entryName ? s : undefined; }); + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, target, /*performCharacterChecks:*/ false, location_2) === entryName ? s : undefined; }); if (symbol) { var _a = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location_2, location_2, 7 /* All */), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind; return { @@ -43081,7 +44373,7 @@ var ts; function getSymbolKind(symbol, location) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) - return ts.getDeclarationOfKind(symbol, 183 /* ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 184 /* ClassExpression */) ? ScriptElementKind.localClassElement : ScriptElementKind.classElement; if (flags & 384 /* Enum */) return ScriptElementKind.enumElement; @@ -43145,7 +44437,7 @@ var ts; ts.Debug.assert(!!(rootSymbolFlags & 8192 /* Method */)); }); if (!unionPropertyKind) { - // If this was union of all methods, + // If this was union of all methods, //make sure it has call signatures before we can label it as method var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (typeOfUnionProperty.getCallSignatures().length) { @@ -43183,7 +44475,7 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 163 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 164 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -43192,7 +44484,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression; - if (location.kind === 165 /* CallExpression */ || location.kind === 166 /* NewExpression */) { + if (location.kind === 166 /* CallExpression */ || location.kind === 167 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -43205,10 +44497,10 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 166 /* NewExpression */ || callExpression.expression.kind === 92 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 167 /* NewExpression */ || callExpression.expression.kind === 93 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { - // Get the first signature if there + // Get the first signature if there signature = allSignatures.length ? allSignatures[0] : undefined; } if (signature) { @@ -43222,7 +44514,7 @@ var ts; pushTypePart(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(89 /* NewKeyword */)); + displayParts.push(ts.keywordPart(90 /* NewKeyword */)); displayParts.push(ts.spacePart()); } addFullSymbolName(symbol); @@ -43238,14 +44530,14 @@ var ts; case ScriptElementKind.parameterElement: case ScriptElementKind.localVariableElement: // If it is call or construct signature of lambda's write type name - displayParts.push(ts.punctuationPart(52 /* ColonToken */)); + displayParts.push(ts.punctuationPart(53 /* ColonToken */)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { - displayParts.push(ts.keywordPart(89 /* NewKeyword */)); + displayParts.push(ts.keywordPart(90 /* NewKeyword */)); displayParts.push(ts.spacePart()); } if (!(type.flags & 65536 /* Anonymous */)) { - ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, undefined, 1 /* WriteTypeParametersOrArguments */)); + ts.addRange(displayParts, ts.symbolToDisplayParts(typeChecker, type.symbol, enclosingDeclaration, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */)); } addSignatureDisplayParts(signature, allSignatures, 8 /* WriteArrowStyleSignature */); break; @@ -43257,24 +44549,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 118 /* ConstructorKeyword */ && location.parent.kind === 141 /* Constructor */)) { + (location.kind === 119 /* ConstructorKeyword */ && location.parent.kind === 142 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 141 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 142 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 141 /* Constructor */) { + if (functionDeclaration.kind === 142 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 144 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 145 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -43283,7 +44575,7 @@ var ts; } } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo) { - if (ts.getDeclarationOfKind(symbol, 183 /* ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 184 /* ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -43291,7 +44583,7 @@ var ts; } else { // Class declaration has name which is not local. - displayParts.push(ts.keywordPart(70 /* ClassKeyword */)); + displayParts.push(ts.keywordPart(71 /* ClassKeyword */)); } displayParts.push(ts.spacePart()); addFullSymbolName(symbol); @@ -43299,48 +44591,48 @@ var ts; } if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(104 /* InterfaceKeyword */)); + displayParts.push(ts.keywordPart(105 /* InterfaceKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(129 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(130 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54 /* EqualsToken */)); + displayParts.push(ts.operatorPart(55 /* EqualsToken */)); displayParts.push(ts.spacePart()); ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); } if (symbolFlags & 384 /* Enum */) { addNewLineIfDisplayPartsExist(); if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { - displayParts.push(ts.keywordPart(71 /* ConstKeyword */)); + displayParts.push(ts.keywordPart(72 /* ConstKeyword */)); displayParts.push(ts.spacePart()); } - displayParts.push(ts.keywordPart(78 /* EnumKeyword */)); + displayParts.push(ts.keywordPart(79 /* EnumKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - var declaration = ts.getDeclarationOfKind(symbol, 215 /* ModuleDeclaration */); - var isNamespace = declaration && declaration.name && declaration.name.kind === 66 /* Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 123 /* NamespaceKeyword */ : 122 /* ModuleKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 216 /* ModuleDeclaration */); + var isNamespace = declaration && declaration.name && declaration.name.kind === 67 /* Identifier */; + displayParts.push(ts.keywordPart(isNamespace ? 124 /* NamespaceKeyword */ : 123 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } if ((symbolFlags & 262144 /* TypeParameter */) && (semanticMeaning & 2 /* Type */)) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); + displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.textPart("type parameter")); - displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(87 /* InKeyword */)); + displayParts.push(ts.keywordPart(88 /* InKeyword */)); displayParts.push(ts.spacePart()); if (symbol.parent) { // Class/Interface type parameter @@ -43349,13 +44641,13 @@ var ts; } else { // Method/function type parameter - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 134 /* TypeParameter */).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 135 /* TypeParameter */).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 145 /* ConstructSignature */) { - displayParts.push(ts.keywordPart(89 /* NewKeyword */)); + if (signatureDeclaration.kind === 146 /* ConstructSignature */) { + displayParts.push(ts.keywordPart(90 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 144 /* CallSignature */ && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 145 /* CallSignature */ && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -43364,11 +44656,11 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 244 /* EnumMember */) { + if (declaration.kind === 245 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54 /* EqualsToken */)); + displayParts.push(ts.operatorPart(55 /* EqualsToken */)); displayParts.push(ts.spacePart()); displayParts.push(ts.displayPart(constantValue.toString(), SymbolDisplayPartKind.numericLiteral)); } @@ -43376,26 +44668,26 @@ var ts; } if (symbolFlags & 8388608 /* Alias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(86 /* ImportKeyword */)); + displayParts.push(ts.keywordPart(87 /* ImportKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 218 /* ImportEqualsDeclaration */) { + if (declaration.kind === 219 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54 /* EqualsToken */)); + displayParts.push(ts.operatorPart(55 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(124 /* RequireKeyword */)); - displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); + displayParts.push(ts.keywordPart(125 /* RequireKeyword */)); + displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); - displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); } else { var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(ts.spacePart()); - displayParts.push(ts.operatorPart(54 /* EqualsToken */)); + displayParts.push(ts.operatorPart(55 /* EqualsToken */)); displayParts.push(ts.spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -43412,7 +44704,7 @@ var ts; if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 /* Variable */ || symbolKind === ScriptElementKind.localVariableElement) { - displayParts.push(ts.punctuationPart(52 /* ColonToken */)); + displayParts.push(ts.punctuationPart(53 /* ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */) { @@ -43450,7 +44742,7 @@ var ts; } } function addFullSymbolName(symbol, enclosingDeclaration) { - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, undefined, 1 /* WriteTypeParametersOrArguments */ | 2 /* UseOnlyExternalAliasing */); + var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* WriteTypeParametersOrArguments */ | 2 /* UseOnlyExternalAliasing */); ts.addRange(displayParts, fullSymbolDisplayParts); } function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { @@ -43471,9 +44763,9 @@ var ts; displayParts.push(ts.textOrKeywordPart(symbolKind)); return; default: - displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); + displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); displayParts.push(ts.textOrKeywordPart(symbolKind)); - displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); return; } } @@ -43481,12 +44773,12 @@ var ts; ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); if (allSignatures.length > 1) { displayParts.push(ts.spacePart()); - displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); - displayParts.push(ts.operatorPart(34 /* PlusToken */)); + displayParts.push(ts.punctuationPart(17 /* OpenParenToken */)); + displayParts.push(ts.operatorPart(35 /* PlusToken */)); displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), SymbolDisplayPartKind.numericLiteral)); displayParts.push(ts.spacePart()); displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); - displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); + displayParts.push(ts.punctuationPart(18 /* CloseParenToken */)); } documentation = signature.getDocumentationComment(); } @@ -43512,11 +44804,11 @@ var ts; if (!symbol) { // Try getting just type at this position and show switch (node.kind) { - case 66 /* Identifier */: - case 163 /* PropertyAccessExpression */: - case 132 /* QualifiedName */: - case 94 /* ThisKeyword */: - case 92 /* SuperKeyword */: + case 67 /* Identifier */: + case 164 /* PropertyAccessExpression */: + case 133 /* QualifiedName */: + case 95 /* ThisKeyword */: + case 93 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position var type = typeChecker.getTypeAtLocation(node); if (type) { @@ -43560,7 +44852,7 @@ var ts; var containerName = containerSymbol ? typeChecker.symbolToString(containerSymbol, node) : ""; if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { - // Just add all the declarations. + // Just add all the declarations. ts.forEach(declarations, function (declaration) { result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -43569,18 +44861,18 @@ var ts; function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (isNewExpressionTarget(location) || location.kind === 118 /* ConstructorKeyword */) { + if (isNewExpressionTarget(location) || location.kind === 119 /* ConstructorKeyword */) { if (symbol.flags & 32 /* Class */) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 211 /* ClassDeclaration */); - return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 212 /* ClassDeclaration */); + return tryAddSignature(classDeclaration.members, /*selectConstructors*/ 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 tryAddSignature(symbol.declarations, /*selectConstructors*/ false, symbolKind, symbolName, containerName, result); } return false; } @@ -43588,8 +44880,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 141 /* Constructor */) || - (!selectConstructors && (d.kind === 210 /* FunctionDeclaration */ || d.kind === 140 /* MethodDeclaration */ || d.kind === 139 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 142 /* Constructor */) || + (!selectConstructors && (d.kind === 211 /* FunctionDeclaration */ || d.kind === 141 /* MethodDeclaration */ || d.kind === 140 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -43618,7 +44910,7 @@ var ts; if (isJumpStatementTarget(node)) { var labelName = node.text; var label = getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + return label ? [createDefinitionInfo(label, ScriptElementKind.label, labelName, /*containerName*/ undefined)] : undefined; } /// Triple slash reference comments var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); @@ -43649,16 +44941,16 @@ var ts; // to jump to the implementation directly. if (symbol.flags & 8388608 /* Alias */) { var declaration = symbol.declarations[0]; - if (node.kind === 66 /* Identifier */ && node.parent === declaration) { + if (node.kind === 67 /* Identifier */ && node.parent === declaration) { symbol = typeChecker.getAliasedSymbol(symbol); } } // Because name in short-hand property assignment has two different meanings: property name and property value, // using go-to-definition at such position should go to the variable declaration of the property value rather than - // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition + // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 243 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 244 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -43692,7 +44984,7 @@ var ts; var result = []; ts.forEach(type.types, function (t) { if (t.symbol) { - ts.addRange(result, getDefinitionFromSymbol(t.symbol, node)); + ts.addRange(/*to*/ result, /*from*/ getDefinitionFromSymbol(t.symbol, node)); } }); return result; @@ -43706,7 +44998,7 @@ var ts; var results = getOccurrencesAtPositionCore(fileName, position); if (results) { var sourceFile = getCanonicalFileName(ts.normalizeSlashes(fileName)); - // Get occurrences only supports reporting occurrences for the file queried. So + // Get occurrences only supports reporting occurrences for the file queried. So // filter down to that list. results = ts.filter(results, function (r) { return getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile; }); } @@ -43732,12 +45024,12 @@ var ts; }; } function getSemanticDocumentHighlights(node) { - if (node.kind === 66 /* Identifier */ || - node.kind === 94 /* ThisKeyword */ || - node.kind === 92 /* SuperKeyword */ || + if (node.kind === 67 /* Identifier */ || + node.kind === 95 /* ThisKeyword */ || + node.kind === 93 /* SuperKeyword */ || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { - var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, false, false); + var referencedSymbols = getReferencedSymbolsForNode(node, sourceFilesToSearch, /*findInStrings:*/ false, /*findInComments:*/ false); return convertReferencedSymbols(referencedSymbols); } return undefined; @@ -43785,77 +45077,77 @@ var ts; function getHighlightSpans(node) { if (node) { switch (node.kind) { - case 85 /* IfKeyword */: - case 77 /* ElseKeyword */: - if (hasKind(node.parent, 193 /* IfStatement */)) { + case 86 /* IfKeyword */: + case 78 /* ElseKeyword */: + if (hasKind(node.parent, 194 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; - case 91 /* ReturnKeyword */: - if (hasKind(node.parent, 201 /* ReturnStatement */)) { + case 92 /* ReturnKeyword */: + if (hasKind(node.parent, 202 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; - case 95 /* ThrowKeyword */: - if (hasKind(node.parent, 205 /* ThrowStatement */)) { + case 96 /* ThrowKeyword */: + if (hasKind(node.parent, 206 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; - case 69 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 206 /* TryStatement */)) { + case 70 /* CatchKeyword */: + if (hasKind(parent(parent(node)), 207 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; - case 97 /* TryKeyword */: - case 82 /* FinallyKeyword */: - if (hasKind(parent(node), 206 /* TryStatement */)) { + case 98 /* TryKeyword */: + case 83 /* FinallyKeyword */: + if (hasKind(parent(node), 207 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; - case 93 /* SwitchKeyword */: - if (hasKind(node.parent, 203 /* SwitchStatement */)) { + case 94 /* SwitchKeyword */: + if (hasKind(node.parent, 204 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; - case 68 /* CaseKeyword */: - case 74 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 203 /* SwitchStatement */)) { + case 69 /* CaseKeyword */: + case 75 /* DefaultKeyword */: + if (hasKind(parent(parent(parent(node))), 204 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; - case 67 /* BreakKeyword */: - case 72 /* ContinueKeyword */: - if (hasKind(node.parent, 200 /* BreakStatement */) || hasKind(node.parent, 199 /* ContinueStatement */)) { - return getBreakOrContinueStatementOccurences(node.parent); + case 68 /* BreakKeyword */: + case 73 /* ContinueKeyword */: + if (hasKind(node.parent, 201 /* BreakStatement */) || hasKind(node.parent, 200 /* ContinueStatement */)) { + return getBreakOrContinueStatementOccurrences(node.parent); } break; - case 83 /* ForKeyword */: - if (hasKind(node.parent, 196 /* ForStatement */) || - hasKind(node.parent, 197 /* ForInStatement */) || - hasKind(node.parent, 198 /* ForOfStatement */)) { + case 84 /* ForKeyword */: + if (hasKind(node.parent, 197 /* ForStatement */) || + hasKind(node.parent, 198 /* ForInStatement */) || + hasKind(node.parent, 199 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 101 /* WhileKeyword */: - case 76 /* DoKeyword */: - if (hasKind(node.parent, 195 /* WhileStatement */) || hasKind(node.parent, 194 /* DoStatement */)) { + case 102 /* WhileKeyword */: + case 77 /* DoKeyword */: + if (hasKind(node.parent, 196 /* WhileStatement */) || hasKind(node.parent, 195 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; - case 118 /* ConstructorKeyword */: - if (hasKind(node.parent, 141 /* Constructor */)) { + case 119 /* ConstructorKeyword */: + if (hasKind(node.parent, 142 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; - case 120 /* GetKeyword */: - case 126 /* SetKeyword */: - if (hasKind(node.parent, 142 /* GetAccessor */) || hasKind(node.parent, 143 /* SetAccessor */)) { + case 121 /* GetKeyword */: + case 127 /* SetKeyword */: + if (hasKind(node.parent, 143 /* GetAccessor */) || hasKind(node.parent, 144 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } break; default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 190 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 191 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -43871,10 +45163,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 205 /* ThrowStatement */) { + if (node.kind === 206 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 206 /* TryStatement */) { + else if (node.kind === 207 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -43902,19 +45194,19 @@ var ts; function getThrowStatementOwner(throwStatement) { var child = throwStatement; while (child.parent) { - var parent_13 = child.parent; - if (ts.isFunctionBlock(parent_13) || parent_13.kind === 245 /* SourceFile */) { - return parent_13; + var parent_12 = child.parent; + if (ts.isFunctionBlock(parent_12) || parent_12.kind === 246 /* SourceFile */) { + return parent_12; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_13.kind === 206 /* TryStatement */) { - var tryStatement = parent_13; + if (parent_12.kind === 207 /* TryStatement */) { + var tryStatement = parent_12; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; } } - child = parent_13; + child = parent_12; } return undefined; } @@ -43923,7 +45215,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 200 /* BreakStatement */ || node.kind === 199 /* ContinueStatement */) { + if (node.kind === 201 /* BreakStatement */ || node.kind === 200 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -43939,16 +45231,16 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_2 = statement.parent; node_2; node_2 = node_2.parent) { switch (node_2.kind) { - case 203 /* SwitchStatement */: - if (statement.kind === 199 /* ContinueStatement */) { + case 204 /* SwitchStatement */: + if (statement.kind === 200 /* ContinueStatement */) { continue; } // Fall through. - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 195 /* WhileStatement */: - case 194 /* DoStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 196 /* WhileStatement */: + case 195 /* DoStatement */: if (!statement.label || isLabeledBy(node_2, statement.label.text)) { return node_2; } @@ -43967,24 +45259,24 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 211 /* ClassDeclaration */ || - container.kind === 183 /* ClassExpression */ || - (declaration.kind === 135 /* Parameter */ && hasKind(container, 141 /* Constructor */)))) { + if (!(container.kind === 212 /* ClassDeclaration */ || + container.kind === 184 /* ClassExpression */ || + (declaration.kind === 136 /* Parameter */ && hasKind(container, 142 /* Constructor */)))) { return undefined; } } - else if (modifier === 110 /* StaticKeyword */) { - if (!(container.kind === 211 /* ClassDeclaration */ || container.kind === 183 /* ClassExpression */)) { + else if (modifier === 111 /* StaticKeyword */) { + if (!(container.kind === 212 /* ClassDeclaration */ || container.kind === 184 /* ClassExpression */)) { return undefined; } } - else if (modifier === 79 /* ExportKeyword */ || modifier === 119 /* DeclareKeyword */) { - if (!(container.kind === 216 /* ModuleBlock */ || container.kind === 245 /* SourceFile */)) { + else if (modifier === 80 /* ExportKeyword */ || modifier === 120 /* DeclareKeyword */) { + if (!(container.kind === 217 /* ModuleBlock */ || container.kind === 246 /* SourceFile */)) { return undefined; } } - else if (modifier === 112 /* AbstractKeyword */) { - if (!(container.kind === 211 /* ClassDeclaration */ || declaration.kind === 211 /* ClassDeclaration */)) { + else if (modifier === 113 /* AbstractKeyword */) { + if (!(container.kind === 212 /* ClassDeclaration */ || declaration.kind === 212 /* ClassDeclaration */)) { return undefined; } } @@ -43996,8 +45288,8 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 216 /* ModuleBlock */: - case 245 /* SourceFile */: + case 217 /* ModuleBlock */: + case 246 /* SourceFile */: // Container is either a class declaration or the declaration is a classDeclaration if (modifierFlag & 256 /* Abstract */) { nodes = declaration.members.concat(declaration); @@ -44006,17 +45298,17 @@ var ts; nodes = container.statements; } break; - case 141 /* Constructor */: + case 142 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 211 /* ClassDeclaration */: - case 183 /* ClassExpression */: + case 212 /* ClassDeclaration */: + case 184 /* ClassExpression */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. if (modifierFlag & 112 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 141 /* Constructor */ && member; + return member.kind === 142 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -44037,19 +45329,19 @@ var ts; return ts.map(keywords, getHighlightSpanForNode); function getFlagFromModifier(modifier) { switch (modifier) { - case 109 /* PublicKeyword */: + case 110 /* PublicKeyword */: return 16 /* Public */; - case 107 /* PrivateKeyword */: + case 108 /* PrivateKeyword */: return 32 /* Private */; - case 108 /* ProtectedKeyword */: + case 109 /* ProtectedKeyword */: return 64 /* Protected */; - case 110 /* StaticKeyword */: + case 111 /* StaticKeyword */: return 128 /* Static */; - case 79 /* ExportKeyword */: + case 80 /* ExportKeyword */: return 1 /* Export */; - case 119 /* DeclareKeyword */: + case 120 /* DeclareKeyword */: return 2 /* Ambient */; - case 112 /* AbstractKeyword */: + case 113 /* AbstractKeyword */: return 256 /* Abstract */; default: ts.Debug.fail(); @@ -44069,13 +45361,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 142 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 143 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 143 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 144 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 120 /* GetKeyword */, 126 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 121 /* GetKeyword */, 127 /* SetKeyword */); }); } } } @@ -44084,19 +45376,19 @@ var ts; var keywords = []; ts.forEach(declarations, function (declaration) { ts.forEach(declaration.getChildren(), function (token) { - return pushKeywordIf(keywords, token, 118 /* ConstructorKeyword */); + return pushKeywordIf(keywords, token, 119 /* ConstructorKeyword */); }); }); return ts.map(keywords, getHighlightSpanForNode); } function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 83 /* ForKeyword */, 101 /* WhileKeyword */, 76 /* DoKeyword */)) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 84 /* ForKeyword */, 102 /* WhileKeyword */, 77 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 194 /* DoStatement */) { + if (loopNode.kind === 195 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 101 /* WhileKeyword */)) { + if (pushKeywordIf(keywords, loopTokens[i], 102 /* WhileKeyword */)) { break; } } @@ -44105,22 +45397,22 @@ var ts; var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 67 /* BreakKeyword */, 72 /* ContinueKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 68 /* BreakKeyword */, 73 /* ContinueKeyword */); } }); return ts.map(keywords, getHighlightSpanForNode); } - function getBreakOrContinueStatementOccurences(breakOrContinueStatement) { + function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) { var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 196 /* ForStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: - case 194 /* DoStatement */: - case 195 /* WhileStatement */: + case 197 /* ForStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: + case 195 /* DoStatement */: + case 196 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -44128,14 +45420,14 @@ var ts; } function getSwitchCaseDefaultOccurrences(switchStatement) { var keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 93 /* SwitchKeyword */); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 94 /* SwitchKeyword */); // Go through each clause in the switch statement, collecting the 'case'/'default' keywords. ts.forEach(switchStatement.caseBlock.clauses, function (clause) { - pushKeywordIf(keywords, clause.getFirstToken(), 68 /* CaseKeyword */, 74 /* DefaultKeyword */); + pushKeywordIf(keywords, clause.getFirstToken(), 69 /* CaseKeyword */, 75 /* DefaultKeyword */); var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); ts.forEach(breaksAndContinues, function (statement) { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 67 /* BreakKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 68 /* BreakKeyword */); } }); }); @@ -44143,13 +45435,13 @@ var ts; } function getTryCatchFinallyOccurrences(tryStatement) { var keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 97 /* TryKeyword */); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 98 /* TryKeyword */); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 69 /* CatchKeyword */); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 70 /* CatchKeyword */); } if (tryStatement.finallyBlock) { - var finallyKeyword = ts.findChildOfKind(tryStatement, 82 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 82 /* FinallyKeyword */); + var finallyKeyword = ts.findChildOfKind(tryStatement, 83 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 83 /* FinallyKeyword */); } return ts.map(keywords, getHighlightSpanForNode); } @@ -44160,13 +45452,13 @@ var ts; } var keywords = []; ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 95 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 96 /* ThrowKeyword */); }); // If the "owner" is a function, then we equate 'return' and 'throw' statements in their // ability to "jump out" of the function, and include occurrences for both. if (ts.isFunctionBlock(owner)) { ts.forEachReturnStatement(owner, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 91 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 92 /* ReturnKeyword */); }); } return ts.map(keywords, getHighlightSpanForNode); @@ -44174,36 +45466,36 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 189 /* Block */))) { + if (!(func && hasKind(func.body, 190 /* Block */))) { return undefined; } var keywords = []; ts.forEachReturnStatement(func.body, function (returnStatement) { - pushKeywordIf(keywords, returnStatement.getFirstToken(), 91 /* ReturnKeyword */); + pushKeywordIf(keywords, returnStatement.getFirstToken(), 92 /* ReturnKeyword */); }); // Include 'throw' statements that do not occur within a try block. ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { - pushKeywordIf(keywords, throwStatement.getFirstToken(), 95 /* ThrowKeyword */); + pushKeywordIf(keywords, throwStatement.getFirstToken(), 96 /* ThrowKeyword */); }); return ts.map(keywords, getHighlightSpanForNode); } function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 193 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 194 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. while (ifStatement) { var children = ifStatement.getChildren(); - pushKeywordIf(keywords, children[0], 85 /* IfKeyword */); + pushKeywordIf(keywords, children[0], 86 /* IfKeyword */); // Generally the 'else' keyword is second-to-last, so we traverse backwards. for (var i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 77 /* ElseKeyword */)) { + if (pushKeywordIf(keywords, children[i], 78 /* ElseKeyword */)) { break; } } - if (!hasKind(ifStatement.elseStatement, 193 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 194 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -44212,7 +45504,7 @@ var ts; // We'd like to highlight else/ifs together if they are only separated by whitespace // (i.e. the keywords are separated by no comments, no newlines). for (var i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 77 /* ElseKeyword */ && i < keywords.length - 1) { + if (keywords[i].kind === 78 /* ElseKeyword */ && i < keywords.length - 1) { var elseKeyword = keywords[i]; var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword. var shouldCombindElseAndIf = true; @@ -44279,11 +45571,11 @@ var ts; return convertReferences(referencedSymbols); } function getReferencesAtPosition(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); return convertReferences(referencedSymbols); } function findReferences(fileName, position) { - var referencedSymbols = findReferencedSymbols(fileName, position, false, false); + var referencedSymbols = findReferencedSymbols(fileName, position, /*findInStrings:*/ false, /*findInComments:*/ false); // Only include referenced symbols that have a valid definition. return ts.filter(referencedSymbols, function (rs) { return !!rs.definition; }); } @@ -44294,7 +45586,7 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 66 /* Identifier */ && + if (node.kind !== 67 /* Identifier */ && // TODO (drosen): This should be enabled in a later release - currently breaks rename. //node.kind !== SyntaxKind.ThisKeyword && //node.kind !== SyntaxKind.SuperKeyword && @@ -44302,7 +45594,7 @@ var ts; !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } - ts.Debug.assert(node.kind === 66 /* Identifier */ || node.kind === 7 /* NumericLiteral */ || node.kind === 8 /* StringLiteral */); + ts.Debug.assert(node.kind === 67 /* Identifier */ || node.kind === 8 /* NumericLiteral */ || node.kind === 9 /* StringLiteral */); return getReferencedSymbolsForNode(node, program.getSourceFiles(), findInStrings, findInComments); } function getReferencedSymbolsForNode(node, sourceFiles, findInStrings, findInComments) { @@ -44320,10 +45612,10 @@ var ts; return getLabelReferencesInNode(node.parent, node); } } - if (node.kind === 94 /* ThisKeyword */) { + if (node.kind === 95 /* ThisKeyword */) { return getReferencesForThisKeyword(node, sourceFiles); } - if (node.kind === 92 /* SuperKeyword */) { + if (node.kind === 93 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } var symbol = typeChecker.getSymbolAtLocation(node); @@ -44383,7 +45675,7 @@ var ts; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608 /* Alias */) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 223 /* ImportSpecifier */ || declaration.kind === 227 /* ExportSpecifier */; + return declaration.kind === 224 /* ImportSpecifier */ || declaration.kind === 228 /* ExportSpecifier */; }); } function getInternedName(symbol, location, declarations) { @@ -44410,14 +45702,14 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 170 /* FunctionExpression */ || valueDeclaration.kind === 183 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 171 /* FunctionExpression */ || valueDeclaration.kind === 184 /* ClassExpression */)) { return valueDeclaration; } // If this is private property or method, the scope is the containing class if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 211 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 212 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -44443,7 +45735,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 245 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 246 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -44471,12 +45763,12 @@ var ts; // If we are past the end, stop looking if (position > end) break; - // We found a match. Make sure it's not part of a larger word (i.e. the char + // We found a match. Make sure it's not part of a larger word (i.e. the char // before and after it have to be a non-identifier char). var endPosition = position + symbolNameLength; if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2 /* Latest */)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2 /* Latest */))) { - // Found a real match. Keep searching. + // Found a real match. Keep searching. positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -44514,16 +45806,16 @@ var ts; if (node) { // Compare the length so we filter out strict superstrings of the symbol we are looking for switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: return node.getWidth() === searchSymbolName.length; - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { // For string literals we have two additional chars for the quotes return node.getWidth() === searchSymbolName.length + 2; } break; - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { return node.getWidth() === searchSymbolName.length; } @@ -44547,11 +45839,11 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - // This wasn't the start of a token. Check to see if it might be a + // This wasn't the start of a token. Check to see if it might be a // match in a comment or string if that's what the caller is asking // for. - if ((findInStrings && isInString(position)) || - (findInComments && isInComment(position))) { + if ((findInStrings && ts.isInString(sourceFile, position)) || + (findInComments && isInNonReferenceComment(sourceFile, position))) { // In the case where we're looking inside comments/strings, we don't have // an actual definition. So just use 'undefined' here. Features like // 'Rename' won't care (as they ignore the definitions), and features like @@ -44600,44 +45892,29 @@ var ts; } return result[index]; } - function isInString(position) { - var token = ts.getTokenAtPosition(sourceFile, position); - return token && token.kind === 8 /* StringLiteral */ && position > token.getStart(); - } - function isInComment(position) { - var token = ts.getTokenAtPosition(sourceFile, position); - if (token && position < token.getStart()) { - // First, we have to see if this position actually landed in a comment. - var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); - // Then we want to make sure that it wasn't in a "///<" directive comment - // We don't want to unintentionally update a file name. - 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; - } - } - }); + function isInNonReferenceComment(sourceFile, position) { + return ts.isInCommentHelper(sourceFile, position, isNonReferenceComment); + function isNonReferenceComment(c) { + var commentText = sourceFile.text.substring(c.pos, c.end); + return !tripleSlashDirectivePrefixRegex.test(commentText); } - return false; } } function getReferencesForSuperKeyword(superKeyword) { - var searchSpaceNode = ts.getSuperContainer(superKeyword, false); + var searchSpaceNode = ts.getSuperContainer(superKeyword, /*includeFunctions*/ false); if (!searchSpaceNode) { return undefined; } // Whether 'super' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -44650,10 +45927,10 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 92 /* SuperKeyword */) { + if (!node || node.kind !== 93 /* SuperKeyword */) { return; } - var container = ts.getSuperContainer(node, false); + var container = ts.getSuperContainer(node, /*includeFunctions*/ false); // If we have a 'super' container, we must have an enclosing class. // Now make sure the owning class is the same as the search-space // and has the same static qualifier as the original 'super's owner. @@ -44665,31 +45942,31 @@ var ts; return [{ definition: definition, references: references }]; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { - var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 245 /* SourceFile */: + case 246 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -44698,7 +45975,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 245 /* SourceFile */) { + if (searchSpaceNode.kind === 246 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -44724,32 +46001,32 @@ var ts; ts.forEach(possiblePositions, function (position) { cancellationToken.throwIfCancellationRequested(); var node = ts.getTouchingWord(sourceFile, position); - if (!node || node.kind !== 94 /* ThisKeyword */) { + if (!node || node.kind !== 95 /* ThisKeyword */) { return; } - var container = ts.getThisContainer(node, false); + var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 245 /* SourceFile */: - if (container.kind === 245 /* SourceFile */ && !ts.isExternalModule(container)) { + case 246 /* SourceFile */: + if (container.kind === 246 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -44803,11 +46080,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 211 /* ClassDeclaration */) { + if (declaration.kind === 212 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 212 /* InterfaceDeclaration */) { + else if (declaration.kind === 213 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -44839,7 +46116,7 @@ var ts; return aliasedSymbol; } } - // If the reference location is in an object literal, try to get the contextual type for the + // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol if (isNameOfPropertyAssignment(referenceLocation)) { @@ -44854,7 +46131,7 @@ var ts; if (searchSymbols.indexOf(rootSymbol) >= 0) { return rootSymbol; } - // Finally, try all properties with the same name in any type the containing type extended or implemented, and + // Finally, try all properties with the same name in any type the containing type extended or implemented, and // see if any is in the list if (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */)) { var result_3 = []; @@ -44930,7 +46207,7 @@ var ts; function getReferenceEntryFromNode(node) { var start = node.getStart(); var end = node.getEnd(); - if (node.kind === 8 /* StringLiteral */) { + if (node.kind === 9 /* StringLiteral */) { start += 1; end -= 1; } @@ -44942,17 +46219,17 @@ var ts; } /** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */ function isWriteAccess(node) { - if (node.kind === 66 /* Identifier */ && ts.isDeclarationName(node)) { + if (node.kind === 67 /* Identifier */ && ts.isDeclarationName(node)) { return true; } var parent = node.parent; if (parent) { - if (parent.kind === 177 /* PostfixUnaryExpression */ || parent.kind === 176 /* PrefixUnaryExpression */) { + if (parent.kind === 178 /* PostfixUnaryExpression */ || parent.kind === 177 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 178 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 179 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; - return 54 /* FirstAssignment */ <= operator && operator <= 65 /* LastAssignment */; + return 55 /* FirstAssignment */ <= operator && operator <= 66 /* LastAssignment */; } } return false; @@ -44984,34 +46261,34 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 135 /* Parameter */: - case 208 /* VariableDeclaration */: - case 160 /* BindingElement */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: - case 242 /* PropertyAssignment */: - case 243 /* ShorthandPropertyAssignment */: - case 244 /* EnumMember */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 141 /* Constructor */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 210 /* FunctionDeclaration */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: - case 241 /* CatchClause */: + case 136 /* Parameter */: + case 209 /* VariableDeclaration */: + case 161 /* BindingElement */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: + case 243 /* PropertyAssignment */: + case 244 /* ShorthandPropertyAssignment */: + case 245 /* EnumMember */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 142 /* Constructor */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 211 /* FunctionDeclaration */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: + case 242 /* CatchClause */: return 1 /* Value */; - case 134 /* TypeParameter */: - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: - case 152 /* TypeLiteral */: + case 135 /* TypeParameter */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: + case 153 /* TypeLiteral */: return 2 /* Type */; - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 215 /* ModuleDeclaration */: - if (node.name.kind === 8 /* StringLiteral */) { + case 216 /* ModuleDeclaration */: + if (node.name.kind === 9 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } else if (ts.getModuleInstanceState(node) === 1 /* Instantiated */) { @@ -45020,15 +46297,15 @@ var ts; else { return 4 /* Namespace */; } - case 222 /* NamedImports */: - case 223 /* ImportSpecifier */: - case 218 /* ImportEqualsDeclaration */: - case 219 /* ImportDeclaration */: - case 224 /* ExportAssignment */: - case 225 /* ExportDeclaration */: + case 223 /* NamedImports */: + case 224 /* ImportSpecifier */: + case 219 /* ImportEqualsDeclaration */: + case 220 /* ImportDeclaration */: + case 225 /* ExportAssignment */: + case 226 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 245 /* SourceFile */: + case 246 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -45038,8 +46315,8 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 148 /* TypeReference */ || - (node.parent.kind === 185 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); + return node.parent.kind === 149 /* TypeReference */ || + (node.parent.kind === 186 /* ExpressionWithTypeArguments */ && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)); } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -45047,50 +46324,50 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 163 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 163 /* PropertyAccessExpression */) { + if (root.parent.kind === 164 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 164 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 185 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 240 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 186 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 241 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 211 /* ClassDeclaration */ && root.parent.parent.token === 103 /* ImplementsKeyword */) || - (decl.kind === 212 /* InterfaceDeclaration */ && root.parent.parent.token === 80 /* ExtendsKeyword */); + return (decl.kind === 212 /* ClassDeclaration */ && root.parent.parent.token === 104 /* ImplementsKeyword */) || + (decl.kind === 213 /* InterfaceDeclaration */ && root.parent.parent.token === 81 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 132 /* QualifiedName */) { - while (root.parent && root.parent.kind === 132 /* QualifiedName */) { + if (root.parent.kind === 133 /* QualifiedName */) { + while (root.parent && root.parent.kind === 133 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 148 /* TypeReference */ && !isLastClause; + return root.parent.kind === 149 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 132 /* QualifiedName */) { + while (node.parent.kind === 133 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { - ts.Debug.assert(node.kind === 66 /* Identifier */); + ts.Debug.assert(node.kind === 67 /* Identifier */); // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 132 /* QualifiedName */ && + if (node.parent.kind === 133 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 218 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 219 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 224 /* ExportAssignment */) { + if (node.parent.kind === 225 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -45130,15 +46407,15 @@ var ts; return; } switch (node.kind) { - case 163 /* PropertyAccessExpression */: - case 132 /* QualifiedName */: - case 8 /* StringLiteral */: - case 81 /* FalseKeyword */: - case 96 /* TrueKeyword */: - case 90 /* NullKeyword */: - case 92 /* SuperKeyword */: - case 94 /* ThisKeyword */: - case 66 /* Identifier */: + case 164 /* PropertyAccessExpression */: + case 133 /* QualifiedName */: + case 9 /* StringLiteral */: + case 82 /* FalseKeyword */: + case 97 /* TrueKeyword */: + case 91 /* NullKeyword */: + case 93 /* SuperKeyword */: + case 95 /* ThisKeyword */: + case 67 /* Identifier */: break; // Cant create the text span default: @@ -45152,9 +46429,9 @@ var ts; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { // If this is name of a module declarations, check if this is right side of dotted module name - // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of + // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 215 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 216 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -45188,17 +46465,17 @@ var ts; // been canceled. That would be an enormous amount of chattyness, along with the all // the overhead of marshalling the data to/from the host. So instead we pick a few // reasonable node kinds to bother checking on. These node kinds represent high level - // constructs that we would expect to see commonly, but just at a far less frequent + // constructs that we would expect to see commonly, but just at a far less frequent // interval. // // For example, in checker.ts (around 750k) we only have around 600 of these constructs. // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 215 /* ModuleDeclaration */: - case 211 /* ClassDeclaration */: - case 212 /* InterfaceDeclaration */: - case 210 /* FunctionDeclaration */: + case 216 /* ModuleDeclaration */: + case 212 /* ClassDeclaration */: + case 213 /* InterfaceDeclaration */: + case 211 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } @@ -45252,7 +46529,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 215 /* ModuleDeclaration */ && + return declaration.kind === 216 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) === 1 /* Instantiated */; }); } @@ -45262,7 +46539,7 @@ var ts; if (node && ts.textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) { var kind = node.kind; checkForClassificationCancellation(kind); - if (kind === 66 /* Identifier */ && !ts.nodeIsMissing(node)) { + if (kind === 67 /* Identifier */ && !ts.nodeIsMissing(node)) { var identifier = node; // Only bother calling into the typechecker if this is an identifier that // could possibly resolve to a type name. This makes classification run @@ -45323,8 +46600,8 @@ var ts; var spanStart = span.start; var spanLength = span.length; // Make a scanner we can get trivia from. - var triviaScanner = ts.createScanner(2 /* Latest */, false, sourceFile.languageVariant, sourceFile.text); - var mergeConflictScanner = ts.createScanner(2 /* Latest */, false, sourceFile.languageVariant, sourceFile.text); + var triviaScanner = ts.createScanner(2 /* Latest */, /*skipTrivia:*/ false, sourceFile.languageVariant, sourceFile.text); + var mergeConflictScanner = ts.createScanner(2 /* Latest */, /*skipTrivia:*/ false, sourceFile.languageVariant, sourceFile.text); var result = []; processElement(sourceFile); return { spans: result, endOfLineState: 0 /* None */ }; @@ -45355,13 +46632,13 @@ var ts; // Only bother with the trivia if it at least intersects the span of interest. if (ts.isComment(kind)) { classifyComment(token, kind, start, width); - // Classifying a comment might cause us to reuse the trivia scanner + // Classifying a comment might cause us to reuse the trivia scanner // (because of jsdoc comments). So after we classify the comment make // sure we set the scanner position back to where it needs to be. triviaScanner.setTextPos(end); continue; } - if (kind === 6 /* ConflictMarkerTrivia */) { + if (kind === 7 /* ConflictMarkerTrivia */) { var text = sourceFile.text; var ch = text.charCodeAt(start); // for the <<<<<<< and >>>>>>> markers, we just add them in as comments @@ -45399,7 +46676,7 @@ var ts; for (var _i = 0, _a = docComment.tags; _i < _a.length; _i++) { var tag = _a[_i]; // As we walk through each tag, classify the portion of text from the end of - // the last tag (or the start of the entire doc comment) as 'comment'. + // the last tag (or the start of the entire doc comment) as 'comment'. if (tag.pos !== pos) { pushCommentRange(pos, tag.pos - pos); } @@ -45407,16 +46684,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); pos = tag.tagName.end; switch (tag.kind) { - case 264 /* JSDocParameterTag */: + case 265 /* JSDocParameterTag */: processJSDocParameterTag(tag); break; - case 267 /* JSDocTemplateTag */: + case 268 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); break; - case 266 /* JSDocTypeTag */: + case 267 /* JSDocTypeTag */: processElement(tag.typeExpression); break; - case 265 /* JSDocReturnTag */: + case 266 /* JSDocReturnTag */: processElement(tag.typeExpression); break; } @@ -45451,7 +46728,7 @@ var ts; } } function classifyDisabledMergeCode(text, start, end) { - // Classify the line that the ======= marker is on as a comment. Then just lex + // Classify the line that the ======= marker is on as a comment. Then just lex // all further tokens and add them to the result. for (var i = start; i < end; i++) { if (ts.isLineBreak(text.charCodeAt(i))) { @@ -45487,7 +46764,7 @@ var ts; } } } - // for accurate classification, the actual token should be passed in. however, for + // for accurate classification, the actual token should be passed in. however, for // cases like 'disabled merge code' classification, we just get the token kind and // classify based on that instead. function classifyTokenType(tokenKind, token) { @@ -45496,7 +46773,7 @@ var ts; } // Special case < and > If they appear in a generic context they are punctuation, // not operators. - if (tokenKind === 24 /* LessThanToken */ || tokenKind === 26 /* GreaterThanToken */) { + if (tokenKind === 25 /* LessThanToken */ || tokenKind === 27 /* GreaterThanToken */) { // If the node owning the token has a type argument list or type parameter list, then // we can effectively assume that a '<' and '>' belong to those lists. if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { @@ -45505,30 +46782,30 @@ var ts; } if (ts.isPunctuation(tokenKind)) { if (token) { - if (tokenKind === 54 /* EqualsToken */) { + if (tokenKind === 55 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 208 /* VariableDeclaration */ || - token.parent.kind === 138 /* PropertyDeclaration */ || - token.parent.kind === 135 /* Parameter */) { + if (token.parent.kind === 209 /* VariableDeclaration */ || + token.parent.kind === 139 /* PropertyDeclaration */ || + token.parent.kind === 136 /* Parameter */) { return 5 /* operator */; } } - if (token.parent.kind === 178 /* BinaryExpression */ || - token.parent.kind === 176 /* PrefixUnaryExpression */ || - token.parent.kind === 177 /* PostfixUnaryExpression */ || - token.parent.kind === 179 /* ConditionalExpression */) { + if (token.parent.kind === 179 /* BinaryExpression */ || + token.parent.kind === 177 /* PrefixUnaryExpression */ || + token.parent.kind === 178 /* PostfixUnaryExpression */ || + token.parent.kind === 180 /* ConditionalExpression */) { return 5 /* operator */; } } return 10 /* punctuation */; } - else if (tokenKind === 7 /* NumericLiteral */) { + else if (tokenKind === 8 /* NumericLiteral */) { return 4 /* numericLiteral */; } - else if (tokenKind === 8 /* StringLiteral */) { + else if (tokenKind === 9 /* StringLiteral */) { return 6 /* stringLiteral */; } - else if (tokenKind === 9 /* RegularExpressionLiteral */) { + else if (tokenKind === 10 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. return 6 /* stringLiteral */; } @@ -45536,35 +46813,35 @@ var ts; // TODO (drosen): we should *also* get another classification type for these literals. return 6 /* stringLiteral */; } - else if (tokenKind === 66 /* Identifier */) { + else if (tokenKind === 67 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 134 /* TypeParameter */: + case 135 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 212 /* InterfaceDeclaration */: + case 213 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 135 /* Parameter */: + case 136 /* Parameter */: if (token.parent.name === token) { return 17 /* parameterName */; } @@ -45630,14 +46907,14 @@ var ts; return result; function getMatchingTokenKind(token) { switch (token.kind) { - case 14 /* OpenBraceToken */: return 15 /* CloseBraceToken */; - case 16 /* OpenParenToken */: return 17 /* CloseParenToken */; - case 18 /* OpenBracketToken */: return 19 /* CloseBracketToken */; - case 24 /* LessThanToken */: return 26 /* GreaterThanToken */; - case 15 /* CloseBraceToken */: return 14 /* OpenBraceToken */; - case 17 /* CloseParenToken */: return 16 /* OpenParenToken */; - case 19 /* CloseBracketToken */: return 18 /* OpenBracketToken */; - case 26 /* GreaterThanToken */: return 24 /* LessThanToken */; + case 15 /* OpenBraceToken */: return 16 /* CloseBraceToken */; + case 17 /* OpenParenToken */: return 18 /* CloseParenToken */; + case 19 /* OpenBracketToken */: return 20 /* CloseBracketToken */; + case 25 /* LessThanToken */: return 27 /* GreaterThanToken */; + case 16 /* CloseBraceToken */: return 15 /* OpenBraceToken */; + case 18 /* CloseParenToken */: return 17 /* OpenParenToken */; + case 20 /* CloseBracketToken */: return 19 /* OpenBracketToken */; + case 27 /* GreaterThanToken */: return 25 /* LessThanToken */; } return undefined; } @@ -45672,12 +46949,73 @@ var ts; } return []; } + /** + * Checks if position points to a valid position to add JSDoc comments, and if so, + * returns the appropriate template. Otherwise returns an empty string. + * Valid positions are + * - outside of comments, statements, and expressions, and + * - preceding a function declaration. + * + * Hosts should ideally check that: + * - The line is all whitespace up to 'position' before performing the insertion. + * - If the keystroke sequence "/\*\*" induced the call, we also check that the next + * non-whitespace character is '*', which (approximately) indicates whether we added + * the second '*' to complete an existing (JSDoc) comment. + * @param fileName The file in which to perform the check. + * @param position The (character-indexed) position in the file where the check should + * be performed. + */ + function getDocCommentTemplateAtPosition(fileName, position) { + var start = new Date().getTime(); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + // Check if in a context where we don't want to perform any insertion + if (ts.isInString(sourceFile, position) || ts.isInComment(sourceFile, position) || ts.hasDocComment(sourceFile, position)) { + return undefined; + } + var tokenAtPos = ts.getTokenAtPosition(sourceFile, position); + var tokenStart = tokenAtPos.getStart(); + if (!tokenAtPos || tokenStart < position) { + return undefined; + } + // TODO: add support for: + // - methods + // - constructors + // - class decls + var containingFunction = ts.getAncestor(tokenAtPos, 211 /* FunctionDeclaration */); + if (!containingFunction || containingFunction.getStart() < position) { + return undefined; + } + var parameters = containingFunction.parameters; + var posLineAndChar = sourceFile.getLineAndCharacterOfPosition(position); + var lineStart = sourceFile.getLineStarts()[posLineAndChar.line]; + var indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character); + // TODO: call a helper method instead once PR #4133 gets merged in. + var newLine = host.getNewLine ? host.getNewLine() : "\r\n"; + var docParams = parameters.reduce(function (prev, cur, index) { + return prev + + indentationStr + " * @param " + (cur.name.kind === 67 /* Identifier */ ? cur.name.text : "param" + index) + newLine; + }, ""); + // A doc comment consists of the following + // * The opening comment line + // * the first line (without a param) for the object's untagged info (this is also where the caret ends up) + // * the '@param'-tagged lines + // * TODO: other tags. + // * the closing comment line + // * if the caret was directly in front of the object, then we add an extra line and indentation. + var preamble = "/**" + newLine + + indentationStr + " * "; + var result = preamble + newLine + + docParams + + indentationStr + " */" + + (tokenStart === position ? newLine + indentationStr : ""); + return { newText: result, caretOffset: preamble.length }; + } function getTodoComments(fileName, descriptors) { - // Note: while getting todo comments seems like a syntactic operation, we actually + // Note: while getting todo comments seems like a syntactic operation, we actually // treat it as a semantic operation here. This is because we expect our host to call // this on every single file. If we treat this syntactically, then that will cause // us to populate and throw away the tree in our syntax tree cache for each file. By - // treating this as a semantic operation, we can access any tree without throwing + // treating this as a semantic operation, we can access any tree without throwing // anything away. synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); @@ -45701,7 +47039,7 @@ var ts; // 0) The full match for the entire regexp. // 1) The preamble to the message portion. // 2) The message portion. - // 3...N) The descriptor that was matched - by index. 'undefined' for each + // 3...N) The descriptor that was matched - by index. 'undefined' for each // descriptor that didn't match. an actual value if it did match. // // i.e. 'undefined' in position 3 above means TODO(jason) didn't match. @@ -45723,7 +47061,7 @@ var ts; } } ts.Debug.assert(descriptor !== undefined); - // We don't want to match something like 'TODOBY', so we make sure a non + // We don't want to match something like 'TODOBY', so we make sure a non // letter/digit follows the match. if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { continue; @@ -45768,10 +47106,10 @@ var ts; // (?:(TODO\(jason\))|(HACK)) // // Note that the outermost group is *not* a capture group, but the innermost groups - // *are* capture groups. By capturing the inner literals we can determine after + // *are* capture groups. By capturing the inner literals we can determine after // matching which descriptor we are dealing with. var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; - // After matching a descriptor literal, the following regexp matches the rest of the + // After matching a descriptor literal, the following regexp matches the rest of the // text up to the end of the line (or */). var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; var messageRemainder = /(?:.*?)/.source; @@ -45802,7 +47140,7 @@ var ts; var typeChecker = program.getTypeChecker(); var node = ts.getTouchingWord(sourceFile, position); // Can only rename an identifier. - if (node && node.kind === 66 /* Identifier */) { + if (node && node.kind === 67 /* Identifier */) { var symbol = typeChecker.getSymbolAtLocation(node); // Only allow a symbol to be renamed if it actually has at least one declaration. if (symbol) { @@ -45882,6 +47220,7 @@ var ts; getFormattingEditsForRange: getFormattingEditsForRange, getFormattingEditsForDocument: getFormattingEditsForDocument, getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, + getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition, getEmitOutput: getEmitOutput, getSourceFile: getSourceFile, getProgram: getProgram @@ -45902,17 +47241,17 @@ var ts; sourceFile.nameTable = nameTable; function walk(node) { switch (node.kind) { - case 66 /* Identifier */: + case 67 /* Identifier */: nameTable[node.text] = node.text; break; - case 8 /* StringLiteral */: - case 7 /* NumericLiteral */: + case 9 /* StringLiteral */: + case 8 /* NumericLiteral */: // We want to store any numbers/strings if they were a name that could be // related to a declaration. So, if we have 'import x = require("something")' // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 229 /* ExternalModuleReference */ || + node.parent.kind === 230 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -45925,29 +47264,29 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 164 /* ElementAccessExpression */ && + node.parent.kind === 165 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier function createClassifier() { - var scanner = ts.createScanner(2 /* Latest */, false); + var scanner = ts.createScanner(2 /* Latest */, /*skipTrivia*/ false); /// We do not have a full parser support to know when we should parse a regex or not /// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where - /// we have a series of divide operator. this list allows us to be more accurate by ruling out + /// we have a series of divide operator. this list allows us to be more accurate by ruling out /// locations where a regexp cannot exist. var noRegexTable = []; - noRegexTable[66 /* Identifier */] = true; - noRegexTable[8 /* StringLiteral */] = true; - noRegexTable[7 /* NumericLiteral */] = true; - noRegexTable[9 /* RegularExpressionLiteral */] = true; - noRegexTable[94 /* ThisKeyword */] = true; - noRegexTable[39 /* PlusPlusToken */] = true; - noRegexTable[40 /* MinusMinusToken */] = true; - noRegexTable[17 /* CloseParenToken */] = true; - noRegexTable[19 /* CloseBracketToken */] = true; - noRegexTable[15 /* CloseBraceToken */] = true; - noRegexTable[96 /* TrueKeyword */] = true; - noRegexTable[81 /* FalseKeyword */] = true; + noRegexTable[67 /* Identifier */] = true; + noRegexTable[9 /* StringLiteral */] = true; + noRegexTable[8 /* NumericLiteral */] = true; + noRegexTable[10 /* RegularExpressionLiteral */] = true; + noRegexTable[95 /* ThisKeyword */] = true; + noRegexTable[40 /* PlusPlusToken */] = true; + noRegexTable[41 /* MinusMinusToken */] = true; + noRegexTable[18 /* CloseParenToken */] = true; + noRegexTable[20 /* CloseBracketToken */] = true; + noRegexTable[16 /* CloseBraceToken */] = true; + noRegexTable[97 /* TrueKeyword */] = true; + noRegexTable[82 /* 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 @@ -45972,11 +47311,11 @@ var ts; /** Returns true if 'keyword2' can legally follow 'keyword1' in any language construct. */ function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { - if (keyword2 === 120 /* GetKeyword */ || - keyword2 === 126 /* SetKeyword */ || - keyword2 === 118 /* ConstructorKeyword */ || - keyword2 === 110 /* StaticKeyword */) { - // Allow things like "public get", "public constructor" and "public static". + if (keyword2 === 121 /* GetKeyword */ || + keyword2 === 127 /* SetKeyword */ || + keyword2 === 119 /* ConstructorKeyword */ || + keyword2 === 111 /* StaticKeyword */) { + // Allow things like "public get", "public constructor" and "public static". // These are all legal. return true; } @@ -45994,7 +47333,7 @@ var ts; var lastEnd = 0; for (var i = 0, n = dense.length; i < n; i += 3) { var start = dense[i]; - var length_2 = dense[i + 1]; + var length_3 = dense[i + 1]; var type = dense[i + 2]; // Make a whitespace entry between the last item and this one. if (lastEnd >= 0) { @@ -46003,8 +47342,8 @@ var ts; entries.push({ length: whitespaceLength_1, classification: TokenClass.Whitespace }); } } - entries.push({ length: length_2, classification: convertClassification(type) }); - lastEnd = start + length_2; + entries.push({ length: length_3, classification: convertClassification(type) }); + lastEnd = start + length_3; } var whitespaceLength = text.length - lastEnd; if (whitespaceLength > 0) { @@ -46074,7 +47413,7 @@ var ts; offset = 2; // fallthrough case 6 /* InTemplateSubstitutionPosition */: - templateStack.push(11 /* TemplateHead */); + templateStack.push(12 /* TemplateHead */); break; } scanner.setText(text); @@ -46093,83 +47432,83 @@ var ts; // token. So the classification will go back to being an identifier. The moment the user // types again, number will become a keyword, then an identifier, etc. etc. // - // To try to avoid this problem, we avoid classifying contextual keywords as keywords + // To try to avoid this problem, we avoid classifying contextual keywords as keywords // when the user is potentially typing something generic. We just can't do a good enough // job at the lexical level, and so well leave it up to the syntactic classifier to make // the determination. // - // In order to determine if the user is potentially typing something generic, we use a + // In order to determine if the user is potentially typing something generic, we use a // weak heuristic where we track < and > tokens. It's a weak heuristic, but should // work well enough in practice. var angleBracketStack = 0; do { token = scanner.scan(); if (!ts.isTrivia(token)) { - if ((token === 37 /* SlashToken */ || token === 58 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { - if (scanner.reScanSlashToken() === 9 /* RegularExpressionLiteral */) { - token = 9 /* RegularExpressionLiteral */; + if ((token === 38 /* SlashToken */ || token === 59 /* SlashEqualsToken */) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === 10 /* RegularExpressionLiteral */) { + token = 10 /* RegularExpressionLiteral */; } } - else if (lastNonTriviaToken === 20 /* DotToken */ && isKeyword(token)) { - token = 66 /* Identifier */; + else if (lastNonTriviaToken === 21 /* DotToken */ && isKeyword(token)) { + token = 67 /* 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 + // 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 = 66 /* Identifier */; + token = 67 /* Identifier */; } - else if (lastNonTriviaToken === 66 /* Identifier */ && - token === 24 /* LessThanToken */) { - // Could be the start of something generic. Keep track of that by bumping + else if (lastNonTriviaToken === 67 /* Identifier */ && + token === 25 /* LessThanToken */) { + // Could be the start of something generic. Keep track of that by bumping // up the current count of generic contexts we may be in. angleBracketStack++; } - else if (token === 26 /* GreaterThanToken */ && angleBracketStack > 0) { + else if (token === 27 /* GreaterThanToken */ && angleBracketStack > 0) { // If we think we're currently in something generic, then mark that that // generic entity is complete. angleBracketStack--; } - else if (token === 114 /* AnyKeyword */ || - token === 127 /* StringKeyword */ || - token === 125 /* NumberKeyword */ || - token === 117 /* BooleanKeyword */ || - token === 128 /* SymbolKeyword */) { + else if (token === 115 /* AnyKeyword */ || + token === 128 /* StringKeyword */ || + token === 126 /* NumberKeyword */ || + token === 118 /* BooleanKeyword */ || + token === 129 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { - // If it looks like we're could be in something generic, don't classify this + // 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 = 66 /* Identifier */; + token = 67 /* Identifier */; } } - else if (token === 11 /* TemplateHead */) { + else if (token === 12 /* TemplateHead */) { templateStack.push(token); } - else if (token === 14 /* OpenBraceToken */) { + else if (token === 15 /* 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 === 15 /* CloseBraceToken */) { + else if (token === 16 /* 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 = ts.lastOrUndefined(templateStack); - if (lastTemplateStackToken === 11 /* TemplateHead */) { + if (lastTemplateStackToken === 12 /* TemplateHead */) { token = scanner.reScanTemplateToken(); // Only pop on a TemplateTail; a TemplateMiddle indicates there is more for us. - if (token === 13 /* TemplateTail */) { + if (token === 14 /* TemplateTail */) { templateStack.pop(); } else { - ts.Debug.assert(token === 12 /* TemplateMiddle */, "Should have been a template middle. Was " + token); + ts.Debug.assert(token === 13 /* TemplateMiddle */, "Should have been a template middle. Was " + token); } } else { - ts.Debug.assert(lastTemplateStackToken === 14 /* OpenBraceToken */, "Should have been an open brace. Was: " + token); + ts.Debug.assert(lastTemplateStackToken === 15 /* OpenBraceToken */, "Should have been an open brace. Was: " + token); templateStack.pop(); } } @@ -46184,7 +47523,7 @@ var ts; var end = scanner.getTextPos(); addResult(start, end, classFromKind(token)); if (end >= text.length) { - if (token === 8 /* StringLiteral */) { + if (token === 9 /* StringLiteral */) { // Check to see if we finished up on a multiline string literal. var tokenText = scanner.getTokenText(); if (scanner.isUnterminated()) { @@ -46210,10 +47549,10 @@ var ts; } else if (ts.isTemplateLiteralKind(token)) { if (scanner.isUnterminated()) { - if (token === 13 /* TemplateTail */) { + if (token === 14 /* TemplateTail */) { result.endOfLineState = 5 /* InTemplateMiddleOrTail */; } - else if (token === 10 /* NoSubstitutionTemplateLiteral */) { + else if (token === 11 /* NoSubstitutionTemplateLiteral */) { result.endOfLineState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */; } else { @@ -46221,7 +47560,7 @@ var ts; } } } - else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11 /* TemplateHead */) { + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 12 /* TemplateHead */) { result.endOfLineState = 6 /* InTemplateSubstitutionPosition */; } } @@ -46232,8 +47571,8 @@ var ts; return; } if (start === 0 && offset > 0) { - // We're classifying the first token, and this was a case where we prepended - // text. We should consider the start of this token to be at the start of + // We're classifying the first token, and this was a case where we prepended + // text. We should consider the start of this token to be at the start of // the original text. start += offset; } @@ -46251,42 +47590,42 @@ var ts; } function isBinaryExpressionOperatorToken(token) { switch (token) { - case 36 /* AsteriskToken */: - case 37 /* SlashToken */: - case 38 /* PercentToken */: - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 41 /* LessThanLessThanToken */: - case 42 /* GreaterThanGreaterThanToken */: - case 43 /* GreaterThanGreaterThanGreaterThanToken */: - case 24 /* LessThanToken */: - case 26 /* GreaterThanToken */: - case 27 /* LessThanEqualsToken */: - case 28 /* GreaterThanEqualsToken */: - case 88 /* InstanceOfKeyword */: - case 87 /* InKeyword */: - case 29 /* EqualsEqualsToken */: - case 30 /* ExclamationEqualsToken */: - case 31 /* EqualsEqualsEqualsToken */: - case 32 /* ExclamationEqualsEqualsToken */: - case 44 /* AmpersandToken */: - case 46 /* CaretToken */: - case 45 /* BarToken */: - case 49 /* AmpersandAmpersandToken */: - case 50 /* BarBarToken */: - case 64 /* BarEqualsToken */: - case 63 /* AmpersandEqualsToken */: - case 65 /* CaretEqualsToken */: - case 60 /* LessThanLessThanEqualsToken */: - case 61 /* GreaterThanGreaterThanEqualsToken */: - case 62 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 55 /* PlusEqualsToken */: - case 56 /* MinusEqualsToken */: - case 57 /* AsteriskEqualsToken */: - case 58 /* SlashEqualsToken */: - case 59 /* PercentEqualsToken */: - case 54 /* EqualsToken */: - case 23 /* CommaToken */: + case 37 /* AsteriskToken */: + case 38 /* SlashToken */: + case 39 /* PercentToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 42 /* LessThanLessThanToken */: + case 43 /* GreaterThanGreaterThanToken */: + case 44 /* GreaterThanGreaterThanGreaterThanToken */: + case 25 /* LessThanToken */: + case 27 /* GreaterThanToken */: + case 28 /* LessThanEqualsToken */: + case 29 /* GreaterThanEqualsToken */: + case 89 /* InstanceOfKeyword */: + case 88 /* InKeyword */: + case 30 /* EqualsEqualsToken */: + case 31 /* ExclamationEqualsToken */: + case 32 /* EqualsEqualsEqualsToken */: + case 33 /* ExclamationEqualsEqualsToken */: + case 45 /* AmpersandToken */: + case 47 /* CaretToken */: + case 46 /* BarToken */: + case 50 /* AmpersandAmpersandToken */: + case 51 /* BarBarToken */: + case 65 /* BarEqualsToken */: + case 64 /* AmpersandEqualsToken */: + case 66 /* CaretEqualsToken */: + case 61 /* LessThanLessThanEqualsToken */: + case 62 /* GreaterThanGreaterThanEqualsToken */: + case 63 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 56 /* PlusEqualsToken */: + case 57 /* MinusEqualsToken */: + case 58 /* AsteriskEqualsToken */: + case 59 /* SlashEqualsToken */: + case 60 /* PercentEqualsToken */: + case 55 /* EqualsToken */: + case 24 /* CommaToken */: return true; default: return false; @@ -46294,19 +47633,19 @@ var ts; } function isPrefixUnaryExpressionOperatorToken(token) { switch (token) { - case 34 /* PlusToken */: - case 35 /* MinusToken */: - case 48 /* TildeToken */: - case 47 /* ExclamationToken */: - case 39 /* PlusPlusToken */: - case 40 /* MinusMinusToken */: + case 35 /* PlusToken */: + case 36 /* MinusToken */: + case 49 /* TildeToken */: + case 48 /* ExclamationToken */: + case 40 /* PlusPlusToken */: + case 41 /* MinusMinusToken */: return true; default: return false; } } function isKeyword(token) { - return token >= 67 /* FirstKeyword */ && token <= 131 /* LastKeyword */; + return token >= 68 /* FirstKeyword */ && token <= 132 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { @@ -46315,24 +47654,24 @@ var ts; else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5 /* operator */; } - else if (token >= 14 /* FirstPunctuation */ && token <= 65 /* LastPunctuation */) { + else if (token >= 15 /* FirstPunctuation */ && token <= 66 /* LastPunctuation */) { return 10 /* punctuation */; } switch (token) { - case 7 /* NumericLiteral */: + case 8 /* NumericLiteral */: return 4 /* numericLiteral */; - case 8 /* StringLiteral */: + case 9 /* StringLiteral */: return 6 /* stringLiteral */; - case 9 /* RegularExpressionLiteral */: + case 10 /* RegularExpressionLiteral */: return 7 /* regularExpressionLiteral */; - case 6 /* ConflictMarkerTrivia */: + case 7 /* ConflictMarkerTrivia */: case 3 /* MultiLineCommentTrivia */: case 2 /* SingleLineCommentTrivia */: return 1 /* comment */; case 5 /* WhitespaceTrivia */: case 4 /* NewLineTrivia */: return 8 /* whiteSpace */; - case 66 /* Identifier */: + case 67 /* Identifier */: default: if (ts.isTemplateLiteralKind(token)) { return 6 /* stringLiteral */; @@ -46364,7 +47703,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 245 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 246 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = -1; proto.end = -1; @@ -46434,159 +47773,159 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 194 /* DoStatement */) { + if (node.parent.kind === 195 /* DoStatement */) { // Set span as if on while keyword return spanInPreviousNode(node); } - if (node.parent.kind === 196 /* ForStatement */) { + if (node.parent.kind === 197 /* ForStatement */) { // For now lets set the span on this expression, fix it later return textSpan(node); } - if (node.parent.kind === 178 /* BinaryExpression */ && node.parent.operatorToken.kind === 23 /* CommaToken */) { + if (node.parent.kind === 179 /* BinaryExpression */ && node.parent.operatorToken.kind === 24 /* CommaToken */) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } - if (node.parent.kind === 171 /* ArrowFunction */ && node.parent.body === node) { + if (node.parent.kind === 172 /* ArrowFunction */ && node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); } } switch (node.kind) { - case 190 /* VariableStatement */: + case 191 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 208 /* VariableDeclaration */: - case 138 /* PropertyDeclaration */: - case 137 /* PropertySignature */: + case 209 /* VariableDeclaration */: + case 139 /* PropertyDeclaration */: + case 138 /* PropertySignature */: return spanInVariableDeclaration(node); - case 135 /* Parameter */: + case 136 /* Parameter */: return spanInParameterDeclaration(node); - case 210 /* FunctionDeclaration */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 141 /* Constructor */: - case 170 /* FunctionExpression */: - case 171 /* ArrowFunction */: + case 211 /* FunctionDeclaration */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 142 /* Constructor */: + case 171 /* FunctionExpression */: + case 172 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 189 /* Block */: + case 190 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 216 /* ModuleBlock */: + case 217 /* ModuleBlock */: return spanInBlock(node); - case 241 /* CatchClause */: + case 242 /* CatchClause */: return spanInBlock(node.block); - case 192 /* ExpressionStatement */: + case 193 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 201 /* ReturnStatement */: + case 202 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 195 /* WhileStatement */: + case 196 /* WhileStatement */: // Span on while(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 194 /* DoStatement */: + case 195 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 207 /* DebuggerStatement */: + case 208 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 193 /* IfStatement */: + case 194 /* IfStatement */: // set on if(..) span return textSpan(node, ts.findNextToken(node.expression, node)); - case 204 /* LabeledStatement */: + case 205 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 200 /* BreakStatement */: - case 199 /* ContinueStatement */: + case 201 /* BreakStatement */: + case 200 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 196 /* ForStatement */: + case 197 /* ForStatement */: return spanInForStatement(node); - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: // span on for (a in ...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 203 /* SwitchStatement */: + case 204 /* SwitchStatement */: // span on switch(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 238 /* CaseClause */: - case 239 /* DefaultClause */: + case 239 /* CaseClause */: + case 240 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 206 /* TryStatement */: + case 207 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 205 /* ThrowStatement */: + case 206 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 224 /* ExportAssignment */: + case 225 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 218 /* ImportEqualsDeclaration */: + case 219 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 219 /* ImportDeclaration */: + case 220 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 225 /* ExportDeclaration */: + case 226 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 211 /* ClassDeclaration */: - case 214 /* EnumDeclaration */: - case 244 /* EnumMember */: - case 165 /* CallExpression */: - case 166 /* NewExpression */: + case 212 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 245 /* EnumMember */: + case 166 /* CallExpression */: + case 167 /* NewExpression */: // span on complete node return textSpan(node); - case 202 /* WithStatement */: + case 203 /* WithStatement */: // span in statement return spanInNode(node.statement); // No breakpoint in interface, type alias - case 212 /* InterfaceDeclaration */: - case 213 /* TypeAliasDeclaration */: + case 213 /* InterfaceDeclaration */: + case 214 /* TypeAliasDeclaration */: return undefined; // Tokens: - case 22 /* SemicolonToken */: + case 23 /* SemicolonToken */: case 1 /* EndOfFileToken */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); - case 23 /* CommaToken */: + case 24 /* CommaToken */: return spanInPreviousNode(node); - case 14 /* OpenBraceToken */: + case 15 /* OpenBraceToken */: return spanInOpenBraceToken(node); - case 15 /* CloseBraceToken */: + case 16 /* CloseBraceToken */: return spanInCloseBraceToken(node); - case 16 /* OpenParenToken */: + case 17 /* OpenParenToken */: return spanInOpenParenToken(node); - case 17 /* CloseParenToken */: + case 18 /* CloseParenToken */: return spanInCloseParenToken(node); - case 52 /* ColonToken */: + case 53 /* ColonToken */: return spanInColonToken(node); - case 26 /* GreaterThanToken */: - case 24 /* LessThanToken */: + case 27 /* GreaterThanToken */: + case 25 /* LessThanToken */: return spanInGreaterThanOrLessThanToken(node); // Keywords: - case 101 /* WhileKeyword */: + case 102 /* WhileKeyword */: return spanInWhileKeyword(node); - case 77 /* ElseKeyword */: - case 69 /* CatchKeyword */: - case 82 /* FinallyKeyword */: + case 78 /* ElseKeyword */: + case 70 /* CatchKeyword */: + case 83 /* FinallyKeyword */: return spanInNextNode(node); default: // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 242 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 243 /* PropertyAssignment */ && node.parent.name === node) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 168 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 169 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNode(node.parent.expression); } // return type of function go to previous token @@ -46599,12 +47938,12 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 197 /* ForInStatement */ || - variableDeclaration.parent.parent.kind === 198 /* ForOfStatement */) { + if (variableDeclaration.parent.parent.kind === 198 /* ForInStatement */ || + variableDeclaration.parent.parent.kind === 199 /* ForOfStatement */) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 190 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 196 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 191 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 197 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -46658,7 +47997,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 211 /* ClassDeclaration */ && functionDeclaration.kind !== 141 /* Constructor */); + (functionDeclaration.parent.kind === 212 /* ClassDeclaration */ && functionDeclaration.kind !== 142 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -46681,18 +48020,18 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 215 /* ModuleDeclaration */: + case 216 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 195 /* WhileStatement */: - case 193 /* IfStatement */: - case 197 /* ForInStatement */: - case 198 /* ForOfStatement */: + case 196 /* WhileStatement */: + case 194 /* IfStatement */: + case 198 /* ForInStatement */: + case 199 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 196 /* ForStatement */: + case 197 /* ForStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement @@ -46700,7 +48039,7 @@ var ts; } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 209 /* VariableDeclarationList */) { + if (forStatement.initializer.kind === 210 /* VariableDeclarationList */) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -46720,13 +48059,13 @@ var ts; // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 214 /* EnumDeclaration */: + case 215 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 211 /* ClassDeclaration */: + case 212 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 217 /* CaseBlock */: + case 218 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -46734,25 +48073,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 216 /* ModuleBlock */: + case 217 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 214 /* EnumDeclaration */: - case 211 /* ClassDeclaration */: + case 215 /* EnumDeclaration */: + case 212 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 189 /* Block */: + case 190 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through. - case 241 /* CatchClause */: + case 242 /* CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); ; - case 217 /* CaseBlock */: + case 218 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -46766,7 +48105,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 194 /* DoStatement */) { + if (node.parent.kind === 195 /* DoStatement */) { // Go to while keyword and do action instead return spanInPreviousNode(node); } @@ -46776,17 +48115,17 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 170 /* FunctionExpression */: - case 210 /* FunctionDeclaration */: - case 171 /* ArrowFunction */: - case 140 /* MethodDeclaration */: - case 139 /* MethodSignature */: - case 142 /* GetAccessor */: - case 143 /* SetAccessor */: - case 141 /* Constructor */: - case 195 /* WhileStatement */: - case 194 /* DoStatement */: - case 196 /* ForStatement */: + case 171 /* FunctionExpression */: + case 211 /* FunctionDeclaration */: + case 172 /* ArrowFunction */: + case 141 /* MethodDeclaration */: + case 140 /* MethodSignature */: + case 143 /* GetAccessor */: + case 144 /* SetAccessor */: + case 142 /* Constructor */: + case 196 /* WhileStatement */: + case 195 /* DoStatement */: + case 197 /* ForStatement */: return spanInPreviousNode(node); // Default to parent node default: @@ -46797,19 +48136,19 @@ var ts; } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration - if (ts.isFunctionLike(node.parent) || node.parent.kind === 242 /* PropertyAssignment */) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 243 /* PropertyAssignment */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 168 /* TypeAssertionExpression */) { + if (node.parent.kind === 169 /* TypeAssertionExpression */) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 194 /* DoStatement */) { + if (node.parent.kind === 195 /* DoStatement */) { // Set span on while expression return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } @@ -46878,9 +48217,18 @@ var ts; })(); var LanguageServiceShimHostAdapter = (function () { function LanguageServiceShimHostAdapter(shimHost) { + var _this = this; this.shimHost = shimHost; this.loggingEnabled = false; this.tracingEnabled = false; + // if shimHost is a COM object then property check will become method call with no arguments. + // 'in' does not have this effect. + if ("getModuleResolutionsForFile" in this.shimHost) { + this.resolveModuleNames = function (moduleNames, containingFile) { + var resolutionsInFile = JSON.parse(_this.shimHost.getModuleResolutionsForFile(containingFile)); + return ts.map(moduleNames, function (name) { return ts.lookUp(resolutionsInFile, name); }); + }; + } } LanguageServiceShimHostAdapter.prototype.log = function (s) { if (this.loggingEnabled) { @@ -46988,10 +48336,26 @@ var ts; function CoreServicesShimHostAdapter(shimHost) { this.shimHost = shimHost; } - CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension) { - var encoded = this.shimHost.readDirectory(rootDir, extension); + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension, exclude) { + // Wrap the API changes for 1.5 release. This try/catch + // should be removed once TypeScript 1.5 has shipped. + // Also consider removing the optional designation for + // the exclude param at this time. + var encoded; + try { + encoded = this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude)); + } + catch (e) { + encoded = this.shimHost.readDirectory(rootDir, extension); + } return JSON.parse(encoded); }; + CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { + return this.shimHost.fileExists(fileName); + }; + CoreServicesShimHostAdapter.prototype.readFile = function (fileName) { + return this.shimHost.readFile(fileName); + }; return CoreServicesShimHostAdapter; })(); ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; @@ -47098,7 +48462,7 @@ var ts; }); }; LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { - var newLine = this.getNewLine(); + var newLine = ts.getNewLineOrDefaultFromHost(this.host); return ts.realizeDiagnostics(diagnostics, newLine); }; LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { @@ -47131,9 +48495,6 @@ var ts; return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); }; - 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 () { @@ -47270,7 +48631,10 @@ var ts; LanguageServiceShimObject.prototype.getDocumentHighlights = function (fileName, position, filesToSearch) { var _this = this; return this.forwardJSONCall("getDocumentHighlights('" + fileName + "', " + position + ")", function () { - return _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + var results = _this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + // workaround for VS document higlighting issue - keep only items from the initial file + var normalizedName = ts.normalizeSlashes(fileName).toLowerCase(); + return ts.filter(results, function (r) { return ts.normalizeSlashes(r.fileName).toLowerCase() === normalizedName; }); }); }; /// COMPLETION LISTS @@ -47318,6 +48682,10 @@ var ts; return edits; }); }; + LanguageServiceShimObject.prototype.getDocCommentTemplateAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDocCommentTemplateAtPosition('" + fileName + "', " + position + ")", function () { return _this.languageService.getDocCommentTemplateAtPosition(fileName, position); }); + }; /// NAVIGATE TO /** Return a list of symbols that are interesting to navigate to */ LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { @@ -47401,12 +48769,20 @@ var ts; CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); }; + CoreServicesShimObject.prototype.resolveModuleName = function (fileName, moduleName, compilerOptionsJson) { + var _this = this; + return this.forwardJSONCall("resolveModuleName('" + fileName + "')", function () { + var compilerOptions = JSON.parse(compilerOptionsJson); + return ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); + }); + }; 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: [], + ambientExternalModules: result.ambientExternalModules, isLibFile: result.isLibFile }; ts.forEach(result.referencedFiles, function (refFile) { @@ -47530,4 +48906,4 @@ var TypeScript; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); /* @internal */ -var toolsVersion = "1.5"; +var toolsVersion = "1.6"; diff --git a/package.json b/package.json index 2079c41fdd4cf..80baca1ef2a2d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "http://typescriptlang.org/", - "version": "1.6.0", + "version": "1.5.3", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ @@ -19,7 +19,8 @@ "type": "git", "url": "https://github.com/Microsoft/TypeScript.git" }, - "main": "./lib/typescript.js", + "preferGlobal": true, + "main": "./bin/typescript.js", "bin": { "tsc": "./bin/tsc", "tsserver": "./bin/tsserver" @@ -33,7 +34,6 @@ "chai": "latest", "browserify": "latest", "istanbul": "latest", - "mocha-fivemat-progress-reporter": "latest", "tslint": "latest" }, "scripts": { @@ -43,5 +43,11 @@ "build:compiler": "jake local", "build:tests": "jake tests", "clean": "jake clean" + }, + "browser": { + "buffer": false, + "fs": false, + "os": false, + "path": false } } diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 90f819305d36f..c1cd0c27aa06a 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -6,8 +6,8 @@ namespace ts { export const enum ModuleInstanceState { NonInstantiated = 0, - Instantiated = 1, - ConstEnumOnly = 2 + Instantiated = 1, + ConstEnumOnly = 2 } export function getModuleInstanceState(node: Node): ModuleInstanceState { @@ -98,7 +98,7 @@ namespace ts { let Symbol = objectAllocator.getSymbolConstructor(); let isJavaScriptFile = isJavaScript(file.fileName); - let classifiableNames: Map = {}; + let classifiableNames: Map = {}; if (!file.locals) { bind(file); @@ -150,6 +150,7 @@ namespace ts { } return (node.name).text; } + switch (node.kind) { case SyntaxKind.Constructor: return "__constructor"; @@ -177,9 +178,43 @@ namespace ts { let functionType = node.parent; let index = indexOf(functionType.parameters, node); return "p" + index; + + case SyntaxKind.BinaryExpression: + if (isAmdExportAssignment(node)) { + return getAmdExportAssignmentName(node); + } + else if(isCommonJsExportsAssignment(node)) { + return getAnonymousModuleName(node); + } + else { + Debug.fail('Unknown binder BinaryExpression kind'); + } + + case SyntaxKind.CallExpression: + Debug.assert(isDefineCall(node)); + if ((node).arguments[0].kind === SyntaxKind.StringLiteral) { + let moduleName = ((node).arguments[0]).text; + return '"' + moduleName + '"'; + } + else { + return getAnonymousModuleName(node); + } } } + function getAmdExportAssignmentName(node: Node) { + Debug.assert(isAmdExportAssignment(node)); + + let binaryExpr = node; + let propAccess = (binaryExpr.left); + return propAccess.name.text; + } + + function getAnonymousModuleName(node: Node) { + let sourceFileName = removeFileExtension(file.fileName); + return '"' + sourceFileName + '"'; + } + function getDisplayName(node: Declaration): string { return node.name ? declarationNameToString(node.name) : getDeclarationName(node); } @@ -196,7 +231,7 @@ namespace ts { Debug.assert(!hasDynamicName(node)); // The exported symbol for an export default function/class node is always named "default" - let name = node.flags & NodeFlags.Default && parent ? "default" : getDeclarationName(node); + let name = (node.flags & NodeFlags.Default && parent) ? "default" : getDeclarationName(node); let symbol: Symbol; if (name !== undefined) { @@ -277,7 +312,7 @@ namespace ts { // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - if (hasExportModifier || container.flags & NodeFlags.ExportContext) { + if (hasExportModifier || container.flags & NodeFlags.ExportContext || isAmdExportAssignment(node) || isCommonJsExportsAssignment(node)) { let exportKind = (symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) | (symbolFlags & SymbolFlags.Type ? SymbolFlags.ExportType : 0) | @@ -631,7 +666,7 @@ namespace ts { declareModuleMember(node, symbolFlags, symbolExcludes); break; } - // fall through. + // fall through. default: if (!blockScopeContainer.locals) { blockScopeContainer.locals = {}; @@ -853,9 +888,16 @@ namespace ts { function bindWorker(node: Node) { switch (node.kind) { + /* Strict mode checks */ case SyntaxKind.Identifier: return checkStrictModeIdentifier(node); case SyntaxKind.BinaryExpression: + if (isAmdExportAssignment(node)) { + bindAmdExportAssignment(node); + } + else if (isCommonJsExportsAssignment(node)) { + bindAmdModuleExportsAssignment(node); + } return checkStrictModeBinaryExpression(node); case SyntaxKind.CatchClause: return checkStrictModeCatchClause(node); @@ -870,6 +912,12 @@ namespace ts { case SyntaxKind.WithStatement: return checkStrictModeWithStatement(node); + case SyntaxKind.CallExpression: + if (isDefineCall(node)) { + return bindDefineCall(node); + } + return; + case SyntaxKind.TypeParameter: return declareSymbolAndAddToSymbolTable(node, SymbolFlags.TypeParameter, SymbolFlags.TypeParameterExcludes); case SyntaxKind.Parameter: @@ -987,6 +1035,29 @@ namespace ts { } } + function bindAmdExportAssignment(node: BinaryExpression) { + declareSymbolAndAddToSymbolTableWorker(node, SymbolFlags.Property, SymbolFlags.None); + } + + function bindAmdModuleExportsAssignment(node: BinaryExpression) { + let symbol = declareSymbolAndAddToSymbolTableWorker(node, SymbolFlags.ValueModule, SymbolFlags.None); + // This file is an external module + getSourceFileOfNode(node).symbol = symbol; + } + + function bindDefineCall(node: CallExpression) { + let symbol = declareSymbolAndAddToSymbolTableWorker(node, SymbolFlags.ValueModule, SymbolFlags.None); + + // If this was a file-level module, hook up the file symbol to this module + if (isAnonymousDefineCall(node)) { + let parent = node.parent; + while (parent && parent.kind !== SyntaxKind.SourceFile) { + parent = parent.parent; + } + parent.symbol = symbol; + } + } + function bindClassLikeDeclaration(node: ClassLikeDeclaration) { if (node.kind === SyntaxKind.ClassDeclaration) { bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 742f462750cd7..f21ce2083a0e9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -158,6 +158,11 @@ namespace ts { let getGlobalPromiseConstructorLikeType: () => ObjectType; let getGlobalThenableType: () => ObjectType; + let cjsModuleType: Type; + let cjsExportsType: Type; + let cjsRequireType: Type; + let amdRequireType: Type; + let tupleTypes: Map = {}; let unionTypes: Map = {}; let intersectionTypes: Map = {}; @@ -388,7 +393,7 @@ namespace ts { return node1.pos <= node2.pos; } - if (!compilerOptions.out) { + if (!compilerOptions.outFile && !compilerOptions.out) { return true; } @@ -953,7 +958,7 @@ namespace ts { return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; } - function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression): Symbol { + function resolveExternalModuleName(location: Node, moduleReferenceExpression: Expression, searchForJs = false): Symbol { if (moduleReferenceExpression.kind !== SyntaxKind.StringLiteral) { return; } @@ -965,7 +970,14 @@ namespace ts { // Escape the name in the "require(...)" clause to ensure we find the right symbol. let moduleName = escapeIdentifier(moduleReferenceLiteral.text); - if (!moduleName) return; + if(moduleName.indexOf('!') >= 0) { + moduleName = moduleName.substr(0, moduleName.indexOf('!')); + } + + if (!moduleName) { + return; + } + let isRelative = isExternalModuleNameRelative(moduleName); if (!isRelative) { let symbol = getSymbol(globals, "\"" + moduleName + "\"", SymbolFlags.ValueModule); @@ -973,20 +985,10 @@ namespace ts { return symbol; } } - let fileName: string; - let sourceFile: SourceFile; - while (true) { - fileName = normalizePath(combinePaths(searchPath, moduleName)); - sourceFile = forEach(supportedExtensions, extension => host.getSourceFile(fileName + extension)); - if (sourceFile || isRelative) { - break; - } - let parentPath = getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } + + let fileName = getResolvedModuleFileName(getSourceFile(location), moduleReferenceLiteral.text); + let sourceFile = fileName && host.getSourceFile(fileName); + if (sourceFile) { if (sourceFile.symbol) { return sourceFile.symbol; @@ -1369,7 +1371,8 @@ namespace ts { function hasExternalModuleSymbol(declaration: Node) { return (declaration.kind === SyntaxKind.ModuleDeclaration && (declaration).name.kind === SyntaxKind.StringLiteral) || - (declaration.kind === SyntaxKind.SourceFile && isExternalModule(declaration)); + (declaration.kind === SyntaxKind.SourceFile && isExternalModule(declaration)) || + (declaration.kind === SyntaxKind.CallExpression && isDefineCall(declaration)); } function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult { @@ -2175,10 +2178,13 @@ namespace ts { function collectLinkedAliases(node: Identifier): Node[] { let exportSymbol: Symbol; if (node.parent && node.parent.kind === SyntaxKind.ExportAssignment) { - exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace, Diagnostics.Cannot_find_name_0, node); + exportSymbol = resolveName(node.parent, node.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias, Diagnostics.Cannot_find_name_0, node); } else if (node.parent.kind === SyntaxKind.ExportSpecifier) { - exportSymbol = getTargetOfExportSpecifier(node.parent); + let exportSpecifier = node.parent; + exportSymbol = (exportSpecifier.parent.parent).moduleSpecifier ? + getExternalModuleMember(exportSpecifier.parent.parent, exportSpecifier) : + resolveEntityName(exportSpecifier.propertyName || exportSpecifier.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias); } let result: Node[] = []; if (exportSymbol) { @@ -2439,6 +2445,22 @@ namespace ts { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } } + + // In a JS file, we might need to add types to parameters of a function expression that is + // an argument to 'define' + if (func.kind === SyntaxKind.FunctionExpression && + func.parent && + func.parent.kind === SyntaxKind.CallExpression) { + + if (isDefineCall(func.parent) || isAmdRequireCall(func.parent)) { + assignDefineOrRequireCallParameterTypes(func); + let links = getSymbolLinks(declaration.symbol); + if (links.type) { + return links.type; + } + } + } + // Use contextual parameter type if one is available let type = getContextuallyTypedParameterType(declaration); if (type) { @@ -2702,7 +2724,170 @@ namespace ts { return links.type; } + function resolveAmdExportAssignment(symbol: Symbol): Type { + let seenTypes: Type[] = []; + + for (var i = 0; i < symbol.declarations.length; i++) { + let decl = symbol.declarations[i]; + Debug.assert(isAmdExportAssignment(decl)); + seenTypes.push(getTypeOfExpression((symbol.declarations[i]).right)); + } + + return getUnionType(seenTypes); + } + + function resolveCommonJsModuleExportsAssignment(symbol: Symbol): Type { + let seenTypes: Type[] = []; + + for (var i = 0; i < symbol.declarations.length; i++) { + let decl = symbol.declarations[i]; + Debug.assert(isCommonJsExportsAssignment(decl)); + seenTypes.push(getTypeOfExpression((symbol.declarations[i]).right)); + } + + return getUnionType(seenTypes); + } + + /* + * Given a Symbol for a declaration of an AMD module ('define(..., ..., ...')'), + * produces the type of that module + */ + function resolveDefineModule(symbol: Symbol): Type { + // Can't meaningfully define the same module more than once + if(symbol.declarations.length !== 1) { + return unknownType; + } + + // If the invocation of 'define' has zero args ('define()')... we + // shouldn't really be here, but it's meaninguless + let callExpr = symbol.declarations[0]; + if(callExpr.arguments.length === 0) { + Debug.fail('Should not have a zero-arg define call'); + return unknownType; + } + + // If the last arg isn't a function expr, just resolve + // its type and define that as the shape of the module + let lastArg = callExpr.arguments[callExpr.arguments.length - 1]; + if(!isFunctionLike(lastArg)) { + let resultType = getTypeOfExpression(lastArg); + // If this type is a function type, we want to use its return type since + // it's going to get invoked anyway + let signatures = getSignaturesOfType(resultType, SignatureKind.Call); + if (signatures.length > 0) { + return getReturnTypeOfSignature(signatures[0]); + } + else { + return resultType; + } + } + + // If there are any expressionful return statements in this function, + // we'll use those as the shape of the module + let bodyReturnType = getReturnTypeFromBody(lastArg); + if (bodyReturnType !== voidType) { + return bodyReturnType; + } + + // Collect assignments in the body to 'module.exports' or 'exports.propName' or 'module.exports.propName' + let assignedModuleType: Type = undefined; + let exportAssignedProperties: Symbol[] = []; + let exportAssignedPropTable: SymbolTable = {}; + + if (cjsModuleType === undefined || cjsExportsType === undefined) { + return unknownType; + } + + traverse(lastArg.body); + + // Someone assigned to 'module.exports', so ignore other assignments + if (assignedModuleType) { + return assignedModuleType; + } + + // Otherwise return the collected property assignments + if (exportAssignedProperties.length > 0) { + return createAnonymousType(lastArg.symbol, + exportAssignedPropTable, + /*callSignatures*/ [], + /*constructSignatures*/ [], + /*stringIndexType*/ undefined, + /*numberIndexType*/ undefined); + } + + // Empty module? + return emptyObjectType; + + function traverse(node: Node) { + if(node.kind === SyntaxKind.BinaryExpression && + (node).operatorToken.kind === SyntaxKind.EqualsToken) { + let lhs = (node).left; + if(lhs.kind === SyntaxKind.PropertyAccessExpression) { + // e.g. module.exports = foo; + let propertyName = (lhs).name.text; + let operandType = getTypeOfNode((lhs).expression); + if (operandType === cjsModuleType && propertyName === 'exports') { + assignedModuleType = getTypeOfNode((node).right); + } + else if (operandType === cjsExportsType) { + // e.g. exports = bar; + let prop = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, propertyName); + prop.type = getTypeOfNode((node).right); + exportAssignedProperties.push(prop); + exportAssignedPropTable[propertyName] = prop; + } + } + } + forEachChild(node, traverse); + } + } + + function getTypeOfDefineModule(symbol: Symbol): Type { + let links = getSymbolLinks(symbol); + if (!links.type) { + if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) { + return unknownType; + } + + links.type = resolveDefineModule(symbol); + } + return links.type; + } + + function getTypeOfAmdExportAssignment(symbol: Symbol): Type { + let links = getSymbolLinks(symbol); + if (!links.type) { + if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) { + return unknownType; + } + + links.type = resolveAmdExportAssignment(symbol); + } + return links.type; + } + + function getTypeOfCommonJsModuleExportsAssignment(symbol: Symbol): Type { + let links = getSymbolLinks(symbol); + if (!links.type) { + if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) { + return unknownType; + } + + links.type = resolveCommonJsModuleExportsAssignment(symbol); + } + return links.type; + } + function getTypeOfSymbol(symbol: Symbol): Type { + if (symbol.declarations && forEach(symbol.declarations, isDefineCall)) { + return getTypeOfDefineModule(symbol); + } + if (symbol.declarations && forEach(symbol.declarations, isAmdExportAssignment)) { + return getTypeOfAmdExportAssignment(symbol); + } + if (symbol.declarations && forEach(symbol.declarations, isCommonJsExportsAssignment)) { + return getTypeOfCommonJsModuleExportsAssignment(symbol); + } if (symbol.flags & SymbolFlags.Instantiated) { return getTypeOfInstantiatedSymbol(symbol); } @@ -3177,52 +3362,66 @@ namespace ts { setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); } - function findMatchingSignature(signature: Signature, signatureList: Signature[]): Signature { - for (let s of signatureList) { - // Only signatures with no type parameters may differ in return types - if (compareSignatures(signature, s, /*compareReturnTypes*/ !!signature.typeParameters, compareTypes)) { + function findMatchingSignature(signatureList: Signature[], signature: Signature, partialMatch: boolean, ignoreReturnTypes: boolean): Signature { + for (let s of signatureList) { + if (compareSignatures(s, signature, partialMatch, ignoreReturnTypes, compareTypes)) { return s; } } } - function findMatchingSignatures(signature: Signature, signatureLists: Signature[][]): Signature[] { + function findMatchingSignatures(signatureLists: Signature[][], signature: Signature, listIndex: number): Signature[] { + if (signature.typeParameters) { + // We require an exact match for generic signatures, so we only return signatures from the first + // signature list and only if they have exact matches in the other signature lists. + if (listIndex > 0) { + return undefined; + } + for (let i = 1; i < signatureLists.length; i++) { + if (!findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ false)) { + return undefined; + } + } + return [signature]; + } let result: Signature[] = undefined; - for (let i = 1; i < signatureLists.length; i++) { - let match = findMatchingSignature(signature, signatureLists[i]); + for (let i = 0; i < signatureLists.length; i++) { + // Allow matching non-generic signatures to have excess parameters and different return types + let match = i === listIndex ? signature : findMatchingSignature(signatureLists[i], signature, /*partialMatch*/ true, /*ignoreReturnTypes*/ true); if (!match) { return undefined; } - if (!result) { - result = [signature]; - } - if (match !== signature) { - result.push(match); + if (!contains(result, match)) { + (result || (result = [])).push(match); } } return result; } - // The signatures of a union type are those signatures that are present and identical in each of the - // constituent types, except that non-generic signatures may differ in return types. When signatures - // differ in return types, the resulting return type is the union of the constituent return types. + // The signatures of a union type are those signatures that are present in each of the constituent types. + // Generic signatures must match exactly, but non-generic signatures are allowed to have extra optional + // parameters and may differ in return types. When signatures differ in return types, the resulting return + // type is the union of the constituent return types. function getUnionSignatures(types: Type[], kind: SignatureKind): Signature[] { let signatureLists = map(types, t => getSignaturesOfType(t, kind)); let result: Signature[] = undefined; - for (let source of signatureLists[0]) { - let unionSignatures = findMatchingSignatures(source, signatureLists); - if (unionSignatures) { - let signature: Signature = undefined; - if (unionSignatures.length === 1 || source.typeParameters) { - signature = source; - } - else { - signature = cloneSignature(source); - // Clear resolved return type we possibly got from cloneSignature - signature.resolvedReturnType = undefined; - signature.unionSignatures = unionSignatures; + for (let i = 0; i < signatureLists.length; i++) { + for (let signature of signatureLists[i]) { + // Only process signatures with parameter lists that aren't already in the result list + if (!result || !findMatchingSignature(result, signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true)) { + let unionSignatures = findMatchingSignatures(signatureLists, signature, i); + if (unionSignatures) { + let s = signature; + // Union the result types when more than one signature matches + if (unionSignatures.length > 1) { + s = cloneSignature(signature); + // Clear resolved return type we possibly got from cloneSignature + s.resolvedReturnType = undefined; + s.unionSignatures = unionSignatures; + } + (result || (result = [])).push(s); + } } - (result || (result = [])).push(signature); } } return result || emptyArray; @@ -3612,7 +3811,7 @@ namespace ts { if (paramTag.isBracketed) { return true; } - + if (paramTag.typeExpression) { return paramTag.typeExpression.type.kind === SyntaxKind.JSDocOptionalType; } @@ -3748,6 +3947,18 @@ namespace ts { return result; } + function resolveExternalModuleTypeByLiteral(name: StringLiteral) { + let moduleSym = resolveExternalModuleName(name, name, /*includeJs*/ true); + if (moduleSym) { + let moduleSymSym = resolveExternalModuleSymbol(moduleSym); + if (moduleSymSym) { + return getTypeOfSymbol(moduleSymSym); + } + } + + return anyType; + } + function getReturnTypeOfSignature(signature: Signature): Type { if (!signature.resolvedReturnType) { if (!pushTypeResolution(signature, TypeSystemPropertyName.ResolvedReturnType)) { @@ -4040,7 +4251,7 @@ namespace ts { return (node).expression; } - // fall through; + // fall through; } return undefined; @@ -4169,11 +4380,15 @@ namespace ts { * getExportedTypeFromNamespace('JSX', 'Element') returns the JSX.Element type */ function getExportedTypeFromNamespace(namespace: string, name: string): Type { - let namespaceSymbol = getGlobalSymbol(namespace, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined); - let typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type); + let typeSymbol = getExportedSymbolFromNamespace(namespace, name); return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol); } + function getExportedSymbolFromNamespace(namespace: string, name: string): Symbol { + let namespaceSymbol = getGlobalSymbol(namespace, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined); + return namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type | SymbolFlags.Value); + } + function getGlobalESSymbolConstructorSymbol() { return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } @@ -5489,7 +5704,7 @@ namespace ts { } let result = Ternary.True; for (let i = 0, len = sourceSignatures.length; i < len; ++i) { - let related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*compareReturnTypes*/ true, isRelatedTo); + let related = compareSignatures(sourceSignatures[i], targetSignatures[i], /*partialMatch*/ false, /*ignoreReturnTypes*/ false, isRelatedTo); if (!related) { return Ternary.False; } @@ -5619,14 +5834,18 @@ namespace ts { return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } - function compareSignatures(source: Signature, target: Signature, compareReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary { + function compareSignatures(source: Signature, target: Signature, partialMatch: boolean, ignoreReturnTypes: boolean, compareTypes: (s: Type, t: Type) => Ternary): Ternary { if (source === target) { return Ternary.True; } if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { - return Ternary.False; + if (!partialMatch || + source.parameters.length < target.parameters.length && !source.hasRestParameter || + source.minArgumentCount > target.minArgumentCount) { + return Ternary.False; + } } let result = Ternary.True; if (source.typeParameters && target.typeParameters) { @@ -5648,16 +5867,18 @@ namespace ts { // M and N (the signatures) are instantiated using type Any as the type argument for all type parameters declared by M and N source = getErasedSignature(source); target = getErasedSignature(target); - for (let i = 0, len = source.parameters.length; i < len; i++) { - let s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); - let t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + let sourceLen = source.parameters.length; + let targetLen = target.parameters.length; + for (let i = 0; i < targetLen; i++) { + let s = source.hasRestParameter && i === sourceLen - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + let t = target.hasRestParameter && i === targetLen - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); let related = compareTypes(s, t); if (!related) { return Ternary.False; } result &= related; } - if (compareReturnTypes) { + if (!ignoreReturnTypes) { result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } return result; @@ -7189,20 +7410,13 @@ namespace ts { let signatureList: Signature[]; let types = (type).types; for (let current of types) { - // The signature set of all constituent type with call signatures should match - // So number of signatures allowed is either 0 or 1 - if (signatureList && - getSignaturesOfStructuredType(current, SignatureKind.Call).length > 1) { - return undefined; - } - let signature = getNonGenericSignature(current); if (signature) { if (!signatureList) { // This signature will contribute to contextual union signature signatureList = [signature]; } - else if (!compareSignatures(signatureList[0], signature, /*compareReturnTypes*/ false, compareTypes)) { + else if (!compareSignatures(signatureList[0], signature, /*partialMatch*/ false, /*ignoreReturnTypes*/ true, compareTypes)) { // Signatures aren't identical, do not use return undefined; } @@ -8631,7 +8845,6 @@ namespace ts { } // fall-through - case SyntaxKind.PropertyDeclaration: case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: @@ -8681,7 +8894,6 @@ namespace ts { // a string or a symbol, based on the name of the parameter's containing method. // fall-through - case SyntaxKind.PropertyDeclaration: case SyntaxKind.MethodDeclaration: case SyntaxKind.GetAccessor: @@ -9071,8 +9283,8 @@ namespace ts { } let funcType = checkExpression(node.expression); - let apparentType = getApparentType(funcType); + let apparentType = getApparentType(funcType); if (apparentType === unknownType) { // Another error has already been reported return resolveErrorCall(node); @@ -9313,6 +9525,15 @@ namespace ts { return anyType; } } + + let exprType = getTypeOfExpression(node.expression); + if((exprType === cjsRequireType) || + (exprType === amdRequireType)) { + if(node.arguments.length === 1 && node.arguments[0].kind === SyntaxKind.StringLiteral) { + return resolveExternalModuleTypeByLiteral(node.arguments[0]); + } + } + return getReturnTypeOfSignature(signature); } @@ -9338,6 +9559,86 @@ namespace ts { pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; } + // A function expression is a CommonJS Wrapper function if it has + // 1 parameter named 'require', two parameters named 'require' and 'exports', + // or 3 parameters named 'require', 'exports', and 'module' in that exact order + function isCommonJsWrapper(expression: FunctionExpression|ArrowFunction): boolean { + switch(expression.parameters.length) { + case 3: + if((expression.parameters[2].name).text !== 'module') { + return false; + } + // fall-through + case 2: + if((expression.parameters[1].name).text !== 'exports') { + return false; + } + // fall-through + case 1: + if ((expression.parameters[0].name).text !== 'require') { + return false; + } + return true; + default: + return false; + } + } + + function assignDefineOrRequireCallParameterTypes(funcExpr: FunctionExpression|ArrowFunction) { + let callExpr = funcExpr.parent; + + let moduleNames = callExpr.arguments[callExpr.arguments.indexOf(funcExpr) - 1]; + let hasDependencyArray = moduleNames && moduleNames.kind === SyntaxKind.ArrayLiteralExpression; + + if (!hasDependencyArray && isCommonJsWrapper(funcExpr)) { + // CommonJS wrapper + // Fall-throughs here are intentional + switch(funcExpr.parameters.length) { + case 3: + getSymbolLinks(funcExpr.parameters[2].symbol).type = cjsModuleType; + case 2: + getSymbolLinks(funcExpr.parameters[1].symbol).type = cjsExportsType; + case 1: + getSymbolLinks(funcExpr.parameters[0].symbol).type = cjsRequireType; + } + + return; + } + + // Example: define(['my', 'dependency', 'array'], function(m, d, a) { ... } ) + if (hasDependencyArray) { + // Note that you might require more modules than you accept as parameters; this is fine + for (let i = 0; i < funcExpr.parameters.length; i++) { + if (moduleNames.elements.length === i) { + // We exhausted the list of modules. TODO: Issue an error; this is bad. + break; + } + + let links = getSymbolLinks(funcExpr.parameters[i].symbol); + if (moduleNames.elements[i].kind === SyntaxKind.StringLiteral) { + let moduleName = getTextOfNode(moduleNames.elements[i]); + + let unquotedName = moduleName.substr(1, moduleName.length - 2); + if (unquotedName === 'require') { + links.type = cjsRequireType; + } + else if (unquotedName === 'exports') { + links.type = cjsExportsType; + } + else if (unquotedName === 'module') { + links.type = cjsModuleType; + } + else { + links.type = resolveExternalModuleTypeByLiteral(moduleNames.elements[i]); + } + } + else { + links.type = anyType; + } + } + } + } + function assignContextualParameterTypes(signature: Signature, context: Signature, mapper: TypeMapper) { let len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); for (let i = 0; i < len; i++) { @@ -9655,6 +9956,11 @@ namespace ts { } } + // Handle 'define' calls + if (node.parent.kind === SyntaxKind.CallExpression && isDefineCall(node.parent)) { + assignDefineOrRequireCallParameterTypes(node); + } + if (produceDiagnostics && node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) { checkCollisionWithCapturedSuperVariable(node, (node).name); checkCollisionWithCapturedThisVariable(node, (node).name); @@ -11628,9 +11934,16 @@ namespace ts { // serialize the type metadata. if (node && node.kind === SyntaxKind.TypeReference) { let root = getFirstIdentifier((node).typeName); - let rootSymbol = resolveName(root, root.text, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); - if (rootSymbol && rootSymbol.flags & SymbolFlags.Alias && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { - markAliasSymbolAsReferenced(rootSymbol); + let meaning = root.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace; + // Resolve type so we know which symbol is referenced + let rootSymbol = resolveName(root, root.text, meaning | SymbolFlags.Alias, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + // Resolved symbol is alias + if (rootSymbol && rootSymbol.flags & SymbolFlags.Alias) { + let aliasTarget = resolveAlias(rootSymbol); + // If alias has value symbol - mark alias as referenced + if (aliasTarget.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { + markAliasSymbolAsReferenced(rootSymbol); + } } } } @@ -13566,7 +13879,7 @@ namespace ts { } } else { - if (languageVersion >= ScriptTarget.ES6) { + if (languageVersion >= ScriptTarget.ES6 && !isInAmbientContext(node)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead); } @@ -14070,8 +14383,9 @@ namespace ts { if (className) { copySymbol(location.symbol, meaning); } - // fall through; this fall-through is necessary because we would like to handle - // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration + + // fall through; this fall-through is necessary because we would like to handle + // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: // If we didn't come from static member of class or interface, @@ -14089,7 +14403,11 @@ namespace ts { } break; } - + + if (introducesArgumentsExoticObject(location)) { + copySymbol(argumentsSymbol, meaning); + } + memberFlags = location.flags; location = location.parent; } @@ -14642,6 +14960,10 @@ namespace ts { // Resolve the symbol as a type so that we can provide a more useful hint for the type serializer. let typeSymbol = resolveEntityName(typeName, SymbolFlags.Type, /*ignoreErrors*/ true); + // We might not be able to resolve type symbol so use unknown type in that case (eg error case) + if (!typeSymbol) { + return TypeReferenceSerializationKind.ObjectType; + } let type = getDeclaredTypeOfSymbol(typeSymbol); if (type === unknownType) { return TypeReferenceSerializationKind.Unknown; @@ -14794,10 +15116,23 @@ namespace ts { }); // Initialize special symbols + if (compilerOptions.allowNonTsExtensions) { + let req = getExportedSymbolFromNamespace('AMD', 'require'); + if (req) { + globals['require'] = req; + } + + let def = getExportedSymbolFromNamespace('AMD', 'define'); + if (def) { + globals['define'] = def; + } + } + getSymbolLinks(undefinedSymbol).type = undefinedType; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; + // Initialize special types globalArrayType = getGlobalType("Array", /*arity*/ 1); globalObjectType = getGlobalType("Object"); @@ -14820,6 +15155,12 @@ namespace ts { getGlobalPromiseConstructorLikeType = memoize(() => getGlobalType("PromiseConstructorLike")); getGlobalThenableType = memoize(createThenableType); + cjsModuleType = getExportedTypeFromNamespace('CommonJS', 'Module'); + cjsExportsType = getExportedTypeFromNamespace('CommonJS', 'Exports'); + cjsRequireType = getExportedTypeFromNamespace('CommonJS', 'Require'); + amdRequireType = getExportedTypeFromNamespace('AMD', 'Require'); + + // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. if (languageVersion >= ScriptTarget.ES6) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 9a984b9a2f12a..7a7ba34da87eb 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -120,6 +120,13 @@ namespace ts { { name: "out", type: "string", + isFilePath: false, // This is intentionally broken to support compatability with existing tsconfig files + // for correct behaviour, please use outFile + paramType: Diagnostics.FILE, + }, + { + name: "outFile", + type: "string", isFilePath: true, description: Diagnostics.Concatenate_and_emit_output_to_single_file, paramType: Diagnostics.FILE, @@ -218,7 +225,16 @@ namespace ts { type: "boolean", experimental: true, description: Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators - } + }, + { + name: "moduleResolution", + type: { + "node": ModuleResolutionKind.NodeJs, + "classic": ModuleResolutionKind.Classic + }, + experimental: true, + description: Diagnostics.Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6 + } ]; export function parseCommandLine(commandLine: string[]): ParsedCommandLine { diff --git a/src/compiler/core.ts b/src/compiler/core.ts index d667bd92df939..a9482e19539d6 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -24,6 +24,7 @@ namespace ts { set, contains, remove, + clear, forEachValue: forEachValueInMap }; @@ -51,6 +52,10 @@ namespace ts { function normalizeKey(key: string) { return getCanonicalFileName(normalizeSlashes(key)); } + + function clear() { + files = {}; + } } export const enum Comparison { @@ -716,7 +721,9 @@ namespace ts { /** * List of supported extensions in order of file resolution precedence. */ - export const supportedExtensions = [".tsx", ".ts", ".d.ts"]; + export const supportedExtensions = [".ts", ".tsx", ".d.ts"]; + + export const supportedJsExtensions = supportedExtensions.concat(".js"); const extensionsToRemove = [".d.ts", ".ts", ".js", ".tsx", ".jsx"]; export function removeFileExtension(path: string): string { diff --git a/src/compiler/declarationEmitter.ts b/src/compiler/declarationEmitter.ts index a490ba39a46fd..85513e8719fc3 100644 --- a/src/compiler/declarationEmitter.ts +++ b/src/compiler/declarationEmitter.ts @@ -1574,7 +1574,7 @@ namespace ts { ? referencedFile.fileName // Declaration file, use declaration file name : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") // Own output file so get the .d.ts file - : removeFileExtension(compilerOptions.out) + ".d.ts"; // Global out file + : removeFileExtension(compilerOptions.outFile || compilerOptions.out) + ".d.ts"; // Global out file declFileName = getRelativePathToDirectoryOrUrl( getDirectoryPath(normalizeSlashes(jsFilePath)), diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 5ccc0a0db9b40..76c68b4c3b4b0 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -506,19 +506,11 @@ namespace ts { Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.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: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, - Option_declaration_cannot_be_specified_with_option_isolatedModules: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'isolatedModules'." }, - Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'." }, - Option_out_cannot_be_specified_with_option_isolatedModules: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'isolatedModules'." }, Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, - Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, - Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, - Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, + Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified without specifying option '{1}'." }, + Option_0_cannot_be_specified_with_option_1: { code: 5053, category: DiagnosticCategory.Error, key: "Option '{0}' cannot be specified with option '{1}'." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -569,11 +561,11 @@ namespace ts { Argument_for_newLine_option_must_be_CRLF_or_LF: { code: 6062, category: DiagnosticCategory.Error, key: "Argument for '--newLine' option must be 'CRLF' or 'LF'." }, Specify_JSX_code_generation_Colon_preserve_or_react: { code: 6080, category: DiagnosticCategory.Message, key: "Specify JSX code generation: 'preserve' or 'react'" }, Argument_for_jsx_must_be_preserve_or_react: { code: 6081, category: DiagnosticCategory.Message, key: "Argument for '--jsx' must be 'preserve' or 'react'." }, - Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified: { code: 6064, category: DiagnosticCategory.Error, key: "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified." }, Enables_experimental_support_for_ES7_decorators: { code: 6065, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 decorators." }, Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: DiagnosticCategory.Message, key: "Enables experimental support for emitting type metadata for decorators." }, Option_experimentalAsyncFunctions_cannot_be_specified_when_targeting_ES5_or_lower: { code: 6067, category: DiagnosticCategory.Message, key: "Option 'experimentalAsyncFunctions' cannot be specified when targeting ES5 or lower." }, Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: DiagnosticCategory.Message, key: "Enables experimental support for ES7 async functions." }, + Specifies_module_resolution_strategy_Colon_node_Node_or_classic_TypeScript_pre_1_6: { code: 6069, category: DiagnosticCategory.Message, key: "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) ." }, Variable_0_implicitly_has_an_1_type: { code: 7005, category: DiagnosticCategory.Error, key: "Variable '{0}' implicitly has an '{1}' type." }, Parameter_0_implicitly_has_an_1_type: { code: 7006, category: DiagnosticCategory.Error, key: "Parameter '{0}' implicitly has an '{1}' type." }, Member_0_implicitly_has_an_1_type: { code: 7008, category: DiagnosticCategory.Error, key: "Member '{0}' implicitly has an '{1}' type." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e138e2ddac489..8113722ff3c77 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -2013,59 +2013,27 @@ "category": "Error", "code": 5033 }, - "Option 'mapRoot' cannot be specified without specifying 'sourceMap' option.": { - "category": "Error", - "code": 5038 - }, - "Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option.": { - "category": "Error", - "code": 5039 - }, - "Option 'noEmit' cannot be specified with option 'out' or 'outDir'.": { - "category": "Error", - "code": 5040 - }, - "Option 'noEmit' cannot be specified with option 'declaration'.": { - "category": "Error", - "code": 5041 - }, "Option 'project' cannot be mixed with source files on a command line.": { "category": "Error", "code": 5042 }, - "Option 'declaration' cannot be specified with option 'isolatedModules'.": { - "category": "Error", - "code": 5044 - }, - "Option 'noEmitOnError' cannot be specified with option 'isolatedModules'.": { - "category": "Error", - "code": 5045 - }, - "Option 'out' cannot be specified with option 'isolatedModules'.": { - "category": "Error", - "code": 5046 - }, "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": { "category": "Error", "code": 5047 }, - "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.": { - "category": "Error", - "code": 5048 - }, - "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'.": { + "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": { "category": "Error", - "code": 5049 + "code": 5051 }, - "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'.": { + "Option '{0}' cannot be specified without specifying option '{1}'.": { "category": "Error", - "code": 5050 + "code": 5052 }, - "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided.": { + "Option '{0}' cannot be specified with option '{1}'.": { "category": "Error", - "code": 5051 + "code": 5053 }, - + "Concatenate and emit output to single file.": { "category": "Message", "code": 6001 @@ -2266,10 +2234,6 @@ "category": "Message", "code": 6081 }, - "Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified.": { - "category": "Error", - "code": 6064 - }, "Enables experimental support for ES7 decorators.": { "category": "Message", "code": 6065 @@ -2286,6 +2250,10 @@ "category": "Message", "code": 6068 }, + "Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6) .": { + "category": "Message", + "code": 6069 + }, "Variable '{0}' implicitly has an '{1}' type.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 32ea13b6338f7..abcc32c1198f2 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -78,18 +78,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } }); - if (compilerOptions.out) { - emitFile(compilerOptions.out); + if (compilerOptions.outFile || compilerOptions.out) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } else { // targetSourceFile is specified (e.g calling emitter from language service or calling getSemanticDiagnostic from language service) if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { - let jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, forEach(host.getSourceFiles(), shouldEmitJsx) ? ".jsx" : ".js"); + let jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, shouldEmitJsx(targetSourceFile) ? ".jsx" : ".js"); emitFile(jsFilePath, targetSourceFile); } - else if (!isDeclarationFile(targetSourceFile) && compilerOptions.out) { - emitFile(compilerOptions.out); + else if (!isDeclarationFile(targetSourceFile) && (compilerOptions.outFile || compilerOptions.out)) { + emitFile(compilerOptions.outFile || compilerOptions.out); } } @@ -163,7 +163,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let writeComment = writeCommentRange; /** Emit a node */ - let emit = emitNodeWithoutSourceMap; + let emit = emitNodeWithCommentsAndWithoutSourcemap; /** Called just before starting emit of a node */ let emitStart = function (node: Node) { }; @@ -687,9 +687,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } } + + function emitNodeWithCommentsAndWithSourcemap(node: Node) { + emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap); + } writeEmittedFiles = writeJavaScriptAndSourceMapFile; - emit = emitNodeWithSourceMap; + emit = emitNodeWithCommentsAndWithSourcemap; emitStart = recordEmitNodeStartSpan; emitEnd = recordEmitNodeEndSpan; emitToken = writeTextWithSpanRecord; @@ -832,7 +836,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(", "); } } - emitNode(nodes[start + i]); + let node = nodes[start + i]; + // This emitting is to make sure we emit following comment properly + // ...(x, /*comment1*/ y)... + // ^ => node.pos + // "comment1" is not considered leading comment for "y" but rather + // considered as trailing comment of the previous node. + emitTrailingCommentsOfPosition(node.pos); + emitNode(node); leadingComma = true; } if (trailingComma) { @@ -1508,7 +1519,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return; } } - writeTextOfNode(currentSourceFile, node); + + if (nodeIsSynthesized(node)) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } } function isNameOfNestedRedeclaration(node: Identifier) { @@ -1535,6 +1552,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi else if (isNameOfNestedRedeclaration(node)) { write(getGeneratedNameForNode(node)); } + else if (nodeIsSynthesized(node)) { + write(node.text); + } else { writeTextOfNode(currentSourceFile, node); } @@ -1976,6 +1996,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitPropertyAssignment(node: PropertyDeclaration) { emit(node.name); write(": "); + // This is to ensure that we emit comment in the following case: + // For example: + // obj = { + // id: /*comment1*/ ()=>void + // } + // "comment1" is not considered to be leading comment for node.initializer + // but rather a trailing comment on the previous node. + emitTrailingCommentsOfPosition(node.initializer.pos); emit(node.initializer); } @@ -2111,7 +2139,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } write("."); - emitNodeWithoutSourceMap(node.right); + emit(node.right); } function emitEntityNameAsExpression(node: EntityName, useFallback: boolean) { @@ -2803,7 +2831,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitNodeWithoutSourceMap(counter); write(" < "); - emitNodeWithoutSourceMap(rhsReference); + emitNodeWithCommentsAndWithoutSourcemap(rhsReference); write(".length"); emitEnd(node.initializer); @@ -2838,7 +2866,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi else { // The following call does not include the initializer, so we have // to emit it separately. - emitNodeWithoutSourceMap(declaration); + emitNodeWithCommentsAndWithoutSourcemap(declaration); write(" = "); emitNodeWithoutSourceMap(rhsIterationValue); } @@ -2861,7 +2889,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined); } else { - emitNodeWithoutSourceMap(assignmentExpression); + emitNodeWithCommentsAndWithoutSourcemap(assignmentExpression); } } emitEnd(node.initializer); @@ -3017,7 +3045,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("exports."); } } - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); emitEnd(node.name); } @@ -3063,7 +3091,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write("default"); } else { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } write(`", `); emitDeclarationName(node); @@ -3101,7 +3129,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitStart(specifier.name); emitContainingModuleName(specifier); write("."); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); emitEnd(specifier.name); write(" = "); emitExpressionIdentifier(name); @@ -3116,7 +3144,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi writeLine(); emitStart(specifier.name); write(`${exportFunctionForFile}("`); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); write(`", `); emitExpressionIdentifier(specifier.propertyName || specifier.name); write(")"); @@ -3161,7 +3189,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (exportChanged) { write(`${exportFunctionForFile}("`); - emitNodeWithoutSourceMap(name); + emitNodeWithCommentsAndWithoutSourcemap(name); write(`", `); } @@ -3393,7 +3421,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (exportChanged) { write(`${exportFunctionForFile}("`); - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); write(`", `); } @@ -3549,9 +3577,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitEnd(parameter); write(" { "); emitStart(parameter); - emitNodeWithoutSourceMap(paramName); + emitNodeWithCommentsAndWithoutSourcemap(paramName); write(" = "); - emitNodeWithoutSourceMap(initializer); + emitNodeWithCommentsAndWithoutSourcemap(initializer); emitEnd(parameter); write("; }"); } @@ -3574,7 +3602,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitLeadingComments(restParam); emitStart(restParam); write("var "); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write(" = [];"); emitEnd(restParam); emitTrailingComments(restParam); @@ -3595,7 +3623,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi increaseIndent(); writeLine(); emitStart(restParam); - emitNodeWithoutSourceMap(restParam.name); + emitNodeWithCommentsAndWithoutSourcemap(restParam.name); write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); emitEnd(restParam); decreaseIndent(); @@ -3616,7 +3644,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function emitDeclarationName(node: Declaration) { if (node.name) { - emitNodeWithoutSourceMap(node.name); + emitNodeWithCommentsAndWithoutSourcemap(node.name); } else { write(getGeneratedNameForNode(node)); @@ -3639,11 +3667,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) { - // Methods will emit the comments as part of emitting method declaration + // TODO (yuisu) : we should not have special cases to condition emitting comments + // but have one place to fix check for these conditions. + if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature && + node.parent && node.parent.kind !== SyntaxKind.PropertyAssignment && + node.parent.kind !== SyntaxKind.CallExpression) { + // 1. Methods will emit the comments as part of emitting method declaration + + // 2. If the function is a property of object literal, emitting leading-comments + // is done by emitNodeWithoutSourceMap which then call this function. + // In particular, we would like to avoid emit comments twice in following case: + // For example: + // var obj = { + // id: + // /*comment*/ () => void + // } + + // 3. If the function is an argument in call expression, emitting of comments will be + // taken care of in emit list of arguments inside of emitCallexpression emitLeadingComments(node); } + emitStart(node); // For targeting below es6, emit functions-like declaration including arrow function using function keyword. // When targeting ES6, emit arrow function natively in ES6 by omitting function keyword and using fat arrow instead if (!shouldEmitAsArrowFunction(node)) { @@ -3669,6 +3714,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments((node).name); } + + emitEnd(node); if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) { emitTrailingComments(node); } @@ -4024,10 +4071,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitMemberAccessForPropertyName(memberName: DeclarationName) { - // TODO: (jfreeman,drosen): comment on why this is emitNodeWithoutSourceMap instead of emit here. + // This does not emit source map because it is emitted by caller as caller + // is aware how the property name changes to the property access + // eg. public x = 10; becomes this.x and static x = 10 becomes className.x if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { write("["); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); write("]"); } else if (memberName.kind === SyntaxKind.ComputedPropertyName) { @@ -4035,7 +4084,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else { write("."); - emitNodeWithoutSourceMap(memberName); + emitNodeWithCommentsAndWithoutSourcemap(memberName); } } @@ -4103,10 +4152,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitMemberAccessForPropertyName((member).name); emitEnd((member).name); write(" = "); - emitStart(member); emitFunctionDeclaration(member); emitEnd(member); - emitEnd(member); write(";"); emitTrailingComments(member); } @@ -5093,7 +5140,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi argumentsWritten++; } if (shouldEmitParamTypesMetadata(node)) { - debugger; if (writeComma || argumentsWritten) { write(", "); } @@ -5312,13 +5358,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitExportMemberAssignments(node.name); } } + + /* + * Some bundlers (SystemJS builder) sometimes want to rename dependencies. + * Here we check if alternative name was provided for a given moduleName and return it if possible. + */ + function tryRenameExternalModule(moduleName: LiteralExpression): string { + if (currentSourceFile.renamedDependencies && hasProperty(currentSourceFile.renamedDependencies, moduleName.text)) { + return `"${currentSourceFile.renamedDependencies[moduleName.text]}"` + } + return undefined; + } function emitRequire(moduleName: Expression) { if (moduleName.kind === SyntaxKind.StringLiteral) { write("require("); - emitStart(moduleName); - emitLiteral(moduleName); - emitEnd(moduleName); + let text = tryRenameExternalModule(moduleName); + if (text) { + write(text); + } + else { + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + } emitToken(SyntaxKind.CloseParenToken, moduleName.end); } else { @@ -5532,11 +5595,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitStart(specifier); emitContainingModuleName(specifier); write("."); - emitNodeWithoutSourceMap(specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.name); write(" = "); write(generatedName); write("."); - emitNodeWithoutSourceMap(specifier.propertyName || specifier.name); + emitNodeWithCommentsAndWithoutSourcemap(specifier.propertyName || specifier.name); write(";"); emitEnd(specifier); } @@ -5559,7 +5622,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } else { if (!node.exportClause || resolver.isValueAliasDeclaration(node)) { - emitStart(node); write("export "); if (node.exportClause) { // export { x, y, ... } @@ -5572,10 +5634,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } if (node.moduleSpecifier) { write(" from "); - emitNodeWithoutSourceMap(node.moduleSpecifier); + emit(node.moduleSpecifier); } write(";"); - emitEnd(node); } } } @@ -5589,13 +5650,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (needsComma) { write(", "); } - emitStart(specifier); if (specifier.propertyName) { - emitNodeWithoutSourceMap(specifier.propertyName); + emit(specifier.propertyName); write(" as "); } - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier); + emit(specifier.name); needsComma = true; } } @@ -5721,7 +5780,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string { let moduleName = getExternalModuleName(importNode); if (moduleName.kind === SyntaxKind.StringLiteral) { - return getLiteralText(moduleName); + return tryRenameExternalModule(moduleName) || getLiteralText(moduleName); } return undefined; @@ -5882,7 +5941,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi writeLine(); write("'"); if (node.kind === SyntaxKind.Identifier) { - emitNodeWithoutSourceMap(node); + emitNodeWithCommentsAndWithoutSourcemap(node); } else { emitDeclarationName(node); @@ -6180,9 +6239,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi let e = (entry).exportClause.elements[i]; write(`"`); - emitNodeWithoutSourceMap(e.name); + emitNodeWithCommentsAndWithoutSourcemap(e.name); write(`": ${parameterName}["`); - emitNodeWithoutSourceMap(e.propertyName || e.name); + emitNodeWithCommentsAndWithoutSourcemap(e.propertyName || e.name); write(`"]`); } decreaseIndent(); @@ -6286,10 +6345,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi groupIndices[text] = dependencyGroups.length; dependencyGroups.push([externalImports[i]]); } - + if (i !== 0) { write(", "); } + write(text); } write(`], function(${exportFunctionForFile}) {`); @@ -6461,9 +6521,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } - function trimReactWhitespace(node: JsxText): string { + function trimReactWhitespaceAndApplyEntities(node: JsxText): string { let result: string = undefined; - let text = getTextOfNode(node); + let text = getTextOfNode(node, /*includeTrivia*/ true); let firstNonWhitespace = 0; let lastNonWhitespace = -1; @@ -6486,19 +6546,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } } + if (firstNonWhitespace !== -1) { let part = text.substr(firstNonWhitespace); result = (result ? result + "\" + ' ' + \"" : "") + part; } + if (result) { + // Replace entities like   + result = result.replace(/&(\w+);/g, function(s: any, m: string) { + if (entities[m] !== undefined) { + return String.fromCharCode(entities[m]); + } + else { + return s; + } + }); + } + return result; } function getTextToEmit(node: JsxText) { switch (compilerOptions.jsx) { case JsxEmit.React: - let text = trimReactWhitespace(node); - if (text.length === 0) { + let text = trimReactWhitespaceAndApplyEntities(node); + if (text === undefined || text.length === 0) { return undefined; } else { @@ -6506,7 +6579,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } case JsxEmit.Preserve: default: - return getTextOfNode(node, true); + return getTextOfNode(node, /*includeTrivia*/ true); } } @@ -6514,13 +6587,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi switch (compilerOptions.jsx) { case JsxEmit.React: write("\""); - write(trimReactWhitespace(node)); + write(trimReactWhitespaceAndApplyEntities(node)); write("\""); break; case JsxEmit.Preserve: default: // Emit JSX-preserve as default when no --jsx flag is specified - writer.writeLiteral(getTextOfNode(node, true)); + writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); break; } } @@ -6638,28 +6711,41 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitLeadingComments(node.endOfFileToken); } - function emitNodeWithoutSourceMap(node: Node): void { - if (!node) { - return; - } + function emitNodeWithCommentsAndWithoutSourcemap(node: Node): void { + emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap); + } - if (node.flags & NodeFlags.Ambient) { - return emitOnlyPinnedOrTripleSlashComments(node); - } + function emitNodeConsideringCommentsOption(node: Node, emitNodeConsideringSourcemap: (node: Node) => void): void { + if (node) { + if (node.flags & NodeFlags.Ambient) { + return emitOnlyPinnedOrTripleSlashComments(node); + } - let emitComments = shouldEmitLeadingAndTrailingComments(node); - if (emitComments) { - emitLeadingComments(node); - } + if (isSpecializedCommentHandling(node)) { + // This is the node that will handle its own comments and sourcemap + return emitNodeWithoutSourceMap(node); + } + + let emitComments = shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { + emitLeadingComments(node); + } - emitJavaScriptWorker(node); + emitNodeConsideringSourcemap(node); - if (emitComments) { - emitTrailingComments(node); + if (emitComments) { + emitTrailingComments(node); + } } } - function shouldEmitLeadingAndTrailingComments(node: Node) { + function emitNodeWithoutSourceMap(node: Node): void { + if (node) { + emitJavaScriptWorker(node); + } + } + + function isSpecializedCommentHandling(node: Node): boolean { switch (node.kind) { // All of these entities are emitted in a specialized fashion. As such, we allow // the specialized methods for each to handle the comments on the nodes. @@ -6669,8 +6755,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ExportAssignment: - return false; + return true; + } + } + function shouldEmitLeadingAndTrailingComments(node: Node) { + switch (node.kind) { case SyntaxKind.VariableStatement: return shouldEmitLeadingAndTrailingCommentsForVariableStatement(node); @@ -6685,6 +6775,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi return shouldEmitEnumDeclaration(node); } + // If the node is emitted in specialized fashion, dont emit comments as this node will handle + // emitting comments when emitting itself + Debug.assert(!isSpecializedCommentHandling(node)); + // If this is the expression body of an arrow function that we're down-leveling, // then we don't want to emit comments when we emit the body. It will have already // been taken care of when we emitted the 'return' statement for the function @@ -6961,6 +7055,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ false, newLine, writeComment); } + /** + * Emit trailing comments at the position. The term trailing comment is used here to describe following comment: + * x, /comment1/ y + * ^ => pos; the function will emit "comment1" in the emitJS + */ + function emitTrailingCommentsOfPosition(pos: number) { + let trailingComments = filterComments(getTrailingCommentRanges(currentSourceFile.text, pos), /*onlyPinnedOrTripleSlashComments:*/ compilerOptions.removeComments); + + // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment*/ + emitComments(currentSourceFile, writer, trailingComments, /*trailingSeparator*/ true, newLine, writeComment); + } + function emitLeadingCommentsOfPosition(pos: number) { let leadingComments: CommentRange[]; if (hasDetachedComments(pos)) { @@ -7054,4 +7160,260 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } } } + + var entities: Map = { + "quot": 0x0022, + "amp": 0x0026, + "apos": 0x0027, + "lt": 0x003C, + "gt": 0x003E, + "nbsp": 0x00A0, + "iexcl": 0x00A1, + "cent": 0x00A2, + "pound": 0x00A3, + "curren": 0x00A4, + "yen": 0x00A5, + "brvbar": 0x00A6, + "sect": 0x00A7, + "uml": 0x00A8, + "copy": 0x00A9, + "ordf": 0x00AA, + "laquo": 0x00AB, + "not": 0x00AC, + "shy": 0x00AD, + "reg": 0x00AE, + "macr": 0x00AF, + "deg": 0x00B0, + "plusmn": 0x00B1, + "sup2": 0x00B2, + "sup3": 0x00B3, + "acute": 0x00B4, + "micro": 0x00B5, + "para": 0x00B6, + "middot": 0x00B7, + "cedil": 0x00B8, + "sup1": 0x00B9, + "ordm": 0x00BA, + "raquo": 0x00BB, + "frac14": 0x00BC, + "frac12": 0x00BD, + "frac34": 0x00BE, + "iquest": 0x00BF, + "Agrave": 0x00C0, + "Aacute": 0x00C1, + "Acirc": 0x00C2, + "Atilde": 0x00C3, + "Auml": 0x00C4, + "Aring": 0x00C5, + "AElig": 0x00C6, + "Ccedil": 0x00C7, + "Egrave": 0x00C8, + "Eacute": 0x00C9, + "Ecirc": 0x00CA, + "Euml": 0x00CB, + "Igrave": 0x00CC, + "Iacute": 0x00CD, + "Icirc": 0x00CE, + "Iuml": 0x00CF, + "ETH": 0x00D0, + "Ntilde": 0x00D1, + "Ograve": 0x00D2, + "Oacute": 0x00D3, + "Ocirc": 0x00D4, + "Otilde": 0x00D5, + "Ouml": 0x00D6, + "times": 0x00D7, + "Oslash": 0x00D8, + "Ugrave": 0x00D9, + "Uacute": 0x00DA, + "Ucirc": 0x00DB, + "Uuml": 0x00DC, + "Yacute": 0x00DD, + "THORN": 0x00DE, + "szlig": 0x00DF, + "agrave": 0x00E0, + "aacute": 0x00E1, + "acirc": 0x00E2, + "atilde": 0x00E3, + "auml": 0x00E4, + "aring": 0x00E5, + "aelig": 0x00E6, + "ccedil": 0x00E7, + "egrave": 0x00E8, + "eacute": 0x00E9, + "ecirc": 0x00EA, + "euml": 0x00EB, + "igrave": 0x00EC, + "iacute": 0x00ED, + "icirc": 0x00EE, + "iuml": 0x00EF, + "eth": 0x00F0, + "ntilde": 0x00F1, + "ograve": 0x00F2, + "oacute": 0x00F3, + "ocirc": 0x00F4, + "otilde": 0x00F5, + "ouml": 0x00F6, + "divide": 0x00F7, + "oslash": 0x00F8, + "ugrave": 0x00F9, + "uacute": 0x00FA, + "ucirc": 0x00FB, + "uuml": 0x00FC, + "yacute": 0x00FD, + "thorn": 0x00FE, + "yuml": 0x00FF, + "OElig": 0x0152, + "oelig": 0x0153, + "Scaron": 0x0160, + "scaron": 0x0161, + "Yuml": 0x0178, + "fnof": 0x0192, + "circ": 0x02C6, + "tilde": 0x02DC, + "Alpha": 0x0391, + "Beta": 0x0392, + "Gamma": 0x0393, + "Delta": 0x0394, + "Epsilon": 0x0395, + "Zeta": 0x0396, + "Eta": 0x0397, + "Theta": 0x0398, + "Iota": 0x0399, + "Kappa": 0x039A, + "Lambda": 0x039B, + "Mu": 0x039C, + "Nu": 0x039D, + "Xi": 0x039E, + "Omicron": 0x039F, + "Pi": 0x03A0, + "Rho": 0x03A1, + "Sigma": 0x03A3, + "Tau": 0x03A4, + "Upsilon": 0x03A5, + "Phi": 0x03A6, + "Chi": 0x03A7, + "Psi": 0x03A8, + "Omega": 0x03A9, + "alpha": 0x03B1, + "beta": 0x03B2, + "gamma": 0x03B3, + "delta": 0x03B4, + "epsilon": 0x03B5, + "zeta": 0x03B6, + "eta": 0x03B7, + "theta": 0x03B8, + "iota": 0x03B9, + "kappa": 0x03BA, + "lambda": 0x03BB, + "mu": 0x03BC, + "nu": 0x03BD, + "xi": 0x03BE, + "omicron": 0x03BF, + "pi": 0x03C0, + "rho": 0x03C1, + "sigmaf": 0x03C2, + "sigma": 0x03C3, + "tau": 0x03C4, + "upsilon": 0x03C5, + "phi": 0x03C6, + "chi": 0x03C7, + "psi": 0x03C8, + "omega": 0x03C9, + "thetasym": 0x03D1, + "upsih": 0x03D2, + "piv": 0x03D6, + "ensp": 0x2002, + "emsp": 0x2003, + "thinsp": 0x2009, + "zwnj": 0x200C, + "zwj": 0x200D, + "lrm": 0x200E, + "rlm": 0x200F, + "ndash": 0x2013, + "mdash": 0x2014, + "lsquo": 0x2018, + "rsquo": 0x2019, + "sbquo": 0x201A, + "ldquo": 0x201C, + "rdquo": 0x201D, + "bdquo": 0x201E, + "dagger": 0x2020, + "Dagger": 0x2021, + "bull": 0x2022, + "hellip": 0x2026, + "permil": 0x2030, + "prime": 0x2032, + "Prime": 0x2033, + "lsaquo": 0x2039, + "rsaquo": 0x203A, + "oline": 0x203E, + "frasl": 0x2044, + "euro": 0x20AC, + "image": 0x2111, + "weierp": 0x2118, + "real": 0x211C, + "trade": 0x2122, + "alefsym": 0x2135, + "larr": 0x2190, + "uarr": 0x2191, + "rarr": 0x2192, + "darr": 0x2193, + "harr": 0x2194, + "crarr": 0x21B5, + "lArr": 0x21D0, + "uArr": 0x21D1, + "rArr": 0x21D2, + "dArr": 0x21D3, + "hArr": 0x21D4, + "forall": 0x2200, + "part": 0x2202, + "exist": 0x2203, + "empty": 0x2205, + "nabla": 0x2207, + "isin": 0x2208, + "notin": 0x2209, + "ni": 0x220B, + "prod": 0x220F, + "sum": 0x2211, + "minus": 0x2212, + "lowast": 0x2217, + "radic": 0x221A, + "prop": 0x221D, + "infin": 0x221E, + "ang": 0x2220, + "and": 0x2227, + "or": 0x2228, + "cap": 0x2229, + "cup": 0x222A, + "int": 0x222B, + "there4": 0x2234, + "sim": 0x223C, + "cong": 0x2245, + "asymp": 0x2248, + "ne": 0x2260, + "equiv": 0x2261, + "le": 0x2264, + "ge": 0x2265, + "sub": 0x2282, + "sup": 0x2283, + "nsub": 0x2284, + "sube": 0x2286, + "supe": 0x2287, + "oplus": 0x2295, + "otimes": 0x2297, + "perp": 0x22A5, + "sdot": 0x22C5, + "lceil": 0x2308, + "rceil": 0x2309, + "lfloor": 0x230A, + "rfloor": 0x230B, + "lang": 0x2329, + "rang": 0x232A, + "loz": 0x25CA, + "spades": 0x2660, + "clubs": 0x2663, + "hearts": 0x2665, + "diams": 0x2666 + } } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index def08e817585f..a4c5e52503423 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3556,6 +3556,7 @@ namespace ts { callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); continue; } @@ -3563,6 +3564,7 @@ namespace ts { let callExpr = createNode(SyntaxKind.CallExpression, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); continue; } @@ -5261,6 +5263,8 @@ namespace ts { || node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ExportAssignment || node.kind === SyntaxKind.ExportDeclaration + || node.kind === SyntaxKind.ExpressionStatement && isAmdExportAssignment((node).expression) + || node.kind === SyntaxKind.CallExpression && isDefineCall(node) ? node : undefined); } @@ -5831,7 +5835,6 @@ namespace ts { if (!name) { parseErrorAtPosition(pos, 0, Diagnostics.Identifier_expected); - return undefined; } let preName: Identifier, postName: Identifier; diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 4b1f10eb649bc..43f558190b685 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -8,6 +8,9 @@ namespace ts { /* @internal */ export let ioWriteTime = 0; /** The version of the TypeScript compiler release */ + + let emptyArray: any[] = []; + export const version = "1.6.0"; export function findConfigFile(searchPath: string): string { @@ -25,6 +28,202 @@ namespace ts { } return undefined; } + + export function resolveTripleslashReference(moduleName: string, containingFile: string): string { + let basePath = getDirectoryPath(containingFile); + let referencedFileName = isRootedDiskPath(moduleName) ? moduleName : combinePaths(basePath, moduleName); + return normalizePath(referencedFileName); + } + + export function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule { + let moduleResolution = compilerOptions.moduleResolution !== undefined + ? compilerOptions.moduleResolution + : compilerOptions.module === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic; + + switch (moduleResolution) { + case ModuleResolutionKind.NodeJs: return nodeModuleNameResolver(moduleName, containingFile, host); + case ModuleResolutionKind.Classic: return classicNameResolver(moduleName, containingFile, compilerOptions, host); + } + } + + export function nodeModuleNameResolver(moduleName: string, containingFile: string, host: ModuleResolutionHost): ResolvedModule { + let containingDirectory = getDirectoryPath(containingFile); + + if (getRootLength(moduleName) !== 0 || nameStartsWithDotSlashOrDotDotSlash(moduleName)) { + let failedLookupLocations: string[] = []; + let candidate = normalizePath(combinePaths(containingDirectory, moduleName)); + let resolvedFileName = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); + + if (resolvedFileName) { + return { resolvedFileName, failedLookupLocations }; + } + + resolvedFileName = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ false, failedLookupLocations, host); + return { resolvedFileName, failedLookupLocations }; + } + else { + return loadModuleFromNodeModules(moduleName, containingDirectory, host); + } + } + + function loadNodeModuleFromFile(candidate: string, loadOnlyDts: boolean, failedLookupLocation: string[], host: ModuleResolutionHost): string { + if (loadOnlyDts) { + return tryLoad(".d.ts"); + } + else { + return forEach(supportedExtensions, tryLoad); + } + + function tryLoad(ext: string): string { + let fileName = fileExtensionIs(candidate, ext) ? candidate : candidate + ext; + if (host.fileExists(fileName)) { + return fileName; + } + else { + failedLookupLocation.push(fileName); + return undefined; + } + } + } + + function loadNodeModuleFromDirectory(candidate: string, loadOnlyDts: boolean, failedLookupLocation: string[], host: ModuleResolutionHost): string { + let packageJsonPath = combinePaths(candidate, "package.json"); + if (host.fileExists(packageJsonPath)) { + + let jsonContent: { typings?: string }; + + try { + let jsonText = host.readFile(packageJsonPath); + jsonContent = jsonText ? <{ typings?: string }>JSON.parse(jsonText) : { typings: undefined }; + } + catch (e) { + // gracefully handle if readFile fails or returns not JSON + jsonContent = { typings: undefined }; + } + + if (jsonContent.typings) { + let result = loadNodeModuleFromFile(normalizePath(combinePaths(candidate, jsonContent.typings)), loadOnlyDts, failedLookupLocation, host); + if (result) { + return result; + } + } + } + else { + // record package json as one of failed lookup locations - in the future if this file will appear it will invalidate resolution results + failedLookupLocation.push(packageJsonPath); + } + + return loadNodeModuleFromFile(combinePaths(candidate, "index"), loadOnlyDts, failedLookupLocation, host); + } + + function loadModuleFromNodeModules(moduleName: string, directory: string, host: ModuleResolutionHost): ResolvedModule { + let failedLookupLocations: string[] = []; + directory = normalizeSlashes(directory); + while (true) { + let baseName = getBaseFileName(directory); + if (baseName !== "node_modules") { + let nodeModulesFolder = combinePaths(directory, "node_modules"); + let candidate = normalizePath(combinePaths(nodeModulesFolder, moduleName)); + let result = loadNodeModuleFromFile(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); + if (result) { + return { resolvedFileName: result, failedLookupLocations }; + } + + result = loadNodeModuleFromDirectory(candidate, /* loadOnlyDts */ true, failedLookupLocations, host); + if (result) { + return { resolvedFileName: result, failedLookupLocations }; + } + } + + let parentPath = getDirectoryPath(directory); + if (parentPath === directory) { + break; + } + + directory = parentPath; + } + + return { resolvedFileName: undefined, failedLookupLocations }; + } + + export function baseUrlModuleNameResolver(moduleName: string, containingFile: string, baseUrl: string, host: ModuleResolutionHost): ResolvedModule { + Debug.assert(baseUrl !== undefined); + + let normalizedModuleName = normalizeSlashes(moduleName); + let basePart = useBaseUrl(moduleName) ? baseUrl : getDirectoryPath(containingFile); + let candidate = normalizePath(combinePaths(basePart, moduleName)); + + let failedLookupLocations: string[] = []; + + return forEach(supportedExtensions, ext => tryLoadFile(candidate + ext)) || { resolvedFileName: undefined, failedLookupLocations }; + + function tryLoadFile(location: string): ResolvedModule { + if (host.fileExists(location)) { + return { resolvedFileName: location, failedLookupLocations }; + } + else { + failedLookupLocations.push(location); + return undefined; + } + } + } + + function nameStartsWithDotSlashOrDotDotSlash(name: string) { + let i = name.lastIndexOf("./", 1); + return i === 0 || (i === 1 && name.charCodeAt(0) === CharacterCodes.dot); + } + + function useBaseUrl(moduleName: string): boolean { + // path is not rooted + // module name does not start with './' or '../' + return getRootLength(moduleName) === 0 && !nameStartsWithDotSlashOrDotDotSlash(moduleName); + } + + export function classicNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost): ResolvedModule { + + // module names that contain '!' are used to reference resources and are not resolved to actual files on disk + if (moduleName.indexOf('!') != -1) { + return { resolvedFileName: undefined, failedLookupLocations: [] }; + } + + let searchPath = getDirectoryPath(containingFile); + let searchName: string; + + let failedLookupLocations: string[] = []; + + let referencedSourceFile: string; + let extensions = compilerOptions.allowNonTsExtensions ? supportedJsExtensions : supportedExtensions; + while (true) { + searchName = normalizePath(combinePaths(searchPath, moduleName)); + referencedSourceFile = forEach(extensions, extension => { + if (extension === ".tsx" && !compilerOptions.jsx) { + // resolve .tsx files only if jsx support is enabled + // 'logical not' handles both undefined and None cases + return undefined; + } + + let candidate = searchName + extension; + if (host.fileExists(candidate)) { + return candidate; + } + else { + failedLookupLocations.push(candidate); + } + }); + + if (referencedSourceFile) { + break; + } + + let parentPath = getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + + return { resolvedFileName: referencedSourceFile, failedLookupLocations }; + } export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost { let currentDirectory: string; @@ -92,7 +291,8 @@ namespace ts { } const newLine = getNewLineCharacter(options); - + + return { getSourceFile, getDefaultLibFileName: options => combinePaths(getDirectoryPath(normalizePath(sys.getExecutingFilePath())), getDefaultLibFileName(options)), @@ -100,7 +300,9 @@ namespace ts { getCurrentDirectory: () => currentDirectory || (currentDirectory = sys.getCurrentDirectory()), useCaseSensitiveFileNames: () => sys.useCaseSensitiveFileNames, getCanonicalFileName, - getNewLine: () => newLine + getNewLine: () => newLine, + fileExists: fileName => sys.fileExists(fileName), + readFile: fileName => sys.readFile(fileName) }; } @@ -143,7 +345,7 @@ namespace ts { } } - export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program { + export function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost, oldProgram?: Program): Program { let program: Program; let files: SourceFile[] = []; let diagnostics = createDiagnosticCollection(); @@ -158,24 +360,46 @@ namespace ts { let start = new Date().getTime(); host = host || createCompilerHost(options); + + const resolveModuleNamesWorker = + host.resolveModuleNames || + ((moduleNames, containingFile) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedFileName)); let filesByName = createFileMap(fileName => host.getCanonicalFileName(fileName)); - - forEach(rootNames, name => processRootFile(name, /*isDefaultLib:*/ false)); - - // Do not process the default library if: - // - The '--noLib' flag is used. - // - A 'no-default-lib' reference comment is encountered in - // processing the root files. - if (!skipDefaultLib) { - processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib:*/ true); + + if (oldProgram) { + // check properties that can affect structure of the program or module resolution strategy + // if any of these properties has changed - structure cannot be reused + let oldOptions = oldProgram.getCompilerOptions(); + if ((oldOptions.module !== options.module) || + (oldOptions.noResolve !== options.noResolve) || + (oldOptions.target !== options.target) || + (oldOptions.noLib !== options.noLib) || + (oldOptions.jsx !== options.jsx)) { + oldProgram = undefined; + } + } + + if (!tryReuseStructureFromOldProgram()) { + forEach(rootNames, name => processRootFile(name, false)); + // Do not process the default library if: + // - The '--noLib' flag is used. + // - A 'no-default-lib' reference comment is encountered in + // processing the root files. + if (!skipDefaultLib) { + processRootFile(host.getDefaultLibFileName(options), true); + } } verifyCompilerOptions(); + // unconditionally set oldProgram to undefined to prevent it from being captured in closure + oldProgram = undefined; + programTime += new Date().getTime() - start; program = { + getRootFileNames: () => rootNames, getSourceFile: getSourceFile, getSourceFiles: () => files, getCompilerOptions: () => options, @@ -211,6 +435,82 @@ namespace ts { return classifiableNames; } + function tryReuseStructureFromOldProgram(): boolean { + if (!oldProgram) { + return false; + } + + Debug.assert(!oldProgram.structureIsReused); + + // there is an old program, check if we can reuse its structure + let oldRootNames = oldProgram.getRootFileNames(); + if (!arrayIsEqualTo(oldRootNames, rootNames)) { + return false; + } + + // check if program source files has changed in the way that can affect structure of the program + let newSourceFiles: SourceFile[] = []; + for (let oldSourceFile of oldProgram.getSourceFiles()) { + let newSourceFile = host.getSourceFile(oldSourceFile.fileName, options.target); + if (!newSourceFile) { + return false; + } + + if (oldSourceFile !== newSourceFile) { + if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { + // value of no-default-lib has changed + // this will affect if default library is injected into the list of files + return false; + } + + // check tripleslash references + if (!arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { + // tripleslash references has changed + return false; + } + + // check imports + collectExternalModuleReferences(newSourceFile); + if (!arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) { + // imports has changed + return false; + } + + if (resolveModuleNamesWorker) { + let moduleNames = map(newSourceFile.imports, name => name.text); + let resolutions = resolveModuleNamesWorker(moduleNames, newSourceFile.fileName); + // ensure that module resolution results are still correct + for (let i = 0; i < moduleNames.length; ++i) { + let oldResolution = getResolvedModuleFileName(oldSourceFile, moduleNames[i]); + if (oldResolution !== resolutions[i]) { + return false; + } + } + } + // pass the cache of module resolutions from the old source file + newSourceFile.resolvedModules = oldSourceFile.resolvedModules; + } + else { + // file has no changes - use it as is + newSourceFile = oldSourceFile; + } + + // if file has passed all checks it should be safe to reuse it + newSourceFiles.push(newSourceFile); + } + + // update fileName -> file mapping + for (let file of newSourceFiles) { + filesByName.set(file.fileName, file); + } + + files = newSourceFiles; + + oldProgram.structureIsReused = true; + + return true; + } + function getEmitHost(writeFileCallback?: WriteFileCallback): EmitHost { return { getCanonicalFileName: fileName => host.getCanonicalFileName(fileName), @@ -253,7 +553,7 @@ namespace ts { // This is because in the -out scenario all files need to be emitted, and therefore all // files need to be type checked. And the way to specify that all files need to be type // checked is to not pass the file to getEmitResolver. - let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver(options.out ? undefined : sourceFile); + let emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out)? undefined : sourceFile); let start = new Date().getTime(); @@ -370,16 +670,90 @@ namespace ts { function processRootFile(fileName: string, isDefaultLib: boolean) { processSourceFile(normalizePath(fileName), isDefaultLib); + } + + function fileReferenceIsEqualTo(a: FileReference, b: FileReference): boolean { + return a.fileName === b.fileName; + } + + function moduleNameIsEqualTo(a: LiteralExpression, b: LiteralExpression): boolean { + return a.text === b.text; + } + + function collectExternalModuleReferences(file: SourceFile): void { + if (file.imports) { + return; + } + + let isJavaScriptFile = isJavaScript(file.fileName); + + let imports: LiteralExpression[]; + + forEachChild(file, visit); + + function visit(node: Node) { + switch (node.kind) { + case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportDeclaration: + let moduleNameExpr = getExternalModuleName(node); + if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) { + break; + } + if (!(moduleNameExpr).text) { + break; + } + + (imports || (imports = [])).push(moduleNameExpr); + break; + case SyntaxKind.CallExpression: + if (isJavaScriptFile && + (isDefineCall(node) || isAmdRequireCall(node))) { + + let jsImports = getDefineOrRequireCallImports(node); + if (jsImports) { + imports = (imports || []); + for (var i = 0; i < jsImports.length; i++) { + if (jsImports[i].kind === SyntaxKind.StringLiteral) { + imports.push(jsImports[i]); + } + } + } + } + break; + case SyntaxKind.ModuleDeclaration: + if ((node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) { + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An AmbientExternalModuleDeclaration declares an external module. + // This type of declaration is permitted only in the global module. + // The StringLiteral must specify a top - level external module name. + // Relative external module names are not permitted + forEachChild((node).body, node => { + if (isExternalModuleImportEqualsDeclaration(node) && + getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) { + let moduleName = getExternalModuleImportEqualsDeclarationExpression(node); + // TypeScript 1.0 spec (April 2014): 12.1.6 + // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules + // only through top - level external module names. Relative external module names are not permitted. + if (moduleName) { + (imports || (imports = [])).push(moduleName); + } + } + }); + } + break; + } + + if (isJavaScript) { + forEachChild(node, visit); + } + } + + file.imports = imports || emptyArray; } function processSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number) { - let start: number; - let length: number; let diagnosticArgument: string[]; - if (refEnd !== undefined && refPos !== undefined) { - start = refPos; - length = refEnd - refPos; - } let diagnostic: DiagnosticMessage; if (hasExtension(fileName)) { if (!options.allowNonTsExtensions && !forEach(supportedExtensions, extension => fileExtensionIs(host.getCanonicalFileName(fileName), extension))) { @@ -411,8 +785,8 @@ namespace ts { } if (diagnostic) { - if (refFile) { - diagnostics.add(createFileDiagnostic(refFile, start, length, diagnostic, ...diagnosticArgument)); + if (refFile !== undefined && refEnd !== undefined && refPos !== undefined) { + diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, diagnostic, ...diagnosticArgument)); } else { diagnostics.add(createCompilerDiagnostic(diagnostic, ...diagnosticArgument)); @@ -421,7 +795,7 @@ namespace ts { } // Get source file from normalized fileName - function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refStart?: number, refLength?: number): SourceFile { + function findSourceFile(fileName: string, isDefaultLib: boolean, refFile?: SourceFile, refPos?: number, refEnd?: number): SourceFile { let canonicalName = host.getCanonicalFileName(normalizeSlashes(fileName)); if (filesByName.contains(canonicalName)) { // We've already looked for this file, use cached result @@ -436,8 +810,8 @@ namespace ts { // We haven't looked for this file, do so now and cache result let file = host.getSourceFile(fileName, options.target, hostErrorMessage => { - if (refFile) { - diagnostics.add(createFileDiagnostic(refFile, refStart, refLength, + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } else { @@ -450,12 +824,15 @@ namespace ts { // Set the source file for normalized absolute path filesByName.set(canonicalAbsolutePath, file); - + + let basePath = getDirectoryPath(fileName); if (!options.noResolve) { - let basePath = getDirectoryPath(fileName); processReferencedFiles(file, basePath); - processImportedModules(file, basePath); } + + // always process imported modules to record module name resolutions + processImportedModules(file, basePath); + if (isDefaultLib) { file.isDefaultLib = true; files.unshift(file); @@ -473,8 +850,13 @@ namespace ts { if (file && host.useCaseSensitiveFileNames()) { let sourceFileName = useAbsolutePath ? getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; if (canonicalName !== sourceFileName) { - diagnostics.add(createFileDiagnostic(refFile, refStart, refLength, - Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + if (refFile !== undefined && refPos !== undefined && refEnd !== undefined) { + diagnostics.add(createFileDiagnostic(refFile, refPos, refEnd - refPos, + Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } + else { + diagnostics.add(createCompilerDiagnostic(Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } } } return file; @@ -483,60 +865,33 @@ namespace ts { function processReferencedFiles(file: SourceFile, basePath: string) { forEach(file.referencedFiles, ref => { - let referencedFileName = isRootedDiskPath(ref.fileName) ? ref.fileName : combinePaths(basePath, ref.fileName); - processSourceFile(normalizePath(referencedFileName), /* isDefaultLib */ false, file, ref.pos, ref.end); + let referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); + processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end); }); } - + function processImportedModules(file: SourceFile, basePath: string) { - forEach(file.statements, node => { - if (node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration || node.kind === SyntaxKind.ExportDeclaration) { - let moduleNameExpr = getExternalModuleName(node); - if (moduleNameExpr && moduleNameExpr.kind === SyntaxKind.StringLiteral) { - let moduleNameText = (moduleNameExpr).text; - if (moduleNameText) { - let searchPath = basePath; - let searchName: string; - while (true) { - searchName = normalizePath(combinePaths(searchPath, moduleNameText)); - if (forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, moduleNameExpr))) { - break; - } - let parentPath = getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; - } - } + collectExternalModuleReferences(file); + if (file.imports.length) { + file.resolvedModules = {}; + let moduleNames = map(file.imports, name => name.text); + let resolutions = resolveModuleNamesWorker(moduleNames, file.fileName); + for (let i = 0; i < file.imports.length; ++i) { + let resolution = resolutions[i]; + setResolvedModuleName(file, moduleNames[i], resolution); + if (resolution && !options.noResolve) { + findModuleSourceFile(resolution, file.imports[i]); } } - else if (node.kind === SyntaxKind.ModuleDeclaration && (node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An AmbientExternalModuleDeclaration declares an external module. - // This type of declaration is permitted only in the global module. - // The StringLiteral must specify a top - level external module name. - // Relative external module names are not permitted - forEachChild((node).body, node => { - if (isExternalModuleImportEqualsDeclaration(node) && - getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) { - - let nameLiteral = getExternalModuleImportEqualsDeclarationExpression(node); - let moduleName = nameLiteral.text; - if (moduleName) { - // TypeScript 1.0 spec (April 2014): 12.1.6 - // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules - // only through top - level external module names. Relative external module names are not permitted. - let searchName = normalizePath(combinePaths(basePath, moduleName)); - forEach(supportedExtensions, extension => findModuleSourceFile(searchName + extension, nameLiteral)); - } - } - }); - } - }); + } + else { + // no imports - drop cached module resolutions + file.resolvedModules = undefined; + } + return; function findModuleSourceFile(fileName: string, nameLiteral: Expression) { - return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end); } } @@ -603,27 +958,31 @@ namespace ts { function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); } if (options.noEmitOnError) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); } if (options.out) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_isolatedModules)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + } + + if (options.outFile) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); } } if (options.inlineSourceMap) { if (options.sourceMap) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); } if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceRoot", "inlineSourceMap")); } } @@ -634,18 +993,23 @@ namespace ts { } } + if (options.out && options.outFile) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + } + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); } if (options.sourceRoot) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourceMap_option)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "sourceRoot", "sourceMap")); } return; } let languageVersion = options.target || ScriptTarget.ES3; + let outFile = options.outFile || options.out; let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); if (options.isolatedModules) { @@ -675,7 +1039,7 @@ namespace ts { if (options.outDir || // there is --outDir specified options.sourceRoot || // there is --sourceRoot specified (options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated - (!options.out || firstExternalModuleSourceFile !== undefined))) { + (!outFile || firstExternalModuleSourceFile !== undefined))) { if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) { // If a rootDir is specified and is valid use it as the commonSourceDirectory @@ -695,18 +1059,26 @@ namespace ts { } if (options.noEmit) { - if (options.out || options.outDir) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_out_or_outDir)); + if (options.out) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out")); + } + + if (options.outFile) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile")); + } + + if (options.outDir) { + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir")); } if (options.declaration) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration")); } } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_experimentalDecorators_must_also_be_specified_when_option_emitDecoratorMetadata_is_specified)); + diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); } if (options.experimentalAsyncFunctions && diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 33003b6e8c205..199e7e9b63857 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -472,7 +472,7 @@ namespace ts { break; case CharacterCodes.hash: - if (isShebangTrivia(text, pos)) { + if (pos === 0 && isShebangTrivia(text, pos)) { pos = scanShebangTrivia(text, pos); continue; } @@ -672,7 +672,6 @@ namespace ts { ch > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(ch, languageVersion); } - /* @internal */ // Creates a scanner over a (possibly unspecified) range of a piece of text. export function createScanner(languageVersion: ScriptTarget, skipTrivia: boolean, diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 1730e45ee9e0d..443c1c4789c8c 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -29,9 +29,6 @@ namespace ts { declare var process: any; declare var global: any; declare var __filename: string; - declare var Buffer: { - new (str: string, encoding?: string): any; - }; declare class Enumerator { public atEnd(): boolean; @@ -188,13 +185,13 @@ namespace ts { }; } function getNodeSystem(): System { - const _fs = require("fs"); - const _path = require("path"); - const _os = require("os"); + var _fs = require("fs"); + var _path = require("path"); + var _os = require('os'); - const platform: string = _os.platform(); + var platform: string = _os.platform(); // win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive - const useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; + var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; function readFile(fileName: string, encoding?: string): string { if (!_fs.existsSync(fileName)) { @@ -228,7 +225,7 @@ namespace ts { function writeFile(fileName: string, data: string, writeByteOrderMark?: boolean): void { // If a BOM is required, emit one if (writeByteOrderMark) { - data = "\uFEFF" + data; + data = '\uFEFF' + data; } _fs.writeFileSync(fileName, data, "utf8"); @@ -270,17 +267,10 @@ namespace ts { args: process.argv.slice(2), newLine: _os.EOL, useCaseSensitiveFileNames: useCaseSensitiveFileNames, - write(s: string): void { - const buffer = new Buffer(s, "utf8"); - let offset: number = 0; - let toWrite: number = buffer.length; - let written = 0; + write(s: string): void { // 1 is a standard descriptor for stdout - while ((written = _fs.writeSync(1, buffer, offset, toWrite)) < toWrite) { - offset += written; - toWrite -= written; - } - }, + _fs.writeSync(1, s); + }, readFile, writeFile, watchFile: (fileName, callback) => { @@ -297,7 +287,7 @@ namespace ts { } callback(fileName); - } + }; }, resolvePath: function (path: string): string { return _path.resolve(path); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 89862792540d3..12dbd5c5f908d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -9,6 +9,7 @@ namespace ts { contains(fileName: string): boolean; remove(fileName: string): void; forEachValue(f: (v: T) => void): void; + clear(): void; } export interface TextRange { @@ -752,7 +753,8 @@ namespace ts { expression?: Expression; } - export interface BinaryExpression extends Expression { + // Binary expressions can be declarations if they are 'exports.foo = bar' expressions in JS files + export interface BinaryExpression extends Expression, Declaration { left: Expression; operatorToken: Node; right: Expression; @@ -824,7 +826,8 @@ namespace ts { argumentExpression?: Expression; } - export interface CallExpression extends LeftHandSideExpression { + // Call expressions can be declarations if they are 'define' calls in JS files + export interface CallExpression extends LeftHandSideExpression, Declaration { expression: LeftHandSideExpression; typeArguments?: NodeArray; arguments: NodeArray; @@ -1243,6 +1246,10 @@ namespace ts { moduleName: string; referencedFiles: FileReference[]; languageVariant: LanguageVariant; + + // this map is used by transpiler to supply alternative names for dependencies (i.e. in case of bundling) + /* @internal */ + renamedDependencies?: Map; /** * lib.d.ts should have a reference comment like @@ -1275,8 +1282,12 @@ namespace ts { // Stores a line map for the file. // This field should never be used directly to obtain line map, use getLineMap function instead. /* @internal */ lineMap: number[]; - /* @internal */ classifiableNames?: Map; + // Stores a mapping 'external module reference text' -> 'resolved file name' | undefined + // It is used to resolve module names in the checker. + // Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead + /* @internal */ resolvedModules: Map; + /* @internal */ imports: LiteralExpression[]; } export interface ScriptReferenceHost { @@ -1285,7 +1296,7 @@ namespace ts { getCurrentDirectory(): string; } - export interface ParseConfigHost { + export interface ParseConfigHost extends ModuleResolutionHost { readDirectory(rootDir: string, extension: string, exclude: string[]): string[]; } @@ -1303,6 +1314,12 @@ namespace ts { } export interface Program extends ScriptReferenceHost { + + /** + * Get a list of root file names that were passed to a 'createProgram' + */ + getRootFileNames(): string[] + /** * Get a list of files in the program */ @@ -1343,6 +1360,9 @@ namespace ts { /* @internal */ getIdentifierCount(): number; /* @internal */ getSymbolCount(): number; /* @internal */ getTypeCount(): number; + + // For testing purposes only. + /* @internal */ structureIsReused?: boolean; } export interface SourceMapSpan { @@ -1393,6 +1413,7 @@ namespace ts { /* @internal */ sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps } + /* @internal */ export interface TypeCheckerHost { getCompilerOptions(): CompilerOptions; @@ -1990,7 +2011,12 @@ namespace ts { Error, Message, } - + + export const enum ModuleResolutionKind { + Classic = 1, + NodeJs = 2 + } + export interface CompilerOptions { allowNonTsExtensions?: boolean; charset?: string; @@ -2014,6 +2040,7 @@ namespace ts { noLib?: boolean; noResolve?: boolean; out?: string; + outFile?: string; outDir?: string; preserveConstEnums?: boolean; project?: string; @@ -2029,6 +2056,7 @@ namespace ts { experimentalDecorators?: boolean; experimentalAsyncFunctions?: boolean; emitDecoratorMetadata?: boolean; + moduleResolution?: ModuleResolutionKind /* @internal */ stripInternal?: boolean; // Skip checking lib.d.ts to help speed up tests. @@ -2229,9 +2257,23 @@ namespace ts { byteOrderMark = 0xFEFF, tab = 0x09, // \t verticalTab = 0x0B, // \v + } + + export interface ModuleResolutionHost { + fileExists(fileName: string): boolean; + // readFile function is used to read arbitrary text files on disk, i.e. when resolution procedure needs the content of 'package.json' + // to determine location of bundled typings for node module + readFile(fileName: string): string; + } + + export interface ResolvedModule { + resolvedFileName: string; + failedLookupLocations: string[]; } + + export type ModuleNameResolver = (moduleName: string, containingFile: string, options: CompilerOptions, host: ModuleResolutionHost) => ResolvedModule; - export interface CompilerHost { + export interface CompilerHost extends ModuleResolutionHost { getSourceFile(fileName: string, languageVersion: ScriptTarget, onError?: (message: string) => void): SourceFile; getCancellationToken?(): CancellationToken; getDefaultLibFileName(options: CompilerOptions): string; @@ -2240,6 +2282,15 @@ namespace ts { getCanonicalFileName(fileName: string): string; useCaseSensitiveFileNames(): boolean; getNewLine(): string; + + /* + * CompilerHost must either implement resolveModuleNames (in case if it wants to be completely in charge of + * module name resolution) or provide implementation for methods from ModuleResolutionHost (in this case compiler + * will appply built-in module resolution logic and use members of ModuleResolutionHost to ask host specific questions). + * If resolveModuleNames is implemented then implementation for members from ModuleResolutionHost can be just + * 'throw new Error("NotImplemented")' + */ + resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; } export interface TextSpan { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a9e5aa6f9c602..0fe1049e7f6ff 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -80,6 +80,41 @@ namespace ts { return node.end - node.pos; } + export function arrayIsEqualTo(arr1: T[], arr2: T[], comparer?: (a: T, b: T) => boolean): boolean { + if (!arr1 || !arr2) { + return arr1 === arr2; + } + + if (arr1.length !== arr2.length) { + return false; + } + + for (let i = 0; i < arr1.length; ++i) { + let equals = comparer ? comparer(arr1[i], arr2[i]) : arr1[i] === arr2[i]; + if (!equals) { + return false; + } + } + + return true; + } + + export function hasResolvedModuleName(sourceFile: SourceFile, moduleNameText: string): boolean { + return sourceFile.resolvedModules && hasProperty(sourceFile.resolvedModules, moduleNameText); + } + + export function getResolvedModuleFileName(sourceFile: SourceFile, moduleNameText: string): string { + return hasResolvedModuleName(sourceFile, moduleNameText) ? sourceFile.resolvedModules[moduleNameText] : undefined; + } + + export function setResolvedModuleName(sourceFile: SourceFile, moduleNameText: string, resolvedFileName: string): void { + if (!sourceFile.resolvedModules) { + sourceFile.resolvedModules = {}; + } + + sourceFile.resolvedModules[moduleNameText] = resolvedFileName; + } + // Returns true if this node contains a parse error anywhere underneath it. export function containsParseError(node: Node): boolean { aggregateChildData(node); @@ -205,7 +240,7 @@ namespace ts { // Make an identifier from an external module name by extracting the string after the last "/" and replacing // all non-alphanumeric characters with underscores export function makeIdentifierFromModuleName(moduleName: string): string { - return getBaseFileName(moduleName).replace(/\W/g, "_"); + return getBaseFileName(moduleName).replace(/^(\d)/, "_$1").replace(/\W/g, "_"); } export function isBlockOrCatchScoped(declaration: Declaration) { @@ -381,24 +416,15 @@ namespace ts { } export function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile) { - // If parameter/type parameter, the prev token trailing comments are part of this node too - if (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) { - // e.g. (/** blah */ a, /** blah */ b); - - // e.g.: ( - // /** blah */ a, - // /** blah */ b); - return concatenate( - getTrailingCommentRanges(sourceFileOfNode.text, node.pos), - getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); - } - else { - return getLeadingCommentRanges(sourceFileOfNode.text, node.pos); - } + return getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } export function getJsDocComments(node: Node, sourceFileOfNode: SourceFile) { - return filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); + let commentRanges = (node.kind === SyntaxKind.Parameter || node.kind === SyntaxKind.TypeParameter) ? + concatenate(getTrailingCommentRanges(sourceFileOfNode.text, node.pos), + getLeadingCommentRanges(sourceFileOfNode.text, node.pos)) : + getLeadingCommentRangesOfNode(node, sourceFileOfNode); + return filter(commentRanges, isJsDocComment); function isJsDocComment(comment: CommentRange) { // True if the comment starts with '/**' but not if it is '/**/' @@ -615,6 +641,20 @@ namespace ts { return false; } + export function introducesArgumentsExoticObject(node: Node) { + switch (node.kind) { + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.Constructor: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + return true; + } + return false; + } + export function isFunctionBlock(node: Node) { return node && node.kind === SyntaxKind.Block && isFunctionLike(node.parent); } @@ -938,6 +978,7 @@ namespace ts { case SyntaxKind.ComputedPropertyName: return node === (parent).expression; case SyntaxKind.Decorator: + case SyntaxKind.JsxExpression: return true; case SyntaxKind.ExpressionWithTypeArguments: return (parent).expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent); @@ -969,6 +1010,78 @@ namespace ts { return node.kind === SyntaxKind.ImportEqualsDeclaration && (node).moduleReference.kind !== SyntaxKind.ExternalModuleReference; } + function isInJavaScriptFile(node: Node): boolean { + return !!(node.parserContextFlags & ParserContextFlags.JavaScriptFile); + } + + function isCalledToNamedFunction(expression: Node, name: string): boolean; + function isCalledToNamedFunction(expression: CallExpression, name: string) { + return expression.kind === SyntaxKind.CallExpression && + expression.expression.kind === SyntaxKind.Identifier && + (expression.expression).text === name; + } + + export function isDefineCall(expression: Node): boolean; + export function isDefineCall(expression: CallExpression): boolean { + // In .js files, calls to the identifier 'define' are treated specially + return expression && + expression.kind === SyntaxKind.CallExpression && + expression.arguments.length > 0 && + isInJavaScriptFile(expression) && + isCalledToNamedFunction(expression, 'define'); + } + + export function isAnonymousDefineCall(expression: Node): boolean; + export function isAnonymousDefineCall(expression: CallExpression): boolean { + return isDefineCall(expression) && + expression.arguments.length > 0 && + expression.arguments[0].kind !== SyntaxKind.StringLiteral; + } + + export function isAmdRequireCall(expression: Node): boolean; + export function isAmdRequireCall(expression: CallExpression): boolean { + // of the form 'require("name")' or 'require(arg1, arg2, ...)' + return isInJavaScriptFile(expression) && isCalledToNamedFunction(expression, 'require') && expression.arguments.length >= 1; + } + + export function isAmdExportAssignment(expression: Node): boolean; + export function isAmdExportAssignment(expression: BinaryExpression): boolean { + return (expression.kind === SyntaxKind.BinaryExpression) && + (expression.operatorToken.kind === SyntaxKind.EqualsToken) && + (expression.left.kind === SyntaxKind.PropertyAccessExpression) && + ((expression.left).expression.kind === SyntaxKind.Identifier) && + ((((expression.left).expression)).text === 'exports'); + } + + export function isCommonJsExportsAssignment(expression: Node): boolean; + export function isCommonJsExportsAssignment(expression: BinaryExpression): boolean { + return (expression.kind === SyntaxKind.BinaryExpression) && + (expression.operatorToken.kind === SyntaxKind.EqualsToken) && + (expression.left.kind === SyntaxKind.PropertyAccessExpression) && + ((expression.left).expression.kind === SyntaxKind.Identifier) && + ((((expression.left).expression)).text === 'module') && + ((expression.left).name.text === 'exports'); + } + + export function getDefineOrRequireCallImports(callExpr: CallExpression): Expression[] { + // e.g. define(['a', 'b', 'c'], ...) or define('myMod', ['a', 'b', 'c'], ...) + if (callExpr.arguments.length < 1) { + return undefined; + } + + for (var i = 0; i < callExpr.arguments.length; i++) { + if (callExpr.arguments[i].kind === SyntaxKind.ArrayLiteralExpression) { + return (callExpr.arguments[i]).elements; + } + } + + if(isAmdRequireCall(callExpr)) { + return callExpr.arguments; + } + + return undefined; + } + export function getExternalModuleName(node: Node): Expression { if (node.kind === SyntaxKind.ImportDeclaration) { return (node).moduleSpecifier; @@ -1726,7 +1839,7 @@ namespace ts { export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out)) { + if ((isExternalModule(sourceFile) || !(compilerOptions.outFile || compilerOptions.out))) { // 1. in-browser single file compilation scenario // 2. non .js file return compilerOptions.isolatedModules || !fileExtensionIs(sourceFile.fileName, ".js"); diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 7f0cf8ee840e8..34bfa8a586d45 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -123,18 +123,20 @@ module FourSlash { mapRoot: "mapRoot", module: "module", out: "out", + outFile: "outFile", outDir: "outDir", sourceMap: "sourceMap", sourceRoot: "sourceRoot", allowNonTsExtensions: "allowNonTsExtensions", resolveReference: "ResolveReference", // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file + jsx: "jsx", }; // List of allowed metadata names let fileMetadataNames = [metadataOptionNames.fileName, metadataOptionNames.emitThisFile, metadataOptionNames.resolveReference]; let globalMetadataNames = [metadataOptionNames.allowNonTsExtensions, metadataOptionNames.baselineFile, metadataOptionNames.declaration, - metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out, - metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot]; + metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out,metadataOptionNames.outFile, + metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot, metadataOptionNames.jsx]; function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions { let settings: ts.CompilerOptions = { target: ts.ScriptTarget.ES5 }; @@ -153,11 +155,11 @@ module FourSlash { break; case metadataOptionNames.module: // create appropriate external module target for CompilationSettings - switch (globalOptions[prop]) { - case "AMD": + switch ((globalOptions[prop] || '').toLowerCase()) { + case "amd": settings.module = ts.ModuleKind.AMD; break; - case "CommonJS": + case "commonjs": settings.module = ts.ModuleKind.CommonJS; break; default: @@ -169,6 +171,9 @@ module FourSlash { case metadataOptionNames.out: settings.out = globalOptions[prop]; break; + case metadataOptionNames.outFile: + settings.outFile = globalOptions[prop]; + break; case metadataOptionNames.outDir: settings.outDir = globalOptions[prop]; break; @@ -178,6 +183,20 @@ module FourSlash { case metadataOptionNames.sourceRoot: settings.sourceRoot = globalOptions[prop]; break; + case metadataOptionNames.jsx: + switch (globalOptions[prop].toLowerCase()) { + case "react": + settings.jsx = ts.JsxEmit.React; + break; + case "preserve": + settings.jsx = ts.JsxEmit.Preserve; + break; + default: + ts.Debug.assert(globalOptions[prop] === undefined || globalOptions[prop] === "None"); + settings.jsx = ts.JsxEmit.None; + break; + } + break; } } } @@ -285,7 +304,9 @@ module FourSlash { case FourSlashTestType.Native: return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions); case FourSlashTestType.Shims: - return new Harness.LanguageService.ShimLanugageServiceAdapter(cancellationToken, compilationOptions); + return new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ false, cancellationToken, compilationOptions); + case FourSlashTestType.ShimsWithPreprocess: + return new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ true, cancellationToken, compilationOptions); case FourSlashTestType.Server: return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions); default: @@ -356,7 +377,7 @@ module FourSlash { this.formatCodeOptions = { IndentSize: 4, TabSize: 4, - NewLineCharacter: ts.sys.newLine, + NewLineCharacter: Harness.IO.newLine(), ConvertTabsToSpaces: true, InsertSpaceAfterCommaDelimiter: true, InsertSpaceAfterSemicolonInForStatements: true, @@ -364,6 +385,7 @@ module FourSlash { InsertSpaceAfterKeywordsInControlFlowStatements: true, InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, PlaceOpenBraceOnNewLineForFunctions: false, PlaceOpenBraceOnNewLineForControlBlocks: false, }; @@ -533,7 +555,7 @@ module FourSlash { errors.forEach(function (error: ts.Diagnostic) { Harness.IO.log(" minChar: " + error.start + ", limChar: " + (error.start + error.length) + - ", message: " + ts.flattenDiagnosticMessageText(error.messageText, ts.sys.newLine) + "\n"); + ", message: " + ts.flattenDiagnosticMessageText(error.messageText, Harness.IO.newLine()) + "\n"); }); } @@ -1244,21 +1266,21 @@ module FourSlash { emitFiles.forEach(emitFile => { let emitOutput = this.languageService.getEmitOutput(emitFile.fileName); // Print emitOutputStatus in readable format - resultString += "EmitSkipped: " + emitOutput.emitSkipped + ts.sys.newLine; + resultString += "EmitSkipped: " + emitOutput.emitSkipped + Harness.IO.newLine(); if (emitOutput.emitSkipped) { - resultString += "Diagnostics:" + ts.sys.newLine; + resultString += "Diagnostics:" + Harness.IO.newLine(); let diagnostics = ts.getPreEmitDiagnostics(this.languageService.getProgram()); for (let i = 0, n = diagnostics.length; i < n; i++) { - resultString += " " + diagnostics[0].messageText + ts.sys.newLine; + resultString += " " + diagnostics[0].messageText + Harness.IO.newLine(); } } emitOutput.outputFiles.forEach((outputFile, idx, array) => { - let fileName = "FileName : " + outputFile.name + ts.sys.newLine; + let fileName = "FileName : " + outputFile.name + Harness.IO.newLine(); resultString = resultString + fileName + outputFile.text; }); - resultString += ts.sys.newLine; + resultString += Harness.IO.newLine(); }); return resultString; @@ -1295,7 +1317,7 @@ module FourSlash { Harness.IO.log( "start: " + err.start + ", length: " + err.length + - ", message: " + ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine)); + ", message: " + ts.flattenDiagnosticMessageText(err.messageText, Harness.IO.newLine())); }); } } @@ -1869,9 +1891,9 @@ module FourSlash { } function jsonMismatchString() { - return ts.sys.newLine + - "expected: '" + ts.sys.newLine + JSON.stringify(expected, (k, v) => v, 2) + "'" + ts.sys.newLine + - "actual: '" + ts.sys.newLine + JSON.stringify(actual, (k, v) => v, 2) + "'"; + return Harness.IO.newLine() + + "expected: '" + Harness.IO.newLine() + JSON.stringify(expected, (k, v) => v, 2) + "'" + Harness.IO.newLine() + + "actual: '" + Harness.IO.newLine() + JSON.stringify(actual, (k, v) => v, 2) + "'"; } } @@ -2267,15 +2289,15 @@ module FourSlash { let details = this.getCompletionEntryDetails(item.name); if (documentation !== undefined) { - assert.equal(ts.displayPartsToString(details.documentation), documentation, assertionMessage("completion item documentation")); + assert.equal(ts.displayPartsToString(details.documentation), documentation, assertionMessage("completion item documentation for " + name)); } if (text !== undefined) { - assert.equal(ts.displayPartsToString(details.displayParts), text, assertionMessage("completion item detail text")); + assert.equal(ts.displayPartsToString(details.displayParts), text, assertionMessage("completion item detail text for " + name)); } } if (kind !== undefined) { - assert.equal(item.kind, kind, assertionMessage("completion item kind")); + assert.equal(item.kind, kind, assertionMessage("completion item kind for " + name)); } return; @@ -2380,7 +2402,7 @@ module FourSlash { let host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFileName, content: undefined }], (fn, contents) => fourslashJsOutput = contents, ts.ScriptTarget.Latest, - ts.sys.useCaseSensitiveFileNames); + Harness.IO.useCaseSensitiveFileNames()); let program = ts.createProgram([Harness.Compiler.fourslashFileName], { noResolve: true, target: ts.ScriptTarget.ES3 }, host); @@ -2402,16 +2424,16 @@ module FourSlash { ], (fn, contents) => result = contents, ts.ScriptTarget.Latest, - ts.sys.useCaseSensitiveFileNames); + Harness.IO.useCaseSensitiveFileNames()); - let program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host); + let program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { outFile: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host); let sourceFile = host.getSourceFile(fileName, ts.ScriptTarget.ES3); let diagnostics = ts.getPreEmitDiagnostics(program, sourceFile); if (diagnostics.length > 0) { throw new Error(`Error compiling ${fileName}: ` + - diagnostics.map(e => ts.flattenDiagnosticMessageText(e.messageText, ts.sys.newLine)).join("\r\n")); + diagnostics.map(e => ts.flattenDiagnosticMessageText(e.messageText, Harness.IO.newLine())).join("\r\n")); } program.emit(sourceFile); diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index 3914232dbe8d5..d30a30d88e31e 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -5,6 +5,7 @@ const enum FourSlashTestType { Native, Shims, + ShimsWithPreprocess, Server } @@ -23,6 +24,10 @@ class FourSlashRunner extends RunnerBase { this.basePath = "tests/cases/fourslash/shims"; this.testSuiteName = "fourslash-shims"; break; + case FourSlashTestType.ShimsWithPreprocess: + this.basePath = 'tests/cases/fourslash/shims-pp'; + this.testSuiteName = 'fourslash-shims-pp'; + break; case FourSlashTestType.Server: this.basePath = "tests/cases/fourslash/server"; this.testSuiteName = "fourslash-server"; diff --git a/src/harness/harness.ts b/src/harness/harness.ts index c833e6031315a..f9c1463ef9c36 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -26,7 +26,6 @@ // Block scoped definitions work poorly for global variables, temporarily enable var /* tslint:disable:no-var-keyword */ -var Buffer: BufferConstructor = require("buffer").Buffer; // this will work in the browser via browserify var _chai: typeof chai = require("chai"); @@ -55,9 +54,17 @@ module Utils { return ExecutionEnvironment.Node; } } - + export let currentExecutionEnvironment = getExecutionEnvironment(); + const Buffer: BufferConstructor = currentExecutionEnvironment !== ExecutionEnvironment.Browser + ? require("buffer").Buffer + : undefined; + + export function encodeString(s: string): string { + return Buffer ? (new Buffer(s)).toString("utf8") : s; + } + export function evalFile(fileContents: string, fileName: string, nodeContext?: any) { let environment = getExecutionEnvironment(); switch (environment) { @@ -102,7 +109,7 @@ module Utils { let content: string = undefined; try { - content = ts.sys.readFile(Harness.userSpecifiedRoot + path); + content = Harness.IO.readFile(Harness.userSpecifiedRoot + path); } catch (err) { return undefined; @@ -190,7 +197,7 @@ module Utils { return { start: diagnostic.start, length: diagnostic.length, - messageText: ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine), + messageText: ts.flattenDiagnosticMessageText(diagnostic.messageText, Harness.IO.newLine()), category: (ts).DiagnosticCategory[diagnostic.category], code: diagnostic.code }; @@ -323,8 +330,8 @@ module Utils { assert.equal(d1.start, d2.start, "d1.start !== d2.start"); assert.equal(d1.length, d2.length, "d1.length !== d2.length"); assert.equal( - ts.flattenDiagnosticMessageText(d1.messageText, ts.sys.newLine), - ts.flattenDiagnosticMessageText(d2.messageText, ts.sys.newLine), "d1.messageText !== d2.messageText"); + ts.flattenDiagnosticMessageText(d1.messageText, Harness.IO.newLine()), + ts.flattenDiagnosticMessageText(d2.messageText, Harness.IO.newLine()), "d1.messageText !== d2.messageText"); assert.equal(d1.category, d2.category, "d1.category !== d2.category"); assert.equal(d1.code, d2.code, "d1.code !== d2.code"); } @@ -404,6 +411,10 @@ module Harness.Path { module Harness { export interface IO { + newLine(): string; + getCurrentDirectory(): string; + useCaseSensitiveFileNames(): boolean; + resolvePath(path: string): string; readFile(path: string): string; writeFile(path: string, contents: string): void; directoryName(path: string): string; @@ -416,7 +427,10 @@ module Harness { getMemoryUsage?(): number; } export var IO: IO; - + + // harness always uses one kind of new line + const harnessNewLine = "\r\n"; + module IOImpl { declare class Enumerator { public atEnd(): boolean; @@ -433,12 +447,17 @@ module Harness { fso = {}; } - export let readFile: typeof IO.readFile = ts.sys.readFile; - export let writeFile: typeof IO.writeFile = ts.sys.writeFile; - export let directoryName: typeof IO.directoryName = fso.GetParentFolderName; - export let directoryExists: typeof IO.directoryExists = fso.FolderExists; - export let fileExists: typeof IO.fileExists = fso.FileExists; - export let log: typeof IO.log = global.WScript && global.WScript.StdOut.WriteLine; + export const resolvePath = (path: string) => ts.sys.resolvePath(path); + export const getCurrentDirectory = () => ts.sys.getCurrentDirectory(); + export const newLine = () => harnessNewLine; + export const useCaseSensitiveFileNames = () => ts.sys.useCaseSensitiveFileNames; + + export const readFile: typeof IO.readFile = path => ts.sys.readFile(path); + export const writeFile: typeof IO.writeFile = (path, content) => ts.sys.writeFile(path, content); + export const directoryName: typeof IO.directoryName = fso.GetParentFolderName; + export const directoryExists: typeof IO.directoryExists = fso.FolderExists; + export const fileExists: typeof IO.fileExists = fso.FileExists; + export const log: typeof IO.log = global.WScript && global.WScript.StdOut.WriteLine; export function createDirectory(path: string) { if (directoryExists(path)) { @@ -493,11 +512,16 @@ module Harness { } else { fs = pathModule = {}; } + + export const resolvePath = (path: string) => ts.sys.resolvePath(path); + export const getCurrentDirectory = () => ts.sys.getCurrentDirectory(); + export const newLine = () => harnessNewLine; + export const useCaseSensitiveFileNames = () => ts.sys.useCaseSensitiveFileNames; - export let readFile: typeof IO.readFile = ts.sys.readFile; - export let writeFile: typeof IO.writeFile = ts.sys.writeFile; - export let fileExists: typeof IO.fileExists = fs.existsSync; - export let log: typeof IO.log = s => console.log(s); + export const readFile: typeof IO.readFile = path => ts.sys.readFile(path); + export const writeFile: typeof IO.writeFile = (path, content) => ts.sys.writeFile(path, content); + export const fileExists: typeof IO.fileExists = fs.existsSync; + export const log: typeof IO.log = s => console.log(s); export function createDirectory(path: string) { if (!directoryExists(path)) { @@ -562,9 +586,9 @@ module Harness { export module Network { let serverRoot = "http://localhost:8888/"; - // Unused? - let newLine = "\r\n"; - let currentDirectory = () => ""; + export const newLine = () => harnessNewLine; + export const useCaseSensitiveFileNames = () => false; + export const getCurrentDirectory = () => ""; let supportsCodePage = () => false; module Http { @@ -616,6 +640,7 @@ module Harness { xhr.send(contents); } catch (e) { + log(`XHR Error: ${e}`); return { status: 500, responseText: null }; } @@ -655,6 +680,7 @@ module Harness { return dirPath; } export let directoryName: typeof IO.directoryName = Utils.memoize(directoryNameImpl); + export const resolvePath = (path: string) => directoryName(path); export function fileExists(path: string): boolean { let response = Http.getFileFromServerSync(serverRoot + path); @@ -840,7 +866,7 @@ module Harness { export let fourslashSourceFile: ts.SourceFile; export function getCanonicalFileName(fileName: string): string { - return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + return Harness.IO.useCaseSensitiveFileNames() ? fileName : fileName.toLowerCase(); } export function createCompilerHost( @@ -858,7 +884,7 @@ module Harness { } let filemap: { [fileName: string]: ts.SourceFile; } = {}; - let getCurrentDirectory = currentDirectory === undefined ? ts.sys.getCurrentDirectory : () => currentDirectory; + let getCurrentDirectory = currentDirectory === undefined ? Harness.IO.getCurrentDirectory : () => currentDirectory; // Register input files function register(file: { unitName: string; content: string; }) { @@ -868,41 +894,45 @@ module Harness { } }; inputFiles.forEach(register); + + function getSourceFile(fn: string, languageVersion: ts.ScriptTarget) { + fn = ts.normalizePath(fn); + if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) { + return filemap[getCanonicalFileName(fn)]; + } + else if (currentDirectory) { + let canonicalAbsolutePath = getCanonicalFileName(ts.getNormalizedAbsolutePath(fn, currentDirectory)); + return Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(canonicalAbsolutePath)) ? filemap[canonicalAbsolutePath] : undefined; + } + else if (fn === fourslashFileName) { + let tsFn = "tests/cases/fourslash/" + fourslashFileName; + fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget); + return fourslashSourceFile; + } + else { + if (fn === defaultLibFileName) { + return languageVersion === ts.ScriptTarget.ES6 ? defaultES6LibSourceFile : defaultLibSourceFile; + } + // Don't throw here -- the compiler might be looking for a test that actually doesn't exist as part of the TC + return undefined; + } + } let newLine = newLineKind === ts.NewLineKind.CarriageReturnLineFeed ? carriageReturnLineFeed : newLineKind === ts.NewLineKind.LineFeed ? lineFeed : - ts.sys.newLine; + Harness.IO.newLine(); return { getCurrentDirectory, - getSourceFile: (fn, languageVersion) => { - fn = ts.normalizePath(fn); - if (Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(fn))) { - return filemap[getCanonicalFileName(fn)]; - } - else if (currentDirectory) { - let canonicalAbsolutePath = getCanonicalFileName(ts.getNormalizedAbsolutePath(fn, currentDirectory)); - return Object.prototype.hasOwnProperty.call(filemap, getCanonicalFileName(canonicalAbsolutePath)) ? filemap[canonicalAbsolutePath] : undefined; - } - else if (fn === fourslashFileName) { - let tsFn = "tests/cases/fourslash/" + fourslashFileName; - fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget); - return fourslashSourceFile; - } - else { - if (fn === defaultLibFileName) { - return languageVersion === ts.ScriptTarget.ES6 ? defaultES6LibSourceFile : defaultLibSourceFile; - } - // Don't throw here -- the compiler might be looking for a test that actually doesn't exist as part of the TC - return undefined; - } - }, + getSourceFile, getDefaultLibFileName: options => defaultLibFileName, writeFile, getCanonicalFileName, useCaseSensitiveFileNames: () => useCaseSensitiveFileNames, - getNewLine: () => newLine + getNewLine: () => newLine, + fileExists: fileName => getSourceFile(fileName, ts.ScriptTarget.ES5) !== undefined, + readFile: (fileName: string): string => { throw new Error("NotYetImplemented"); } }; } @@ -984,7 +1014,7 @@ module Harness { // Treat them as library files, so include them in build, but not in baselines. let includeBuiltFiles: { unitName: string; content: string }[] = []; - let useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames; + let useCaseSensitiveFileNames = Harness.IO.useCaseSensitiveFileNames(); this.settings.forEach(setCompilerOptionForSetting); let fileOutputs: GeneratedFile[] = []; @@ -1002,11 +1032,9 @@ module Harness { let errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); this.lastErrors = errors; - let result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult.sourceMaps); + let result = new CompilerResult(fileOutputs, errors, program, Harness.IO.getCurrentDirectory(), emitResult.sourceMaps); onComplete(result, program); - // reset what newline means in case the last test changed it - ts.sys.newLine = newLine; return options; function setCompilerOptionForSetting(setting: Harness.TestCaseParser.CompilerSetting) { @@ -1021,6 +1049,13 @@ module Harness { options.module = ts.ModuleKind.UMD; } else if (setting.value.toLowerCase() === "commonjs") { options.module = ts.ModuleKind.CommonJS; + if (options.moduleResolution === undefined) { + // TODO: currently we have relative module names pretty much in all tests that use CommonJS module target. + // Such names could never be resolved in Node however classic resolution strategy still can handle them. + // Changing all module names to relative will be a major overhaul in code (but we'll do this anyway) so as a temporary measure + // we'll use ts.ModuleResolutionKind.Classic for CommonJS modules. + options.moduleResolution = ts.ModuleResolutionKind.Classic; + } } else if (setting.value.toLowerCase() === "system") { options.module = ts.ModuleKind.System; } else if (setting.value.toLowerCase() === "unspecified") { @@ -1032,7 +1067,16 @@ module Harness { options.module = setting.value; } break; - + case "moduleresolution": + switch((setting.value || "").toLowerCase()) { + case "classic": + options.moduleResolution = ts.ModuleResolutionKind.Classic; + break; + case "node": + options.moduleResolution = ts.ModuleResolutionKind.NodeJs; + break; + } + break; case "target": case "codegentarget": if (typeof setting.value === "string") { @@ -1087,6 +1131,10 @@ module Harness { options.out = setting.value; break; + case "outfile": + options.outFile = setting.value; + break; + case "outdiroption": case "outdir": options.outDir = setting.value; @@ -1225,7 +1273,8 @@ module Harness { assert(sourceFile, "Program has no source file with name '" + fileName + "'"); // Is this file going to be emitted separately let sourceFileName: string; - if (ts.isExternalModule(sourceFile) || !options.out) { + let outFile = options.outFile || options.out; + if (ts.isExternalModule(sourceFile) || !outFile) { if (options.outDir) { let sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, result.currentDirectoryForProgram); sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), ""); @@ -1237,7 +1286,7 @@ module Harness { } else { // Goes to single --out file - sourceFileName = options.out; + sourceFileName = outFile; } let dTsFileName = ts.removeFileExtension(sourceFileName) + ".d.ts"; @@ -1269,7 +1318,7 @@ module Harness { errorOutput += diagnostic.file.fileName + "(" + (lineAndCharacter.line + 1) + "," + (lineAndCharacter.character + 1) + "): "; } - errorOutput += ts.DiagnosticCategory[diagnostic.category].toLowerCase() + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine; + errorOutput += ts.DiagnosticCategory[diagnostic.category].toLowerCase() + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, Harness.IO.newLine()) + Harness.IO.newLine(); }); return errorOutput; @@ -1282,7 +1331,7 @@ module Harness { let totalErrorsReported = 0; function outputErrorText(error: ts.Diagnostic) { - let message = ts.flattenDiagnosticMessageText(error.messageText, ts.sys.newLine); + let message = ts.flattenDiagnosticMessageText(error.messageText, Harness.IO.newLine()); let errLines = RunnerBase.removeFullPaths(message) .split("\n") @@ -1379,7 +1428,7 @@ module Harness { assert.equal(totalErrorsReported + numLibraryDiagnostics + numTest262HarnessDiagnostics, diagnostics.length, "total number of errors"); return minimalDiagnosticsToString(diagnostics) + - ts.sys.newLine + ts.sys.newLine + outputLines.join("\r\n"); + Harness.IO.newLine() + Harness.IO.newLine() + outputLines.join("\r\n"); } export function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[]): string { @@ -1715,7 +1764,7 @@ module Harness { } function writeComparison(expected: string, actual: string, relativeFileName: string, actualFileName: string, descriptionForDescribe: string) { - let encoded_actual = (new Buffer(actual)).toString("utf8"); + let encoded_actual = Utils.encodeString(actual); if (expected != encoded_actual) { // Overwrite & issue error let errMsg = "The baseline file " + relativeFileName + " has changed"; @@ -1762,7 +1811,7 @@ module Harness { }; } - if (Error) (Error).stackTraceLimit = 1; + if (Error) (Error).stackTraceLimit = 100; } // TODO: not sure why Utils.evalFile isn't working with this, eventually will concat it like old compiler instead of eval diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index bc63f89bcde5e..f228bc862d88c 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -203,9 +203,35 @@ module Harness.LanguageService { /// Shim adapter class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost, ts.CoreServicesShimHost { private nativeHost: NativeLanguageServiceHost; - constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) { + + public getModuleResolutionsForFile: (fileName: string)=> string; + + constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) { super(cancellationToken, options); this.nativeHost = new NativeLanguageServiceHost(cancellationToken, options); + + if (preprocessToResolve) { + let compilerOptions = this.nativeHost.getCompilationSettings() + let moduleResolutionHost: ts.ModuleResolutionHost = { + fileExists: fileName => this.getScriptInfo(fileName) !== undefined, + readFile: fileName => { + let scriptInfo = this.getScriptInfo(fileName); + return scriptInfo && scriptInfo.content; + } + }; + this.getModuleResolutionsForFile = (fileName) => { + let scriptInfo = this.getScriptInfo(fileName); + let preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ true); + let imports: ts.Map = {}; + for (let module of preprocessInfo.importedFiles) { + let resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost); + if (resolutionInfo.resolvedFileName) { + imports[module.fileName] = resolutionInfo.resolvedFileName; + } + } + return JSON.stringify(imports); + } + } } getFilenames(): string[] { return this.nativeHost.getFilenames(); } @@ -229,7 +255,11 @@ module Harness.LanguageService { readDirectory(rootDir: string, extension: string): string { throw new Error("NYI"); } - + fileExists(fileName: string) { return this.getScriptInfo(fileName) !== undefined; } + readFile(fileName: string) { + let snapshot = this.nativeHost.getScriptSnapshot(fileName); + return snapshot && snapshot.getText(0, snapshot.getLength()); + } log(s: string): void { this.nativeHost.log(s); } trace(s: string): void { this.nativeHost.trace(s); } error(s: string): void { this.nativeHost.error(s); } @@ -399,8 +429,8 @@ module Harness.LanguageService { export class ShimLanugageServiceAdapter implements LanguageServiceAdapter { private host: ShimLanguageServiceHost; private factory: ts.TypeScriptServicesFactory; - constructor(cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) { - this.host = new ShimLanguageServiceHost(cancellationToken, options); + constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) { + this.host = new ShimLanguageServiceHost(preprocessToResolve, cancellationToken, options); this.factory = new TypeScript.Services.TypeScriptServicesFactory(); } getHost() { return this.host; } @@ -419,6 +449,7 @@ module Harness.LanguageService { let convertResult: ts.PreProcessedFileInfo = { referencedFiles: [], importedFiles: [], + ambientExternalModules: [], isLibFile: shimResult.isLibFile }; diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index c91f789940be4..fe4ab8ea8ea4f 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -62,7 +62,7 @@ class ProjectRunner extends RunnerBase { let testFileText: string = null; try { - testFileText = ts.sys.readFile(testCaseFileName); + testFileText = Harness.IO.readFile(testCaseFileName); } catch (e) { assert(false, "Unable to open testcase file: " + testCaseFileName + ": " + e.message); @@ -98,7 +98,7 @@ class ProjectRunner extends RunnerBase { } function cleanProjectUrl(url: string) { - let diskProjectPath = ts.normalizeSlashes(ts.sys.resolvePath(testCase.projectRoot)); + let diskProjectPath = ts.normalizeSlashes(Harness.IO.resolvePath(testCase.projectRoot)); let projectRootUrl = "file:///" + diskProjectPath; let normalizedProjectRoot = ts.normalizeSlashes(testCase.projectRoot); diskProjectPath = diskProjectPath.substr(0, diskProjectPath.lastIndexOf(normalizedProjectRoot)); @@ -122,7 +122,7 @@ class ProjectRunner extends RunnerBase { } function getCurrentDirectory() { - return ts.sys.resolvePath(testCase.projectRoot); + return Harness.IO.resolvePath(testCase.projectRoot); } function compileProjectFiles(moduleKind: ts.ModuleKind, getInputFiles: () => string[], @@ -158,11 +158,12 @@ class ProjectRunner extends RunnerBase { return { declaration: !!testCase.declaration, sourceMap: !!testCase.sourceMap, - out: testCase.out, + outFile: testCase.out, outDir: testCase.outDir, - mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? ts.sys.resolvePath(testCase.mapRoot) : testCase.mapRoot, - sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? ts.sys.resolvePath(testCase.sourceRoot) : testCase.sourceRoot, + mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? Harness.IO.resolvePath(testCase.mapRoot) : testCase.mapRoot, + sourceRoot: testCase.resolveSourceRoot && testCase.sourceRoot ? Harness.IO.resolvePath(testCase.sourceRoot) : testCase.sourceRoot, module: moduleKind, + moduleResolution: ts.ModuleResolutionKind.Classic, // currently all tests use classic module resolution kind, this will change in the future noResolve: testCase.noResolve, rootDir: testCase.rootDir }; @@ -190,8 +191,10 @@ class ProjectRunner extends RunnerBase { writeFile, getCurrentDirectory, getCanonicalFileName: Harness.Compiler.getCanonicalFileName, - useCaseSensitiveFileNames: () => ts.sys.useCaseSensitiveFileNames, - getNewLine: () => ts.sys.newLine + useCaseSensitiveFileNames: () => Harness.IO.useCaseSensitiveFileNames(), + getNewLine: () => Harness.IO.newLine(), + fileExists: fileName => getSourceFile(fileName, ts.ScriptTarget.ES5) !== undefined, + readFile: fileName => Harness.IO.readFile(fileName) }; } } @@ -214,7 +217,7 @@ class ProjectRunner extends RunnerBase { function getSourceFileText(fileName: string): string { let text: string = undefined; try { - text = ts.sys.readFile(ts.isRootedDiskPath(fileName) + text = Harness.IO.readFile(ts.isRootedDiskPath(fileName) ? fileName : ts.normalizeSlashes(testCase.projectRoot) + "/" + ts.normalizeSlashes(fileName)); } @@ -261,14 +264,14 @@ class ProjectRunner extends RunnerBase { // Actual writing of file as in tc.ts function ensureDirectoryStructure(directoryname: string) { if (directoryname) { - if (!ts.sys.directoryExists(directoryname)) { + if (!Harness.IO.directoryExists(directoryname)) { ensureDirectoryStructure(ts.getDirectoryPath(directoryname)); - ts.sys.createDirectory(directoryname); + Harness.IO.createDirectory(directoryname); } } } ensureDirectoryStructure(ts.getDirectoryPath(ts.normalizePath(outputFilePath))); - ts.sys.writeFile(outputFilePath, data, writeByteOrderMark); + Harness.IO.writeFile(outputFilePath, data); outputFiles.push({ emittedFileName: fileName, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark }); } @@ -297,7 +300,7 @@ class ProjectRunner extends RunnerBase { allInputFiles.unshift(findOutpuDtsFile(outputDtsFileName)); } else { - let outputDtsFileName = ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + let outputDtsFileName = ts.removeFileExtension(compilerOptions.outFile|| compilerOptions.out) + ".d.ts"; let outputDtsFile = findOutpuDtsFile(outputDtsFileName); if (!ts.contains(allInputFiles, outputDtsFile)) { allInputFiles.unshift(outputDtsFile); @@ -389,7 +392,7 @@ class ProjectRunner extends RunnerBase { Harness.Baseline.runBaseline("Baseline of emitted result (" + moduleNameToString(compilerResult.moduleKind) + "): " + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => { try { - return ts.sys.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind)); + return Harness.IO.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind)); } catch (e) { return undefined; diff --git a/src/harness/runner.ts b/src/harness/runner.ts index 06aaf3d32b543..822fcdebe8c8e 100644 --- a/src/harness/runner.ts +++ b/src/harness/runner.ts @@ -68,7 +68,10 @@ if (testConfigFile !== "") { case "fourslash-shims": runners.push(new FourSlashRunner(FourSlashTestType.Shims)); break; - case "fourslash-server": + case 'fourslash-shims-pp': + runners.push(new FourSlashRunner(FourSlashTestType.ShimsWithPreprocess)); + break; + case 'fourslash-server': runners.push(new FourSlashRunner(FourSlashTestType.Server)); break; case "fourslash-generated": @@ -98,10 +101,9 @@ if (runners.length === 0) { // language services runners.push(new FourSlashRunner(FourSlashTestType.Native)); runners.push(new FourSlashRunner(FourSlashTestType.Shims)); + runners.push(new FourSlashRunner(FourSlashTestType.ShimsWithPreprocess)); runners.push(new FourSlashRunner(FourSlashTestType.Server)); // runners.push(new GeneratedFourslashRunner()); } -ts.sys.newLine = "\r\n"; - runTests(runners); diff --git a/src/lib/core.d.ts b/src/lib/core.d.ts index 442921ca5a41f..59e7d344c353a 100644 --- a/src/lib/core.d.ts +++ b/src/lib/core.d.ts @@ -316,31 +316,31 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: string, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A String object or string literal that represents the regular expression - * @param replaceValue A function that returns the replacement text. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A String object or string literal containing the text to replace for every successful match of rgExp in stringObj. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. */ replace(searchValue: RegExp, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags - * @param replaceValue A function that returns the replacement text. + * @param replacer A function that returns the replacement text. */ - replace(searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; /** * Finds the first substring match in a regular expression search. @@ -1182,3 +1182,2677 @@ interface PromiseLike { then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; } + +declare namespace AMD { + interface Require { + (moduleName: string): any; + (moduleList: string[], callback: (...resolvedModules: any[]) => void): any; + } + + export var require: Require; + + interface Define { + (dependencies: string[], callback: (...resolvedModules: any[]) => any): void; + (moduleName: string, dependencies: string[], callback: (...resolvedModules: any[]) => any): void; + (func: (require: Require, module: { exports: any }, exports: any) => any): void; + (moduleName: string, object: {}): void; + } + + export var define: Define; +} + +declare namespace CommonJS { + export var require: Require; + + export var exports: any; + + interface Exports { } + interface Module { + exports: Exports; + } + + interface Require { + (moduleName: string): any; + } +} + +interface ArrayLike { + length: number; + [n: number]: T; +} + + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): boolean; +} +declare var ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int8Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int8Array; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + +} +declare var Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8Array; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + +} +declare var Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8ClampedArray; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int16Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int16Array; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare var Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint16Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint16Array; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + +} +declare var Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int32Array; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare var Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint32Array; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare var Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float32Array; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + +} +declare var Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float64Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float64Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float64Array; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare var Float64Array: Float64ArrayConstructor; diff --git a/src/lib/dom.es6.d.ts b/src/lib/dom.es6.d.ts index 8702201bb9eab..e83b8531011da 100644 --- a/src/lib/dom.es6.d.ts +++ b/src/lib/dom.es6.d.ts @@ -8,4 +8,4 @@ interface NodeList { interface NodeListOf { [Symbol.iterator](): IterableIterator -} \ No newline at end of file +} diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index 8eec72f1a4c41..9f857276d1a62 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -2459,7 +2459,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. * @param replace Specifies whether the existing entry for the document is replaced in the history list. */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document | Window; + open(url?: string, name?: string, features?: string, replace?: boolean): Document; /** * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. @@ -2916,6 +2916,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec webkitMatchesSelector(selectors: string): boolean; webkitRequestFullScreen(): void; webkitRequestFullscreen(): void; + getElementsByClassName(classNames: string): NodeListOf; addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; @@ -3030,7 +3031,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(): File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; } interface FileList { @@ -3903,7 +3904,6 @@ interface HTMLElement extends Element { contains(child: HTMLElement): boolean; dragDrop(): boolean; focus(): void; - getElementsByClassName(classNames: string): NodeListOf; insertAdjacentElement(position: string, insertedElement: Element): Element; insertAdjacentHTML(where: string, html: string): void; insertAdjacentText(where: string, text: string): void; @@ -6865,7 +6865,7 @@ interface IDBDatabase extends EventTarget { createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -6986,7 +6986,7 @@ interface IDBTransaction extends EventTarget { READ_ONLY: string; READ_WRITE: string; VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -7016,11 +7016,14 @@ interface ImageData { width: number; } -declare var ImageData: { +interface ImageDataConstructor { prototype: ImageData; - new(): ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; } +declare var ImageData: ImageDataConstructor; + interface KeyboardEvent extends UIEvent { altKey: boolean; char: string; @@ -12169,7 +12172,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { LOADING: number; OPENED: number; UNSENT: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -12439,7 +12442,7 @@ interface MSBaseReader { DONE: number; EMPTY: number; LOADING: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -12595,7 +12598,7 @@ interface XMLHttpRequestEventTarget { onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; ontimeout: (ev: ProgressEvent) => any; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -12612,11 +12615,17 @@ interface NodeListOf extends NodeList { [index: number]: TNode; } + interface BlobPropertyBag { type?: string; endings?: string; } +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + interface EventListenerObject { handleEvent(evt: Event): void; } @@ -12952,4 +12961,4 @@ declare function addEventListener(type: "unload", listener: (ev: Event) => any, declare function addEventListener(type: "volumechange", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "waiting", listener: (ev: Event) => any, useCapture?: boolean): void; declare function addEventListener(type: "wheel", listener: (ev: WheelEvent) => any, useCapture?: boolean): void; -declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; \ No newline at end of file diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index 97291f742bd57..c07d047b58efd 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -87,8 +87,8 @@ interface SymbolConstructor { split: symbol; /** - * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive - * abstract operation. + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. */ toPrimitive: symbol; @@ -98,8 +98,8 @@ interface SymbolConstructor { */ toStringTag: symbol; - /** - * An Object whose own property names are property names that are excluded from the with + /** + * An Object whose own property names are property names that are excluded from the 'with' * environment bindings of the associated objects. */ unscopables: symbol; @@ -170,16 +170,19 @@ interface ObjectConstructor { } interface Function { - /** - * Returns a new function object that is identical to the argument object in all ways except - * for its identity and the value of its HomeObject internal slot. - */ - toMethod(newHome: Object): Function; - /** * Returns the name of the function. Function names are read-only and can not be changed. */ name: string; + + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; } interface NumberConstructor { @@ -248,15 +251,24 @@ interface NumberConstructor { parseInt(string: string, radix?: number): number; } -interface ArrayLike { - length: number; - [n: number]: T; -} - interface Array { /** Iterator */ [Symbol.iterator](): IterableIterator; + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; + /** * Returns an array of key, value pairs for every entry in the array */ @@ -408,6 +420,41 @@ interface String { */ startsWith(searchString: string, position?: number): boolean; + // Overloads for objects with methods of well-known symbols. + + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; + /** * Returns an HTML anchor element and sets the name attribute to the text value * @param name @@ -619,37 +666,76 @@ interface Math { [Symbol.toStringTag]: string; } +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + interface RegExp { - /** - * Matches a string with a regular expression, and returns an array containing the results of + /** + * Matches a string with this regular expression, and returns an array containing the results of * that search. * @param string A string to search within. */ - match(string: string): string[]; + [Symbol.match](string: string): RegExpMatchArray; /** - * Replaces text in a string, using a regular expression. - * @param searchValue A String object or string literal that represents the regular expression + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced * @param replaceValue A String object or string literal containing the text to replace for every - * successful match of rgExp in stringObj. + * successful match of this regular expression. */ - replace(string: string, replaceValue: string): string; + [Symbol.replace](string: string, replaceValue: string): string; - search(string: string): number; + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; /** - * Returns an Array object into which substrings of the result of converting string to a String - * have been stored. The substrings are determined by searching from left to right for matches - * of the this value regular expression; these occurrences are not part of any substring in the - * returned array, but serve to divide up the String value. + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. * - * If the regular expression that contains capturing parentheses, then each time separator is - * matched the results (including any undefined results) of the capturing parentheses are spliced. * @param string string value to split - * @param limit if not undefined, the output array is truncated so that it contains no more - * than limit elements. + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. */ - split(string: string, limit?: number): string[]; + [Symbol.split](string: string, limit?: number): string[]; /** * Returns a string indicating the flags of the regular expression in question. This field is read-only. @@ -678,6 +764,10 @@ interface RegExp { unicode: boolean; } +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + interface Map { clear(): void; delete(key: K): boolean; @@ -767,440 +857,139 @@ interface JSON { * buffer as needed. */ interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin: number, end?: number): ArrayBuffer; - [Symbol.toStringTag]: string; } -interface ArrayBufferConstructor { - prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): boolean; -} -declare var ArrayBuffer: ArrayBufferConstructor; - interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - [Symbol.toStringTag]: string; } -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare var DataView: DataViewConstructor; - /** * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int8Array; - /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * Returns an list of keys in the array */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - + keys(): IterableIterator; /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * Returns an list of values in the array */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - indexOf(searchElement: number, fromIndex?: number): number; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - join(separator?: string): string; - + entries(): IterableIterator<[number, number]>; /** * Returns an list of keys in the array */ keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + /** + * Returns an list of values in the array */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. + * Returns an array of key, value pairs for every entry in the array */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + entries(): IterableIterator<[number, number]>; /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. + * Returns an list of keys in the array */ - set(array: Int8Array, offset?: number): void; + keys(): IterableIterator; /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. + * Returns an list of values in the array */ - slice(start?: number, end?: number): Int8Array; + values(): IterableIterator; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + [Symbol.iterator](): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - subarray(begin: number, end?: number): Int8Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} - /** - * Converts a number to a string by using the current locale. +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - toLocaleString(): string; + entries(): IterableIterator<[number, number]>; - /** - * Returns a string representation of an array. + /** + * Returns an list of keys in the array */ - toString(): string; + keys(): IterableIterator; /** * Returns an list of values in the array */ values(): IterableIterator; - [index: number]: number; + [Symbol.iterator](): IterableIterator; } -interface Int8ArrayConstructor { - prototype: Int8Array; - new (length: number): Int8Array; - new (array: Int8Array): Int8Array; - new (array: number[]): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; /** * Creates an array from an array-like or iterable object. @@ -1208,2029 +997,127 @@ interface Int8ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } -declare var Int8Array: Int8ArrayConstructor; /** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [index: number]: number; - [Symbol.iterator](): IterableIterator; -} - -interface Uint8ArrayConstructor { - prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: Uint8Array): Uint8Array; - new (array: number[]): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; -} -declare var Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8ClampedArray; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8ClampedArray, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8ClampedArray; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; - - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8ClampedArray; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [index: number]: number; - [Symbol.iterator](): IterableIterator; -} - -interface Uint8ClampedArrayConstructor { - prototype: Uint8ClampedArray; - new (length: number): Uint8ClampedArray; - new (array: Uint8ClampedArray): Uint8ClampedArray; - new (array: number[]): Uint8ClampedArray; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int16Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [index: number]: number; - [Symbol.iterator](): IterableIterator; -} - -interface Int16ArrayConstructor { - prototype: Int16Array; - new (length: number): Int16Array; - new (array: Int16Array): Int16Array; - new (array: number[]): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; -} -declare var Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint16Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [index: number]: number; - [Symbol.iterator](): IterableIterator; -} - -interface Uint16ArrayConstructor { - prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: Uint16Array): Uint16Array; - new (array: number[]): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; -} -declare var Uint16Array: Uint16ArrayConstructor; - -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [index: number]: number; - [Symbol.iterator](): IterableIterator; -} - -interface Int32ArrayConstructor { - prototype: Int32Array; - new (length: number): Int32Array; - new (array: Int32Array): Int32Array; - new (array: number[]): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; -} -declare var Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns an list of keys in the array - */ - keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - /** - * Returns an list of values in the array - */ - values(): IterableIterator; - - [index: number]: number; - [Symbol.iterator](): IterableIterator; -} - -interface Uint32ArrayConstructor { - prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: Uint32Array): Uint32Array; - new (array: number[]): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; - - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; -} -declare var Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float32Array; - - /** - * Returns an array of key, value pairs for every entry in the array - */ - entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - + entries(): IterableIterator<[number, number]>; /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * Returns an list of keys in the array */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - + keys(): IterableIterator; /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. + * Returns an list of values in the array */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - indexOf(searchElement: number, fromIndex?: number): number; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - join(separator?: string): string; - + entries(): IterableIterator<[number, number]>; /** * Returns an list of keys in the array */ keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + /** + * Returns an list of values in the array */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. + * Returns an array of key, value pairs for every entry in the array */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - + entries(): IterableIterator<[number, number]>; /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. + * Returns an list of keys in the array */ - set(array: Float32Array, offset?: number): void; - + keys(): IterableIterator; /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. + * Returns an list of values in the array */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. */ - subarray(begin: number, end?: number): Float32Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} - /** - * Converts a number to a string by using the current locale. +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * Returns an array of key, value pairs for every entry in the array */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array */ - toString(): string; - + keys(): IterableIterator; /** * Returns an list of values in the array */ values(): IterableIterator; - - [index: number]: number; [Symbol.iterator](): IterableIterator; } interface Float32ArrayConstructor { - prototype: Float32Array; - new (length: number): Float32Array; - new (array: Float32Array): Float32Array; - new (array: number[]): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; + new (elements: Iterable): Float32Array; /** * Creates an array from an array-like or iterable object. @@ -3238,289 +1125,31 @@ interface Float32ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } -declare var Float32Array: Float32ArrayConstructor; /** * A typed array of 64-bit float values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. */ interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - /** * Returns an array of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, number]>; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** * Returns an list of keys in the array */ keys(): IterableIterator; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Float64Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - /** * Returns an list of values in the array */ values(): IterableIterator; - - [index: number]: number; [Symbol.iterator](): IterableIterator; } interface Float64ArrayConstructor { - prototype: Float64Array; - new (length: number): Float64Array; - new (array: Float64Array): Float64Array; - new (array: number[]): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; + new (elements: Iterable): Float64Array; /** * Creates an array from an array-like or iterable object. @@ -3528,9 +1157,8 @@ interface Float64ArrayConstructor { * @param mapfn A mapping function to call on every element of the array. * @param thisArg Value of 'this' used to invoke the mapfn. */ - from(arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } -declare var Float64Array: Float64ArrayConstructor; interface ProxyHandler { getPrototypeOf? (target: T): any; @@ -3555,9 +1183,9 @@ interface ProxyConstructor { } declare var Proxy: ProxyConstructor; -declare module Reflect { +declare namespace Reflect { function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; - function construct(target: Function, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; function deleteProperty(target: any, propertyKey: PropertyKey): boolean; function enumerate(target: any): IterableIterator; @@ -3658,20 +1286,3 @@ interface PromiseConstructor { } declare var Promise: PromiseConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} \ No newline at end of file diff --git a/src/lib/extensions.d.ts b/src/lib/extensions.d.ts deleted file mode 100644 index 8c67c7e826f2e..0000000000000 --- a/src/lib/extensions.d.ts +++ /dev/null @@ -1,2305 +0,0 @@ - -///////////////////////////// -/// IE10 ECMAScript Extensions -///////////////////////////// - -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - byteLength: number; - - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin:number, end?:number): ArrayBuffer; -} - -interface ArrayBufferConstructor { - prototype: ArrayBuffer; - new (byteLength: number): ArrayBuffer; - isView(arg: any): boolean; -} -declare var ArrayBuffer: ArrayBufferConstructor; - -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} - -interface DataView { - buffer: ArrayBuffer; - byteLength: number; - byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getFloat64(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; - - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt16(byteOffset: number, littleEndian: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt32(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; - - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint16(byteOffset: number, littleEndian: boolean): number; - - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint32(byteOffset: number, littleEndian: boolean): number; - - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; - - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; - - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian: boolean): void; - - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written, - * otherwise a little-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian: boolean): void; -} - -interface DataViewConstructor { - new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; -} -declare var DataView: DataViewConstructor; - -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int8Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int8Array; - - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} -interface Int8ArrayConstructor { - prototype: Int8Array; - new (length: number): Int8Array; - new (array: Int8Array): Int8Array; - new (array: number[]): Int8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; -} -declare var Int8Array: Int8ArrayConstructor; - -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint8Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint8Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint8Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint8Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint8Array; - - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint8Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint8ArrayConstructor { - prototype: Uint8Array; - new (length: number): Uint8Array; - new (array: Uint8Array): Uint8Array; - new (array: number[]): Uint8Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; -} -declare var Uint8Array: Uint8ArrayConstructor; - -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int16Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int16Array; - - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int16ArrayConstructor { - prototype: Int16Array; - new (length: number): Int16Array; - new (array: Int16Array): Int16Array; - new (array: number[]): Int16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; -} -declare var Int16Array: Int16ArrayConstructor; - -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint16Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint16Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint16Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint16Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint16Array; - - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint16Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint16ArrayConstructor { - prototype: Uint16Array; - new (length: number): Uint16Array; - new (array: Uint16Array): Uint16Array; - new (array: number[]): Uint16Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; -} -declare var Uint16Array: Uint16ArrayConstructor; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Int32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Int32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Int32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Int32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Int32Array; - - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Int32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Int32ArrayConstructor { - prototype: Int32Array; - new (length: number): Int32Array; - new (array: Int32Array): Int32Array; - new (array: number[]): Int32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; -} -declare var Int32Array: Int32ArrayConstructor; - -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Uint32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Uint32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Uint32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Uint32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Uint32Array; - - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Uint32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Uint32ArrayConstructor { - prototype: Uint32Array; - new (length: number): Uint32Array; - new (array: Uint32Array): Uint32Array; - new (array: number[]): Uint32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; -} -declare var Uint32Array: Uint32ArrayConstructor; - -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float32Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float32Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Float32Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float32Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float32Array; - - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float32Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float32ArrayConstructor { - prototype: Float32Array; - new (length: number): Float32Array; - new (array: Float32Array): Float32Array; - new (array: number[]): Float32Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; -} -declare var Float32Array: Float32ArrayConstructor; - -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBuffer; - - /** - * The length in bytes of the array. - */ - byteLength: number; - - /** - * The offset in bytes of the array. - */ - byteOffset: number; - - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start: number, end?: number): Float64Array; - - /** - * Determines whether all the members of an array satisfy the specified test. - * @param callbackfn A function that accepts up to three arguments. The every method calls - * the callbackfn function for each element in array1 until the callbackfn returns false, - * or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Returns the this object after filling the section identified by start and end with value - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): Float64Array; - - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param callbackfn A function that accepts up to three arguments. The filter method calls - * the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; - - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; - - /** - * Returns the index of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number) => boolean, thisArg?: any): number; - - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; - - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; - - /** - * The length of the array. - */ - length: number; - - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; - - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; - - /** - * Sets a value or an array of values. - * @param index The index of the location to set. - * @param value The value to set. - */ - set(index: number, value: number): void; - - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: Float64Array, offset?: number): void; - - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. - */ - slice(start?: number, end?: number): Float64Array; - - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param callbackfn A function that accepts up to three arguments. The some method calls the - * callbackfn function for each element in array1 until the callbackfn returns true, or until - * the end of the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; - - /** - * Sorts an array. - * @param compareFn The name of the function used to determine the order of the elements. If - * omitted, the elements are sorted in ascending, ASCII character order. - */ - sort(compareFn?: (a: number, b: number) => number): Float64Array; - - /** - * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin: number, end?: number): Float64Array; - - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; - - /** - * Returns a string representation of an array. - */ - toString(): string; - - [index: number]: number; -} - -interface Float64ArrayConstructor { - prototype: Float64Array; - new (length: number): Float64Array; - new (array: Float64Array): Float64Array; - new (array: number[]): Float64Array; - new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; - - /** - * The size in bytes of each element in the array. - */ - BYTES_PER_ELEMENT: number; - - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; -} -declare var Float64Array: Float64ArrayConstructor; \ No newline at end of file diff --git a/src/lib/webworker.generated.d.ts b/src/lib/webworker.generated.d.ts index db8b02f34d701..eef668d7745a6 100644 --- a/src/lib/webworker.generated.d.ts +++ b/src/lib/webworker.generated.d.ts @@ -3,10 +3,28 @@ /// IE Worker APIs ///////////////////////////// +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; +} + interface EventListener { (evt: Event): void; } +interface AudioBuffer { + duration: number; + length: number; + numberOfChannels: number; + sampleRate: number; + getChannelData(channel: number): any; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(): AudioBuffer; +} + interface Blob { size: number; type: string; @@ -60,6 +78,21 @@ declare var Console: { new(): Console; } +interface Coordinates { + accuracy: number; + altitude: number; + altitudeAccuracy: number; + heading: number; + latitude: number; + longitude: number; + speed: number; +} + +declare var Coordinates: { + prototype: Coordinates; + new(): Coordinates; +} + interface DOMError { name: string; toString(): string; @@ -210,7 +243,7 @@ interface File extends Blob { declare var File: { prototype: File; - new(): File; + new (parts: (ArrayBuffer | ArrayBufferView | Blob | string)[], filename: string, properties?: FilePropertyBag): File; } interface FileList { @@ -281,7 +314,7 @@ interface IDBDatabase extends EventTarget { createObjectStore(name: string, optionalParameters?: any): IDBObjectStore; deleteObjectStore(name: string): void; transaction(storeNames: any, mode?: string): IDBTransaction; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; } @@ -402,7 +435,7 @@ interface IDBTransaction extends EventTarget { READ_ONLY: string; READ_WRITE: string; VERSION_CHANGE: string; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; @@ -432,11 +465,14 @@ interface ImageData { width: number; } -declare var ImageData: { +interface ImageDataConstructor { prototype: ImageData; - new(): ImageData; + new(width: number, height: number): ImageData; + new(array: Uint8ClampedArray, width: number, height: number): ImageData; } +declare var ImageData: ImageDataConstructor; + interface MSApp { clearTemporaryWebDataAsync(): MSAppAsyncOperation; createBlobFromRandomAccessStream(type: string, seeker: any): Blob; @@ -460,6 +496,29 @@ interface MSApp { } declare var MSApp: MSApp; +interface MSAppAsyncOperation extends EventTarget { + error: DOMError; + oncomplete: (ev: Event) => any; + onerror: (ev: Event) => any; + readyState: number; + result: any; + start(): void; + COMPLETED: number; + ERROR: number; + STARTED: number; + addEventListener(type: "complete", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var MSAppAsyncOperation: { + prototype: MSAppAsyncOperation; + new(): MSAppAsyncOperation; + COMPLETED: number; + ERROR: number; + STARTED: number; +} + interface MSBlobBuilder { append(data: any, endings?: string): void; getBlob(contentType?: string): Blob; @@ -496,6 +555,18 @@ declare var MSStreamReader: { new(): MSStreamReader; } +interface MediaQueryList { + matches: boolean; + media: string; + addListener(listener: MediaQueryListListener): void; + removeListener(listener: MediaQueryListListener): void; +} + +declare var MediaQueryList: { + prototype: MediaQueryList; + new(): MediaQueryList; +} + interface MessageChannel { port1: MessagePort; port2: MessagePort; @@ -533,6 +604,33 @@ declare var MessagePort: { new(): MessagePort; } +interface Position { + coords: Coordinates; + timestamp: number; +} + +declare var Position: { + prototype: Position; + new(): Position; +} + +interface PositionError { + code: number; + message: string; + toString(): string; + PERMISSION_DENIED: number; + POSITION_UNAVAILABLE: number; + TIMEOUT: number; +} + +declare var PositionError: { + prototype: PositionError; + new(): PositionError; + PERMISSION_DENIED: number; + POSITION_UNAVAILABLE: number; + TIMEOUT: number; +} + interface ProgressEvent extends Event { lengthComputable: boolean; loaded: number; @@ -620,7 +718,7 @@ interface XMLHttpRequest extends EventTarget, XMLHttpRequestEventTarget { LOADING: number; OPENED: number; UNSENT: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -642,6 +740,15 @@ declare var XMLHttpRequest: { create(): XMLHttpRequest; } +interface XMLHttpRequestUpload extends EventTarget, XMLHttpRequestEventTarget { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void; +} + +declare var XMLHttpRequestUpload: { + prototype: XMLHttpRequestUpload; + new(): XMLHttpRequestUpload; +} + interface AbstractWorker { onerror: (ev: Event) => any; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; @@ -661,7 +768,7 @@ interface MSBaseReader { DONE: number; EMPTY: number; LOADING: number; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -702,7 +809,7 @@ interface XMLHttpRequestEventTarget { onloadstart: (ev: Event) => any; onprogress: (ev: ProgressEvent) => any; ontimeout: (ev: ProgressEvent) => any; - addEventListener(type: "abort", listener: (ev: UIEvent) => any, useCapture?: boolean): void; + addEventListener(type: "abort", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "error", listener: (ev: ErrorEvent) => any, useCapture?: boolean): void; addEventListener(type: "load", listener: (ev: Event) => any, useCapture?: boolean): void; addEventListener(type: "loadend", listener: (ev: ProgressEvent) => any, useCapture?: boolean): void; @@ -788,17 +895,16 @@ interface WorkerUtils extends Object, WindowBase64 { } -interface NodeListOf extends NodeList { - length: number; - item(index: number): TNode; - [index: number]: TNode; -} - interface BlobPropertyBag { type?: string; endings?: string; } +interface FilePropertyBag { + type?: string; + lastModified?: number; +} + interface EventListenerObject { handleEvent(evt: Event): void; } @@ -820,11 +926,11 @@ interface MediaQueryListListener { interface MSLaunchUriCallback { (): void; } -interface FrameRequestCallback { - (time: number): void; +interface MSUnsafeFunctionCallback { + (): any; } -interface MutationCallback { - (mutations: MutationRecord[], observer: MutationObserver): void; +interface MSExecAtPriorityFunctionCallback { + (...args: any[]): any; } interface DecodeSuccessCallback { (decodedData: AudioBuffer): void; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 54045b714affb..7a8e665357f72 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -78,15 +78,76 @@ namespace ts.server { return this.snap().getChangeRange(oldSnapshot); } } - + + interface TimestampedResolvedModule extends ResolvedModule { + lastCheckTime: number; + } + export class LSHost implements ts.LanguageServiceHost { ls: ts.LanguageService = null; compilationSettings: ts.CompilerOptions; filenameToScript: ts.Map = {}; roots: ScriptInfo[] = []; - + private resolvedModuleNames: ts.FileMap>; + private moduleResolutionHost: ts.ModuleResolutionHost; + constructor(public host: ServerHost, public project: Project) { - } + this.resolvedModuleNames = ts.createFileMap>(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames)) + this.moduleResolutionHost = { + fileExists: fileName => this.fileExists(fileName), + readFile: fileName => this.host.readFile(fileName) + } + } + + resolveModuleNames(moduleNames: string[], containingFile: string): string[] { + let currentResolutionsInFile = this.resolvedModuleNames.get(containingFile); + + let newResolutions: Map = {}; + let resolvedFileNames: string[] = []; + + let compilerOptions = this.getCompilationSettings(); + + for (let moduleName of moduleNames) { + // check if this is a duplicate entry in the list + let resolution = lookUp(newResolutions, moduleName); + if (!resolution) { + let existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName); + if (moduleResolutionIsValid(existingResolution)) { + // ok, it is safe to use existing module resolution results + resolution = existingResolution; + } + else { + resolution = resolveModuleName(moduleName, containingFile, compilerOptions, this.moduleResolutionHost); + resolution.lastCheckTime = Date.now(); + newResolutions[moduleName] = resolution; + } + } + + ts.Debug.assert(resolution !== undefined); + + resolvedFileNames.push(resolution.resolvedFileName); + } + + // replace old results with a new one + this.resolvedModuleNames.set(containingFile, newResolutions); + return resolvedFileNames; + + function moduleResolutionIsValid(resolution: TimestampedResolvedModule): boolean { + if (!resolution) { + return false; + } + + if (resolution.resolvedFileName) { + // TODO: consider checking failedLookupLocations + // TODO: use lastCheckTime to track expiration for module name resolution + return true; + } + + // consider situation if we have no candidate locations as valid resolution. + // after all there is no point to invalidate it if we have no idea where to look for the module. + return resolution.failedLookupLocations.length === 0; + } + } getDefaultLibFileName() { var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); @@ -102,6 +163,8 @@ namespace ts.server { setCompilationSettings(opt: ts.CompilerOptions) { this.compilationSettings = opt; + // conservatively assume that changing compiler options might affect module resolution strategy + this.resolvedModuleNames.clear(); } lineAffectsRefs(filename: string, line: number) { @@ -137,6 +200,7 @@ namespace ts.server { removeReferencedFile(info: ScriptInfo) { if (!info.isOpen) { this.filenameToScript[info.fileName] = undefined; + this.resolvedModuleNames.remove(info.fileName); } } @@ -160,6 +224,14 @@ namespace ts.server { this.roots.push(info); } } + + removeRoot(info: ScriptInfo) { + var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); + if (scriptInfo) { + this.filenameToScript[info.fileName] = undefined; + this.roots = copyListRemovingItem(info, this.roots); + } + } saveTo(filename: string, tmpfilename: string) { var script = this.getScriptInfo(filename); @@ -281,6 +353,7 @@ namespace ts.server { export class Project { compilerService: CompilerService; projectFilename: string; + projectFileWatcher: FileWatcher; program: ts.Program; filenameToSourceFile: ts.Map = {}; updateGraphSeq = 0; @@ -288,7 +361,7 @@ namespace ts.server { openRefCount = 0; constructor(public projectService: ProjectService, public projectOptions?: ProjectOptions) { - this.compilerService = new CompilerService(this,projectOptions && projectOptions.compilerOptions); + this.compilerService = new CompilerService(this, projectOptions && projectOptions.compilerOptions); } addOpenRef() { @@ -359,6 +432,12 @@ namespace ts.server { info.defaultProject = this; this.compilerService.host.addRoot(info); } + + // remove a root file from project + removeRoot(info: ScriptInfo) { + info.defaultProject = undefined; + this.compilerService.host.removeRoot(info); + } filesToString() { var strBuilder = ""; @@ -453,6 +532,12 @@ namespace ts.server { } } + watchedProjectConfigFileChanged(project: Project) { + this.log("Config File Changed: " + project.projectFilename); + this.updateConfiguredProject(project); + this.updateProjectStructure(); + } + log(msg: string, type = "Err") { this.psLogger.msg(msg, type); } @@ -529,6 +614,19 @@ namespace ts.server { } this.configuredProjects = configuredProjects; } + + removeConfiguredProject(project: Project) { + project.projectFileWatcher.close(); + this.configuredProjects = copyListRemovingItem(project, this.configuredProjects); + + let fileNames = project.getFileNames(); + for (let fileName of fileNames) { + let info = this.getScriptInfo(fileName); + if (info.defaultProject == project){ + info.defaultProject = undefined; + } + } + } setConfiguredProjectRoot(info: ScriptInfo) { for (var i = 0, len = this.configuredProjects.length; i < len; i++) { @@ -583,7 +681,6 @@ namespace ts.server { /** * Remove this file from the set of open, non-configured files. * @param info The file that has been closed or newly configured - * @param openedByConfig True if info has become a root of a configured project */ closeOpenFile(info: ScriptInfo) { var openFileRoots: ScriptInfo[] = []; @@ -672,18 +769,42 @@ namespace ts.server { return referencingProjects; } + reloadProjects() { + // First check if there is new tsconfig file added for inferred project roots + for (let info of this.openFileRoots) { + this.openOrUpdateConfiguredProjectForFile(info.fileName); + } + this.updateProjectStructure(); + } + + /** + * This function is to update the project structure for every projects. + * It is called on the premise that all the configured projects are + * up to date. + */ updateProjectStructure() { this.log("updating project structure from ...", "Info"); this.printProjects(); + + let unattachedOpenFiles: ScriptInfo[] = []; + let openFileRootsConfigured: ScriptInfo[] = []; + for (let info of this.openFileRootsConfigured) { + let project = info.defaultProject; + if (!project || !(project.getSourceFile(info))) { + info.defaultProject = undefined; + unattachedOpenFiles.push(info); + } + else { + openFileRootsConfigured.push(info); + } + } + this.openFileRootsConfigured = openFileRootsConfigured; // First loop through all open files that are referenced by projects but are not // project roots. For each referenced file, see if the default project still // references that file. If so, then just keep the file in the referenced list. // If not, add the file to an unattached list, to be rechecked later. - var openFilesReferenced: ScriptInfo[] = []; - var unattachedOpenFiles: ScriptInfo[] = []; - for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { var referencedFile = this.openFilesReferenced[i]; referencedFile.defaultProject.updateGraph(); @@ -793,30 +914,38 @@ namespace ts.server { * Open file whose contents is managed by the client * @param filename is absolute pathname */ - openClientFile(fileName: string) { - var searchPath = ts.normalizePath(getDirectoryPath(fileName)); + this.openOrUpdateConfiguredProjectForFile(fileName); + var info = this.openFile(fileName, true); + this.addOpenFile(info); + this.printProjects(); + return info; + } + + openOrUpdateConfiguredProjectForFile(fileName: string) { + let searchPath = ts.normalizePath(getDirectoryPath(fileName)); this.log("Search path: " + searchPath,"Info"); - var configFileName = this.findConfigFile(searchPath); + let configFileName = this.findConfigFile(searchPath); if (configFileName) { this.log("Config file name: " + configFileName, "Info"); - } else { - this.log("no config file"); - } - if (configFileName && (!this.configProjectIsActive(configFileName))) { - var configResult = this.openConfigFile(configFileName, fileName); - if (!configResult.success) { - this.log("Error opening config file " + configFileName + " " + configResult.errorMsg); + let project = this.findConfiguredProjectByConfigFile(configFileName); + if (!project) { + var configResult = this.openConfigFile(configFileName, fileName); + if (!configResult.success) { + this.log("Error opening config file " + configFileName + " " + configResult.errorMsg); + } + else { + this.log("Opened configuration file " + configFileName,"Info"); + this.configuredProjects.push(configResult.project); + } } else { - this.log("Opened configuration file " + configFileName,"Info"); - this.configuredProjects.push(configResult.project); + this.updateConfiguredProject(project); } } - var info = this.openFile(fileName, true); - this.addOpenFile(info); - this.printProjects(); - return info; + else { + this.log("No config files found."); + } } /** @@ -895,49 +1024,113 @@ namespace ts.server { } configProjectIsActive(fileName: string) { + return this.findConfiguredProjectByConfigFile(fileName) === undefined; + } + + findConfiguredProjectByConfigFile(configFileName: string) { for (var i = 0, len = this.configuredProjects.length; i < len; i++) { - if (this.configuredProjects[i].projectFilename == fileName) { - return true; + if (this.configuredProjects[i].projectFilename == configFileName) { + return this.configuredProjects[i]; } } - return false; + return undefined; } - openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult { + configFileToProjectOptions(configFilename: string): { succeeded: boolean, projectOptions?: ProjectOptions, error?: ProjectOpenResult } { configFilename = ts.normalizePath(configFilename); // file references will be relative to dirPath (or absolute) var dirPath = ts.getDirectoryPath(configFilename); var contents = this.host.readFile(configFilename) var rawConfig: { config?: ProjectOptions; error?: Diagnostic; } = ts.parseConfigFileText(configFilename, contents); if (rawConfig.error) { - return rawConfig.error; + return { succeeded: false, error: rawConfig.error }; } else { var parsedCommandLine = ts.parseConfigFile(rawConfig.config, this.host, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { - return { errorMsg: "tsconfig option errors" }; + return { succeeded: false, error: { errorMsg: "tsconfig option errors" }}; + } + else if (parsedCommandLine.fileNames == null) { + return { succeeded: false, error: { errorMsg: "no files found" }} } - else if (parsedCommandLine.fileNames) { + else { var projectOptions: ProjectOptions = { files: parsedCommandLine.fileNames, compilerOptions: parsedCommandLine.options }; - var proj = this.createProject(configFilename, projectOptions); - for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) { - var rootFilename = parsedCommandLine.fileNames[i]; - if (this.host.fileExists(rootFilename)) { - var info = this.openFile(rootFilename, clientFileName == rootFilename); - proj.addRoot(info); + return { succeeded: true, projectOptions }; + } + } + + } + + openConfigFile(configFilename: string, clientFileName?: string): ProjectOpenResult { + let { succeeded, projectOptions, error } = this.configFileToProjectOptions(configFilename); + if (!succeeded) { + return error; + } + else { + let proj = this.createProject(configFilename, projectOptions); + for (let i = 0, len = projectOptions.files.length; i < len; i++) { + let rootFilename = projectOptions.files[i]; + if (this.host.fileExists(rootFilename)) { + let info = this.openFile(rootFilename, /*openedByClient*/ clientFileName == rootFilename); + proj.addRoot(info); + } + else { + return { errorMsg: "specified file " + rootFilename + " not found" }; + } + } + proj.finishGraph(); + proj.projectFileWatcher = this.host.watchFile(configFilename, _ => this.watchedProjectConfigFileChanged(proj)); + return { success: true, project: proj }; + } + } + + updateConfiguredProject(project: Project) { + if (!this.host.fileExists(project.projectFilename)) { + this.log("Config file deleted"); + this.removeConfiguredProject(project); + } + else { + let { succeeded, projectOptions, error } = this.configFileToProjectOptions(project.projectFilename); + if (!succeeded) { + return error; + } + else { + let oldFileNames = project.compilerService.host.roots.map(info => info.fileName); + let newFileNames = projectOptions.files; + let fileNamesToRemove = oldFileNames.filter(f => newFileNames.indexOf(f) < 0); + let fileNamesToAdd = newFileNames.filter(f => oldFileNames.indexOf(f) < 0); + + for (let fileName of fileNamesToRemove) { + let info = this.getScriptInfo(fileName); + project.removeRoot(info); + } + + for (let fileName of fileNamesToAdd) { + let info = this.getScriptInfo(fileName); + if (!info) { + info = this.openFile(fileName, false); } else { - return { errorMsg: "specified file " + rootFilename + " not found" }; + // if the root file was opened by client, it would belong to either + // openFileRoots or openFileReferenced. + if (info.isOpen) { + if (this.openFileRoots.indexOf(info) >= 0) { + this.openFileRoots = copyListRemovingItem(info, this.openFileRoots); + } + if (this.openFilesReferenced.indexOf(info) >= 0) { + this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); + } + this.openFileRootsConfigured.push(info); + } } + project.addRoot(info); } - proj.finishGraph(); - return { success: true, project: proj }; - } - else { - return { errorMsg: "no files found" }; + + project.setProjectOptions(projectOptions); + project.finishGraph(); } } } @@ -992,6 +1185,7 @@ namespace ts.server { InsertSpaceAfterKeywordsInControlFlowStatements: true, InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false, PlaceOpenBraceOnNewLineForFunctions: false, PlaceOpenBraceOnNewLineForControlBlocks: false, } diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index 99008770bba99..ce918abda3c7e 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -31,6 +31,12 @@ declare namespace ts.server.protocol { */ arguments?: any; } + + /** + * Request to reload the project structure for all the opened files + */ + export interface ReloadProjectsRequest extends Message { + } /** * Server-initiated event message @@ -452,6 +458,9 @@ declare namespace ts.server.protocol { /** Defines space handling after opening and before closing non empty parenthesis. Default value is false. */ insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean; + + /** Defines space handling after opening and before closing non empty brackets. Default value is false. */ + insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean; /** Defines whether an open brace is put onto a new line for functions or not. Default value is false. */ placeOpenBraceOnNewLineForFunctions?: boolean; diff --git a/src/server/session.ts b/src/server/session.ts index 108cf4726dcd4..da044e7b4c6ec 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -100,6 +100,7 @@ namespace ts.server { export const SignatureHelp = "signatureHelp"; export const TypeDefinition = "typeDefinition"; export const ProjectInfo = "projectInfo"; + export const ReloadProjects = "reloadProjects"; export const Unknown = "unknown"; } @@ -226,6 +227,10 @@ namespace ts.server { this.syntacticCheck(file, project); this.semanticCheck(file, project); } + + private reloadProjects() { + this.projectService.reloadProjects(); + } private updateProjectStructure(seq: number, matchSeq: (seq: number) => boolean, ms = 1500) { setTimeout(() => { @@ -1033,6 +1038,10 @@ namespace ts.server { var { file, needFileNameList } = request.arguments; return {response: this.getProjectInfo(file, needFileNameList), responseRequired: true}; }, + [CommandNames.ReloadProjects]: (request: protocol.ReloadProjectsRequest) => { + this.reloadProjects(); + return {responseRequired: false}; + } }; public addProtocolHandler(command: string, handler: (request: protocol.Request) => {response?: any, responseRequired: boolean}) { if (this.handlers[command]) { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 497c51144000c..d4e096974b77a 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -39,12 +39,12 @@ namespace ts.formatting { public SpaceBetweenCloseBraceAndWhile: Rule; public NoSpaceAfterCloseBrace: Rule; - // No space for indexer and dot + // No space for dot public NoSpaceBeforeDot: Rule; public NoSpaceAfterDot: Rule; + + // No space before and after indexer public NoSpaceBeforeOpenBracket: Rule; - public NoSpaceAfterOpenBracket: Rule; - public NoSpaceBeforeCloseBracket: Rule; public NoSpaceAfterCloseBracket: Rule; // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. @@ -191,6 +191,13 @@ namespace ts.formatting { public NoSpaceAfterOpenParen: Rule; public NoSpaceBeforeCloseParen: Rule; + // Insert space after opening and before closing nonempty brackets + public SpaceAfterOpenBracket: Rule; + public SpaceBeforeCloseBracket: Rule; + public NoSpaceBetweenBrackets: Rule; + public NoSpaceAfterOpenBracket: Rule; + public NoSpaceBeforeCloseBracket: Rule; + // Insert space after function keyword for anonymous functions public SpaceAfterAnonymousFunctionKeyword: Rule; public NoSpaceAfterAnonymousFunctionKeyword: Rule; @@ -232,13 +239,13 @@ namespace ts.formatting { this.SpaceBetweenCloseBraceAndWhile = new Rule(RuleDescriptor.create1(SyntaxKind.CloseBraceToken, SyntaxKind.WhileKeyword), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); this.NoSpaceAfterCloseBrace = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBraceToken, Shared.TokenRange.FromTokens([SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.CommaToken, SyntaxKind.SemicolonToken])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - // No space for indexer and dot + // No space for dot this.NoSpaceBeforeDot = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.DotToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); this.NoSpaceAfterDot = new Rule(RuleDescriptor.create3(SyntaxKind.DotToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + + // No space before and after indexer this.NoSpaceBeforeOpenBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.OpenBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); - this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), RuleAction.Delete)); + this.NoSpaceAfterCloseBracket = new Rule(RuleDescriptor.create3(SyntaxKind.CloseBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext ), RuleAction.Delete)); // Place a space before open brace in a function declaration this.FunctionOpenBraceLeftTokenRange = Shared.TokenRange.AnyIncludingMultilineComments; @@ -405,8 +412,8 @@ namespace ts.formatting { this.NoSpaceBeforeSemicolon, this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.NoSpaceBeforeOpenBracket, + this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, this.NoSpaceBeforeOpenParenInFuncDecl, this.SpaceBetweenStatements, this.SpaceAfterTryFinally @@ -451,6 +458,13 @@ namespace ts.formatting { this.NoSpaceAfterOpenParen = new Rule(RuleDescriptor.create3(SyntaxKind.OpenParenToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); this.NoSpaceBeforeCloseParen = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + // Insert space after opening and before closing nonempty brackets + this.SpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.SpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space)); + this.NoSpaceBetweenBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBracketToken, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceAfterOpenBracket = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBracketToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + this.NoSpaceBeforeCloseBracket = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBracketToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete)); + // Insert space after function keyword for anonymous functions this.SpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space)); this.NoSpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Delete)); @@ -715,6 +729,7 @@ namespace ts.formatting { case SyntaxKind.TypeReference: case SyntaxKind.TypeAssertionExpression: case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.FunctionDeclaration: case SyntaxKind.FunctionExpression: @@ -725,6 +740,7 @@ namespace ts.formatting { case SyntaxKind.ConstructSignature: case SyntaxKind.CallExpression: case SyntaxKind.NewExpression: + case SyntaxKind.ExpressionWithTypeArguments: return true; default: return false; diff --git a/src/services/formatting/rulesProvider.ts b/src/services/formatting/rulesProvider.ts index ac1494571d142..f6cf1de474b47 100644 --- a/src/services/formatting/rulesProvider.ts +++ b/src/services/formatting/rulesProvider.ts @@ -71,6 +71,17 @@ namespace ts.formatting { rules.push(this.globalRules.NoSpaceBetweenParens); } + if ( options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets ) { + rules.push( this.globalRules.SpaceAfterOpenBracket ); + rules.push( this.globalRules.SpaceBeforeCloseBracket ); + rules.push( this.globalRules.NoSpaceBetweenBrackets ); + } + else { + rules.push( this.globalRules.NoSpaceAfterOpenBracket ); + rules.push( this.globalRules.NoSpaceBeforeCloseBracket ); + rules.push( this.globalRules.NoSpaceBetweenBrackets ); + } + if (options.InsertSpaceAfterSemicolonInForStatements) { rules.push(this.globalRules.SpaceAfterSemicolonInFor); } diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 3b291b6e39a23..c7f762fea6496 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -428,6 +428,7 @@ namespace ts.formatting { case SyntaxKind.ConditionalExpression: case SyntaxKind.ArrayBindingPattern: case SyntaxKind.ObjectBindingPattern: + case SyntaxKind.JsxElement: return true; } return false; diff --git a/src/services/services.ts b/src/services/services.ts index 519e4ee112140..4004e02f65ce0 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -73,7 +73,7 @@ namespace ts { } /** - * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * Represents an immutable snapshot of a script at a specified time.Once acquired, the * snapshot is observably immutable. i.e. the same calls with the same parameters will return * the same values. */ @@ -85,9 +85,9 @@ namespace ts { getLength(): number; /** - * Gets the TextChangeRange that describe how the text changed between this text and + * Gets the TextChangeRange that describe how the text changed between this text and * an older version. This information is used by the incremental parser to determine - * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * what sections of the script need to be re-parsed. 'undefined' can be returned if the * change range cannot be determined. However, in that case, incremental parsing will * not happen and the entire document will be re - parsed. */ @@ -125,12 +125,53 @@ namespace ts { export interface PreProcessedFileInfo { referencedFiles: FileReference[]; importedFiles: FileReference[]; + ambientExternalModules: string[]; isLibFile: boolean } let scanner: Scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); let emptyArray: any[] = []; + + const jsDocTagNames = [ + "augments", + "author", + "argument", + "borrows", + "class", + "constant", + "constructor", + "constructs", + "default", + "deprecated", + "description", + "event", + "example", + "extends", + "field", + "fileOverview", + "function", + "ignore", + "inner", + "lends", + "link", + "memberOf", + "name", + "namespace", + "param", + "private", + "property", + "public", + "requires", + "returns", + "see", + "since", + "static", + "throws", + "type", + "version" + ]; + let jsDocCompletionEntries: CompletionEntry[]; function createNode(kind: SyntaxKind, pos: number, end: number, flags: NodeFlags, parent?: Node): NodeObject { let node = new (getNodeConstructor(kind))(); @@ -275,8 +316,8 @@ namespace ts { let children = this.getChildren(sourceFile); let child = lastOrUndefined(children); - if (!child) { - return undefined; + if (!child) { + return undefined; } return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile); @@ -336,10 +377,10 @@ namespace ts { ts.forEach(declarations, (declaration, indexOfDeclaration) => { // Make sure we are collecting doc comment from declaration once, - // In case of union property there might be same declaration multiple times + // In case of union property there might be same declaration multiple times // which only varies in type parameter // Eg. let a: Array | Array; a.length - // The property length will have two declarations of property length coming + // The property length will have two declarations of property length coming // from Array - Array and Array if (indexOf(declarations, declaration) === indexOfDeclaration) { let sourceFileOfDeclaration = getSourceFileOfNode(declaration); @@ -361,7 +402,7 @@ namespace ts { // If this is dotted module name, get the doc comments from the parent while (declaration.kind === SyntaxKind.ModuleDeclaration && declaration.parent.kind === SyntaxKind.ModuleDeclaration) { declaration = declaration.parent; - } + } // Get the cleaned js doc comment text from the declaration ts.forEach(getJsDocCommentTextRange( @@ -381,7 +422,7 @@ namespace ts { jsDocComment => { return { pos: jsDocComment.pos + "/*".length, // Consume /* from the comment - end: jsDocComment.end - "*/".length // Trim off comment end indicator + end: jsDocComment.end - "*/".length // Trim off comment end indicator }; }); } @@ -486,7 +527,7 @@ namespace ts { pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); blankLineCount = 0; } - else if (!isInParamTag && docComments.length) { + else if (!isInParamTag && docComments.length) { // This is blank line when there is text already parsed blankLineCount++; } @@ -502,7 +543,7 @@ namespace ts { if (isParamTag(pos, end, sourceFile)) { let blankLineCount = 0; let recordedParamTag = false; - // Consume leading spaces + // Consume leading spaces pos = consumeWhiteSpaces(pos + paramTag.length); if (pos >= end) { break; @@ -560,7 +601,7 @@ namespace ts { while (pos < end) { let ch = sourceFile.text.charCodeAt(pos); - // at line break, set this comment line text and go to next line + // at line break, set this comment line text and go to next line if (isLineBreak(ch)) { if (paramHelpString) { pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); @@ -626,7 +667,7 @@ namespace ts { paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } - // Now consume white spaces max + // Now consume white spaces max let startOfLinePos = pos; pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); if (pos >= end) { @@ -761,7 +802,8 @@ namespace ts { public languageVariant: LanguageVariant; public identifiers: Map; public nameTable: Map; - + public resolvedModules: Map; + public imports: LiteralExpression[]; private namedDeclarations: Map; public update(newText: string, textChangeRange: TextChangeRange): SourceFile { @@ -974,6 +1016,13 @@ namespace ts { trace? (s: string): void; error? (s: string): void; useCaseSensitiveFileNames? (): boolean; + + /* + * LS host can optionally implement this method if it wants to be completely in charge of module name resolution. + * if implementation is omitted then language service will use built-in module resolution logic and get answers to + * host specific questions using 'getScriptSnapshot'. + */ + resolveModuleNames?(moduleNames: string[], containingFile: string): string[]; } // @@ -990,17 +1039,17 @@ namespace ts { // diagnostics present for the program level, and not just 'options' diagnostics. getCompilerOptionsDiagnostics(): Diagnostic[]; - /** + /** * @deprecated Use getEncodedSyntacticClassifications instead. */ getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; - /** + /** * @deprecated Use getEncodedSemanticClassifications instead. */ getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; - // Encoded as triples of [start, length, ClassificationType]. + // Encoded as triples of [start, length, ClassificationType]. getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; @@ -1149,6 +1198,7 @@ namespace ts { InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; [s: string]: boolean | number| string; @@ -1227,7 +1277,7 @@ namespace ts { * Represents a single signature to show in signature help. * The id is used for subsequent calls into the language service to ask questions about the * signature help item in the context of any documents that have been updated. i.e. after - * an edit has happened, while signature help is still active, the host can ask important + * an edit has happened, while signature help is still active, the host can ask important * questions like 'what parameter is the user currently contained within?'. */ export interface SignatureHelpItem { @@ -1281,8 +1331,8 @@ namespace ts { /** The text to display in the editor for the collapsed region. */ bannerText: string; - /** - * Whether or not this region should be automatically collapsed when + /** + * Whether or not this region should be automatically collapsed when * the 'Collapse to Definitions' command is invoked. */ autoCollapse: boolean; @@ -1363,18 +1413,18 @@ namespace ts { } /** - * The document registry represents a store of SourceFile objects that can be shared between + * The document registry represents a store of SourceFile objects that can be shared between * multiple LanguageService instances. A LanguageService instance holds on the SourceFile (AST) - * of files in the context. - * SourceFile objects account for most of the memory usage by the language service. Sharing - * the same DocumentRegistry instance between different instances of LanguageService allow - * for more efficient memory utilization since all projects will share at least the library + * of files in the context. + * SourceFile objects account for most of the memory usage by the language service. Sharing + * the same DocumentRegistry instance between different instances of LanguageService allow + * for more efficient memory utilization since all projects will share at least the library * file (lib.d.ts). * - * A more advanced use of the document registry is to serialize sourceFile objects to disk + * A more advanced use of the document registry is to serialize sourceFile objects to disk * and re-hydrate them when needed. * - * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it + * To create a default DocumentRegistry, use createDocumentRegistry to create one, and pass it * to all subsequent createLanguageService calls. */ export interface DocumentRegistry { @@ -1384,7 +1434,7 @@ namespace ts { * the SourceFile if was not found in the registry. * * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the + * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. * @parm scriptSnapshot Text of the file. Only used if the file was not found @@ -1404,10 +1454,10 @@ namespace ts { * to get an updated SourceFile. * * @param fileName The name of the file requested - * @param compilationSettings Some compilation settings like target affects the + * @param compilationSettings Some compilation settings like target affects the * shape of a the resulting SourceFile. This allows the DocumentRegistry to store * multiple copies of the same file for different compilation settings. - * @param scriptSnapshot Text of the file. + * @param scriptSnapshot Text of the file. * @param version Current version of the file. */ updateDocument( @@ -1579,7 +1629,7 @@ namespace ts { sourceFile: SourceFile; // The number of language services that this source file is referenced in. When no more - // language services are referencing the file, then the file can be removed from the + // language services are referencing the file, then the file can be removed from the // registry. languageServiceRefCount: number; owners: string[]; @@ -1634,8 +1684,8 @@ namespace ts { }; } - // Cache host information about scrip Should be refreshed - // at each language service public entry point, since we don't know when + // Cache host information about scrip Should be refreshed + // at each language service public entry point, since we don't know when // set of scripts handled by the host changes. class HostCache { private fileNameToEntry: FileMap; @@ -1714,8 +1764,8 @@ namespace ts { } class SyntaxTreeCache { - // For our syntactic only features, we also keep a cache of the syntax tree for the - // currently edited file. + // For our syntactic only features, we also keep a cache of the syntax tree for the + // currently edited file. private currentFileName: string; private currentFileVersion: string; private currentFileScriptSnapshot: IScriptSnapshot; @@ -1760,20 +1810,21 @@ namespace ts { sourceFile.version = version; sourceFile.scriptSnapshot = scriptSnapshot; } - + export interface TranspileOptions { compilerOptions?: CompilerOptions; fileName?: string; reportDiagnostics?: boolean; moduleName?: string; + renamedDependencies?: Map; } - + export interface TranspileOutput { outputText: string; diagnostics?: Diagnostic[]; sourceMapText?: string; } - + /* * This function will compile source text from 'input' argument using specified compiler options. * If not options are provided - it will use a set of default compiler options. @@ -1783,7 +1834,7 @@ namespace ts { * - noLib = true * - noResolve = true */ - export function transpileModule(input: string, transpileOptions?: TranspileOptions): TranspileOutput { + export function transpileModule(input: string, transpileOptions: TranspileOptions): TranspileOutput { let options = transpileOptions.compilerOptions ? clone(transpileOptions.compilerOptions) : getDefaultCompilerOptions(); options.isolatedModules = true; @@ -1791,7 +1842,7 @@ namespace ts { // Filename can be non-ts file. options.allowNonTsExtensions = true; - // We are not returning a sourceFile for lib file when asked by the program, + // We are not returning a sourceFile for lib file when asked by the program, // so pass --noLib to avoid reporting a file not found error. options.noLib = true; @@ -1806,12 +1857,13 @@ namespace ts { sourceFile.moduleName = transpileOptions.moduleName; } + sourceFile.renamedDependencies = transpileOptions.renamedDependencies; + let newLine = getNewLineCharacter(options); // Output let outputText: string; let sourceMapText: string; - // Create a compilerHost object to allow the compiler to read and write files let compilerHost: CompilerHost = { getSourceFile: (fileName, target) => fileName === inputFileName ? sourceFile : undefined, @@ -1829,11 +1881,13 @@ namespace ts { useCaseSensitiveFileNames: () => false, getCanonicalFileName: fileName => fileName, getCurrentDirectory: () => "", - getNewLine: () => newLine + getNewLine: () => newLine, + fileExists: (fileName): boolean => fileName === inputFileName, + readFile: (fileName): string => "" }; let program = createProgram([inputFileName], options, compilerHost); - + let diagnostics: Diagnostic[]; if (transpileOptions.reportDiagnostics) { diagnostics = []; @@ -1845,11 +1899,11 @@ namespace ts { Debug.assert(outputText !== undefined, "Output generation failed"); - return { outputText, diagnostics, sourceMapText }; + return { outputText, diagnostics, sourceMapText }; } /* - * This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result. + * This is a shortcut function for transpileModule - it accepts transpileOptions as parameters and returns only outputText part of the result. */ export function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string { let output = transpileModule(input, { compilerOptions, fileName, reportDiagnostics: !!diagnostics, moduleName }); @@ -1870,19 +1924,19 @@ namespace ts { export let disableIncrementalParsing = false; export function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile { - // If we were given a text change range, and our version or open-ness changed, then + // If we were given a text change range, and our version or open-ness changed, then // incrementally parse this file. if (textChangeRange) { if (version !== sourceFile.version) { // Once incremental parsing is ready, then just call into this function. if (!disableIncrementalParsing) { let newText: string; - + // grab the fragment from the beginning of the original text to the beginning of the span let prefix = textChangeRange.span.start !== 0 ? sourceFile.text.substr(0, textChangeRange.span.start) : ""; - + // grab the fragment from the end of the span till the end of the original text let suffix = textSpanEnd(textChangeRange.span) !== sourceFile.text.length ? sourceFile.text.substr(textSpanEnd(textChangeRange.span)) @@ -1896,10 +1950,10 @@ namespace ts { // it was actual edit, fetch the fragment of new text that correspond to new span let changedText = scriptSnapshot.getText(textChangeRange.span.start, textChangeRange.span.start + textChangeRange.newLength); // combine prefix, changed text and suffix - newText = prefix && suffix + newText = prefix && suffix ? prefix + changedText + suffix : prefix - ? (prefix + changedText) + ? (prefix + changedText) : (changedText + suffix); } @@ -1927,7 +1981,7 @@ namespace ts { return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents:*/ true); } - function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string { + export function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string { return useCaseSensitivefileNames ? ((fileName) => fileName) : ((fileName) => fileName.toLowerCase()); @@ -1941,7 +1995,7 @@ namespace ts { let getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames); function getKeyFromCompilationSettings(settings: CompilerOptions): string { - return "_" + settings.target; // + "|" + settings.propagateEnumConstantoString() + return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx; } function getBucketForCompilationSettings(settings: CompilerOptions, createIfMissing: boolean): FileMap { @@ -2005,7 +2059,7 @@ namespace ts { bucket.set(fileName, entry); } else { - // We have an entry for this file. However, it may be for a different version of + // We have an entry for this file. However, it may be for a different version of // the script snapshot. If so, update it appropriately. Otherwise, we can just // return it as is. if (entry.sourceFile.version !== version) { @@ -2050,6 +2104,7 @@ namespace ts { export function preProcessFile(sourceText: string, readImportFiles = true): PreProcessedFileInfo { let referencedFiles: FileReference[] = []; let importedFiles: FileReference[] = []; + let ambientExternalModules: string[]; let isNoDefaultLib = false; function processTripleSlashDirectives(): void { @@ -2067,6 +2122,13 @@ namespace ts { }); } + function recordAmbientExternalModule(): void { + if (!ambientExternalModules) { + ambientExternalModules = []; + } + ambientExternalModules.push(scanner.getTokenValue()); + } + function recordModuleName() { let importPath = scanner.getTokenValue(); let pos = scanner.getTokenPos(); @@ -2092,7 +2154,18 @@ namespace ts { // export {a as b} from "mod" while (token !== SyntaxKind.EndOfFileToken) { - if (token === SyntaxKind.ImportKeyword) { + if (token === SyntaxKind.DeclareKeyword) { + // declare module "mod" + token = scanner.scan(); + if (token === SyntaxKind.ModuleKeyword) { + token = scanner.scan(); + if (token === SyntaxKind.StringLiteral) { + recordAmbientExternalModule(); + continue; + } + } + } + else if (token === SyntaxKind.ImportKeyword) { token = scanner.scan(); if (token === SyntaxKind.StringLiteral) { // import "mod"; @@ -2100,7 +2173,7 @@ namespace ts { continue; } else { - if (token === SyntaxKind.Identifier) { + if (token === SyntaxKind.Identifier || isKeyword(token)) { token = scanner.scan(); if (token === SyntaxKind.FromKeyword) { token = scanner.scan(); @@ -2157,7 +2230,7 @@ namespace ts { token = scanner.scan(); if (token === SyntaxKind.AsKeyword) { token = scanner.scan(); - if (token === SyntaxKind.Identifier) { + if (token === SyntaxKind.Identifier || isKeyword(token)) { token = scanner.scan(); if (token === SyntaxKind.FromKeyword) { token = scanner.scan(); @@ -2213,7 +2286,7 @@ namespace ts { processImport(); } processTripleSlashDirectives(); - return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib }; + return { referencedFiles, importedFiles, isLibFile: isNoDefaultLib, ambientExternalModules }; } /// Helpers @@ -2520,18 +2593,22 @@ namespace ts { return; } - // IMPORTANT - It is critical from this moment onward that we do not check + // IMPORTANT - It is critical from this moment onward that we do not check // cancellation tokens. We are about to mutate source files from a previous program // instance. If we cancel midway through, we may end up in an inconsistent state where - // the program points to old source files that have been invalidated because of + // the program points to old source files that have been invalidated because of // incremental parsing. let oldSettings = program && program.getCompilerOptions(); let newSettings = hostCache.compilationSettings(); - let changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; + let changesInCompilationSettingsAffectSyntax = oldSettings && + (oldSettings.target !== newSettings.target || + oldSettings.module !== newSettings.module || + oldSettings.noResolve !== newSettings.noResolve || + oldSettings.jsx !== newSettings.jsx); // Now create a new compiler - let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, { + let compilerHost: CompilerHost = { getSourceFile: getOrCreateSourceFile, getCancellationToken: () => cancellationToken, getCanonicalFileName, @@ -2539,10 +2616,26 @@ namespace ts { getNewLine: () => getNewLineOrDefaultFromHost(host), getDefaultLibFileName: (options) => host.getDefaultLibFileName(options), writeFile: (fileName, data, writeByteOrderMark) => { }, - getCurrentDirectory: () => host.getCurrentDirectory() - }); + getCurrentDirectory: () => host.getCurrentDirectory(), + fileExists: (fileName): boolean => { + // stub missing host functionality + Debug.assert(!host.resolveModuleNames); + return hostCache.getOrCreateEntry(fileName) !== undefined; + }, + readFile: (fileName): string => { + // stub missing host functionality + let entry = hostCache.getOrCreateEntry(fileName); + return entry && entry.scriptSnapshot.getText(0, entry.scriptSnapshot.getLength()); + } + }; + + if (host.resolveModuleNames) { + compilerHost.resolveModuleNames = (moduleNames, containingFile) => host.resolveModuleNames(moduleNames, containingFile) + } - // Release any files we have acquired in the old program but are + let newProgram = createProgram(hostCache.getRootFileNames(), newSettings, compilerHost, program); + + // Release any files we have acquired in the old program but are // not part of the new program. if (program) { let oldSourceFiles = program.getSourceFiles(); @@ -2560,7 +2653,7 @@ namespace ts { program = newProgram; - // Make sure all the nodes in the program are both bound, and have their parent + // Make sure all the nodes in the program are both bound, and have their parent // pointers set property. program.getTypeChecker(); return; @@ -2582,7 +2675,7 @@ namespace ts { // Check if the old program had this file already let oldSourceFile = program && program.getSourceFile(fileName); if (oldSourceFile) { - // We already had a source file for this file name. Go to the registry to + // We already had a source file for this file name. Go to the registry to // ensure that we get the right up to date version of it. We need this to // address the following 'race'. Specifically, say we have the following: // @@ -2593,15 +2686,15 @@ namespace ts { // LS2 // // Each LS has a reference to file 'foo.ts' at version 1. LS2 then updates - // it's version of 'foo.ts' to version 2. This will cause LS2 and the - // DocumentRegistry to have version 2 of the document. HOwever, LS1 will + // it's version of 'foo.ts' to version 2. This will cause LS2 and the + // DocumentRegistry to have version 2 of the document. HOwever, LS1 will // have version 1. And *importantly* this source file will be *corrupt*. // The act of creating version 2 of the file irrevocably damages the version // 1 file. // // So, later when we call into LS1, we need to make sure that it doesn't use // it's source file any more, and instead defers to DocumentRegistry to get - // either version 1, version 2 (or some other version) depending on what the + // either version 1, version 2 (or some other version) depending on what the // host says should be used. return documentRegistry.updateDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); } @@ -2667,7 +2760,7 @@ namespace ts { /** * getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors - * If '-d' enabled, report both semantic and emitter errors + * If '-d' enabled, report both semantic and emitter errors */ function getSemanticDiagnostics(fileName: string): Diagnostic[] { synchronizeHostData(); @@ -2675,7 +2768,7 @@ namespace ts { let targetSourceFile = getValidSourceFile(fileName); // For JavaScript files, we don't want to report the normal typescript semantic errors. - // Instead, we just report errors for using TypeScript-only constructs from within a + // Instead, we just report errors for using TypeScript-only constructs from within a // JavaScript file. if (isJavaScript(fileName)) { return getJavaScriptSemanticDiagnostics(targetSourceFile); @@ -2918,6 +3011,8 @@ namespace ts { let sourceFile = getValidSourceFile(fileName); let isJavaScriptFile = isJavaScript(fileName); + let isJsDocTagName = false; + let start = new Date().getTime(); let currentToken = getTokenAtPosition(sourceFile, position); log("getCompletionData: Get current token: " + (new Date().getTime() - start)); @@ -2928,8 +3023,44 @@ namespace ts { log("getCompletionData: Is inside comment: " + (new Date().getTime() - start)); if (insideComment) { - log("Returning an empty list because completion was inside a comment."); - return undefined; + // The current position is next to the '@' sign, when no tag name being provided yet. + // Provide a full list of tag names + if (hasDocComment(sourceFile, position) && sourceFile.text.charCodeAt(position - 1) === CharacterCodes.at) { + isJsDocTagName = true; + } + + // Completion should work inside certain JsDoc tags. For example: + // /** @type {number | string} */ + // Completion should work in the brackets + let insideJsDocTagExpression = false; + let tag = getJsDocTagAtPosition(sourceFile, position); + if (tag) { + if (tag.tagName.pos <= position && position <= tag.tagName.end) { + isJsDocTagName = true; + } + + switch (tag.kind) { + case SyntaxKind.JSDocTypeTag: + case SyntaxKind.JSDocParameterTag: + case SyntaxKind.JSDocReturnTag: + let tagWithExpression = tag; + if (tagWithExpression.typeExpression) { + insideJsDocTagExpression = tagWithExpression.typeExpression.pos < position && position < tagWithExpression.typeExpression.end; + } + break; + } + } + + if (isJsDocTagName) { + return { symbols: undefined, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, isJsDocTagName }; + } + + if (!insideJsDocTagExpression) { + // Proceed if the current position is in jsDoc tag expression; otherwise it is a normal + // comment or the plain text part of a jsDoc comment, so no completion should be available + log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment."); + return undefined; + } } start = new Date().getTime(); @@ -3015,7 +3146,7 @@ namespace ts { log("getCompletionData: Semantic work: " + (new Date().getTime() - semanticStart)); - return { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot: (isRightOfDot || isRightOfOpenTag) }; + return { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), isJsDocTagName }; function getTypeScriptMemberSymbols(): void { // Right of dot member completion list @@ -3055,7 +3186,7 @@ namespace ts { } if (isJavaScriptFile && type.flags & TypeFlags.Union) { - // In javascript files, for union types, we don't just get the members that + // In javascript files, for union types, we don't just get the members that // the individual types have in common, we also include all the members that // each individual type has. This is because we're going to add all identifiers // anyways. So we might as well elevate the members that were at least part @@ -3110,10 +3241,10 @@ namespace ts { // aggregating completion candidates. This is achieved in 'getScopeNode' // by finding the first node that encompasses a position, accounting for whether a node // is "complete" to decide whether a position belongs to the node. - // + // // However, at the end of an identifier, we are interested in the scope of the identifier // itself, but fall outside of the identifier. For instance: - // + // // xyz => x$ // // the cursor is outside of both the 'x' and the arrow function 'xyz => x', @@ -3140,7 +3271,7 @@ namespace ts { /// TODO filter meaning based on the current context let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias; symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings); - + return true; } @@ -3278,7 +3409,7 @@ namespace ts { let rootDeclaration = getRootDeclaration(objectLikeContainer.parent); if (isVariableLike(rootDeclaration)) { - // We don't want to complete using the type acquired by the shape + // We don't want to complete using the type acquired by the shape // of the binding pattern; we are only interested in types acquired // through type declaration or inference. if (rootDeclaration.initializer || rootDeclaration.type) { @@ -3415,7 +3546,6 @@ namespace ts { parent.kind === SyntaxKind.JsxExpression && parent.parent && (parent.parent.kind === SyntaxKind.JsxAttribute)) { - return parent.parent.parent; } @@ -3462,16 +3592,16 @@ namespace ts { containingNodeKind === SyntaxKind.FunctionDeclaration || // function A !lookUp(existingMemberNames, m.name)); } - + /** * Filters out completion suggestions from 'symbols' according to existing JSX attributes. * @@ -3656,9 +3786,14 @@ namespace ts { return undefined; } - let { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot } = completionData; + let { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot, isJsDocTagName } = completionData; let entries: CompletionEntry[]; + if (isJsDocTagName) { + // If the current position is a jsDoc tag name, only tag names should be provided for completion + return { isMemberCompletion: false, isNewIdentifierLocation: false, entries: getAllJsDocCompletionEntries() }; + } + if (isRightOfDot && isJavaScript(fileName)) { entries = getCompletionEntriesFromSymbols(symbols); addRange(entries, getJavaScriptCompletionEntries()); @@ -3672,7 +3807,7 @@ namespace ts { } // Add keywords if this is not a member completion list - if (!isMemberCompletion) { + if (!isMemberCompletion && !isJsDocTagName) { addRange(entries, keywordCompletions); } @@ -3705,8 +3840,19 @@ namespace ts { return entries; } + function getAllJsDocCompletionEntries(): CompletionEntry[] { + return jsDocCompletionEntries || (jsDocCompletionEntries = ts.map(jsDocTagNames, tagName => { + return { + name: tagName, + kind: ScriptElementKind.keyword, + kindModifiers: "", + sortText: "0", + } + })); + } + function createCompletionEntry(symbol: Symbol, location: Node): CompletionEntry { - // Try to get a valid display name for this symbol, if we could not find one, then ignore it. + // Try to get a valid display name for this symbol, if we could not find one, then ignore it. // We would like to only show things that can be added after a dot, so for instance numeric properties can // not be accessed with a dot (a.1 <- invalid) let displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks:*/ true, location); @@ -3714,10 +3860,10 @@ namespace ts { return undefined; } - // TODO(drosen): Right now we just permit *all* semantic meanings when calling - // 'getSymbolKind' which is permissible given that it is backwards compatible; but + // TODO(drosen): Right now we just permit *all* semantic meanings when calling + // 'getSymbolKind' which is permissible given that it is backwards compatible; but // really we should consider passing the meaning for the node so that we don't report - // that a suggestion for a value is an interface. We COULD also just do what + // that a suggestion for a value is an interface. We COULD also just do what // 'getSymbolModifiers' does, which is to use the first declaration. // Use a 'sortText' of 0' so that all symbol completion entries come before any other @@ -3763,8 +3909,8 @@ namespace ts { // Find the symbol with the matching entry name. let target = program.getCompilerOptions().target; - // We don't need to perform character checks here because we're only comparing the - // name against 'entryName' (which is known to be good), not building a new + // We don't need to perform character checks here because we're only comparing the + // name against 'entryName' (which is known to be good), not building a new // completion entry. let symbol = forEach(symbols, s => getCompletionEntryDisplayNameForSymbol(s, target, /*performCharacterChecks:*/ false, location) === entryName ? s : undefined); @@ -3779,7 +3925,7 @@ namespace ts { }; } } - + // Didn't find a symbol with this name. See if we can find a keyword instead. let keywordCompletion = forEach(keywordCompletions, c => c.name === entryName); if (keywordCompletion) { @@ -3855,7 +4001,7 @@ namespace ts { Debug.assert(!!(rootSymbolFlags & SymbolFlags.Method)); }); if (!unionPropertyKind) { - // If this was union of all methods, + // If this was union of all methods, //make sure it has call signatures before we can label it as method let typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (typeOfUnionProperty.getCallSignatures().length) { @@ -3929,7 +4075,7 @@ namespace ts { let allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!contains(allSignatures, signature.target || signature)) { - // Get the first signature if there + // Get the first signature if there signature = allSignatures.length ? allSignatures[0] : undefined; } @@ -4307,7 +4453,7 @@ namespace ts { if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { - // Just add all the declarations. + // Just add all the declarations. forEach(declarations, declaration => { result.push(createDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -4418,7 +4564,7 @@ namespace ts { // Because name in short-hand property assignment has two different meanings: property name and property value, // using go-to-definition at such position should go to the variable declaration of the property value rather than - // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition + // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. if (node.parent.kind === SyntaxKind.ShorthandPropertyAssignment) { @@ -4484,7 +4630,7 @@ namespace ts { if (results) { let sourceFile = getCanonicalFileName(normalizeSlashes(fileName)); - // Get occurrences only supports reporting occurrences for the file queried. So + // Get occurrences only supports reporting occurrences for the file queried. So // filter down to that list. results = filter(results, r => getCanonicalFileName(ts.normalizeSlashes(r.fileName)) === sourceFile); } @@ -4711,7 +4857,7 @@ namespace ts { if (isFunctionBlock(parent) || parent.kind === SyntaxKind.SourceFile) { return parent; } - + // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. if (parent.kind === SyntaxKind.TryStatement) { @@ -4805,7 +4951,7 @@ namespace ts { return undefined; } } - else { + else { // unsupported modifier return undefined; } @@ -5401,13 +5547,13 @@ namespace ts { // If we are past the end, stop looking if (position > end) break; - // We found a match. Make sure it's not part of a larger word (i.e. the char + // We found a match. Make sure it's not part of a larger word (i.e. the char // before and after it have to be a non-identifier char). let endPosition = position + symbolNameLength; if ((position === 0 || !isIdentifierPart(text.charCodeAt(position - 1), ScriptTarget.Latest)) && (endPosition === sourceLength || !isIdentifierPart(text.charCodeAt(endPosition), ScriptTarget.Latest))) { - // Found a real match. Keep searching. + // Found a real match. Keep searching. positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -5474,9 +5620,9 @@ namespace ts { return false; } - /** Search within node "container" for references for a search value, where the search value is defined as a + /** Search within node "container" for references for a search value, where the search value is defined as a * tuple of(searchSymbol, searchText, searchLocation, and searchMeaning). - * searchLocation: a node where the search value + * searchLocation: a node where the search value */ function getReferencesInNode(container: Node, searchSymbol: Symbol, @@ -5502,7 +5648,7 @@ namespace ts { let referenceLocation = getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - // This wasn't the start of a token. Check to see if it might be a + // This wasn't the start of a token. Check to see if it might be a // match in a comment or string if that's what the caller is asking // for. if ((findInStrings && isInString(sourceFile, position)) || @@ -5827,7 +5973,7 @@ namespace ts { } } - // If the reference location is in an object literal, try to get the contextual type for the + // If the reference location is in an object literal, try to get the contextual type for the // object literal, lookup the property symbol in the contextual type, and use this symbol to // compare to our searchSymbol if (isNameOfPropertyAssignment(referenceLocation)) { @@ -5844,7 +5990,7 @@ namespace ts { return rootSymbol; } - // Finally, try all properties with the same name in any type the containing type extended or implemented, and + // Finally, try all properties with the same name in any type the containing type extended or implemented, and // see if any is in the list if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) { let result: Symbol[] = []; @@ -6195,7 +6341,7 @@ namespace ts { } else if (isNameOfModuleDeclaration(nodeForStartPos)) { // If this is name of a module declarations, check if this is right side of dotted module name - // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of + // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module if (nodeForStartPos.parent.parent.kind === SyntaxKind.ModuleDeclaration && (nodeForStartPos.parent.parent).body === nodeForStartPos.parent) { @@ -6238,7 +6384,7 @@ namespace ts { // been canceled. That would be an enormous amount of chattyness, along with the all // the overhead of marshalling the data to/from the host. So instead we pick a few // reasonable node kinds to bother checking on. These node kinds represent high level - // constructs that we would expect to see commonly, but just at a far less frequent + // constructs that we would expect to see commonly, but just at a far less frequent // interval. // // For example, in checker.ts (around 750k) we only have around 600 of these constructs. @@ -6311,7 +6457,7 @@ namespace ts { */ function hasValueSideModule(symbol: Symbol): boolean { return forEach(symbol.declarations, declaration => { - return declaration.kind === SyntaxKind.ModuleDeclaration && + return declaration.kind === SyntaxKind.ModuleDeclaration && getModuleInstanceState(declaration) === ModuleInstanceState.Instantiated; }); } @@ -6432,8 +6578,8 @@ namespace ts { // Only bother with the trivia if it at least intersects the span of interest. if (isComment(kind)) { classifyComment(token, kind, start, width); - - // Classifying a comment might cause us to reuse the trivia scanner + + // Classifying a comment might cause us to reuse the trivia scanner // (because of jsdoc comments). So after we classify the comment make // sure we set the scanner position back to where it needs to be. triviaScanner.setTextPos(end); @@ -6484,7 +6630,7 @@ namespace ts { for (let tag of docComment.tags) { // As we walk through each tag, classify the portion of text from the end of - // the last tag (or the start of the entire doc comment) as 'comment'. + // the last tag (or the start of the entire doc comment) as 'comment'. if (tag.pos !== pos) { pushCommentRange(pos, tag.pos - pos); } @@ -6546,7 +6692,7 @@ namespace ts { } function classifyDisabledMergeCode(text: string, start: number, end: number) { - // Classify the line that the ======= marker is on as a comment. Then just lex + // Classify the line that the ======= marker is on as a comment. Then just lex // all further tokens and add them to the result. for (var i = start; i < end; i++) { if (isLineBreak(text.charCodeAt(i))) { @@ -6589,7 +6735,7 @@ namespace ts { } } - // for accurate classification, the actual token should be passed in. however, for + // for accurate classification, the actual token should be passed in. however, for // cases like 'disabled merge code' classification, we just get the token kind and // classify based on that instead. function classifyTokenType(tokenKind: SyntaxKind, token?: Node): ClassificationType { @@ -6875,11 +7021,11 @@ namespace ts { } function getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { - // Note: while getting todo comments seems like a syntactic operation, we actually + // Note: while getting todo comments seems like a syntactic operation, we actually // treat it as a semantic operation here. This is because we expect our host to call // this on every single file. If we treat this syntactically, then that will cause // us to populate and throw away the tree in our syntax tree cache for each file. By - // treating this as a semantic operation, we can access any tree without throwing + // treating this as a semantic operation, we can access any tree without throwing // anything away. synchronizeHostData(); @@ -6909,7 +7055,7 @@ namespace ts { // 0) The full match for the entire regexp. // 1) The preamble to the message portion. // 2) The message portion. - // 3...N) The descriptor that was matched - by index. 'undefined' for each + // 3...N) The descriptor that was matched - by index. 'undefined' for each // descriptor that didn't match. an actual value if it did match. // // i.e. 'undefined' in position 3 above means TODO(jason) didn't match. @@ -6935,7 +7081,7 @@ namespace ts { } Debug.assert(descriptor !== undefined); - // We don't want to match something like 'TODOBY', so we make sure a non + // We don't want to match something like 'TODOBY', so we make sure a non // letter/digit follows the match. if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { continue; @@ -6987,11 +7133,11 @@ namespace ts { // (?:(TODO\(jason\))|(HACK)) // // Note that the outermost group is *not* a capture group, but the innermost groups - // *are* capture groups. By capturing the inner literals we can determine after + // *are* capture groups. By capturing the inner literals we can determine after // matching which descriptor we are dealing with. let literals = "(?:" + map(descriptors, d => "(" + escapeRegExp(d.text) + ")").join("|") + ")"; - // After matching a descriptor literal, the following regexp matches the rest of the + // After matching a descriptor literal, the following regexp matches the rest of the // text up to the end of the line (or */). let endOfLineOrEndOfComment = /(?:$|\*\/)/.source let messageRemainder = /(?:.*?)/.source @@ -7174,7 +7320,7 @@ namespace ts { /// We do not have a full parser support to know when we should parse a regex or not /// If we consider every slash token to be a regex, we could be missing cases like "1/2/3", where - /// we have a series of divide operator. this list allows us to be more accurate by ruling out + /// we have a series of divide operator. this list allows us to be more accurate by ruling out /// locations where a regexp cannot exist. let noRegexTable: boolean[] = []; noRegexTable[SyntaxKind.Identifier] = true; @@ -7220,7 +7366,7 @@ namespace 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; } @@ -7291,7 +7437,7 @@ namespace ts { function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult { return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); } - + // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), // we will be more conservative in order to avoid conflicting with the syntactic classifier. function getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications { @@ -7353,12 +7499,12 @@ namespace ts { // token. So the classification will go back to being an identifier. The moment the user // types again, number will become a keyword, then an identifier, etc. etc. // - // To try to avoid this problem, we avoid classifying contextual keywords as keywords + // To try to avoid this problem, we avoid classifying contextual keywords as keywords // when the user is potentially typing something generic. We just can't do a good enough // job at the lexical level, and so well leave it up to the syntactic classifier to make // the determination. // - // In order to determine if the user is potentially typing something generic, we use a + // In order to determine if the user is potentially typing something generic, we use a // weak heuristic where we track < and > tokens. It's a weak heuristic, but should // work well enough in practice. let angleBracketStack = 0; @@ -7376,7 +7522,7 @@ namespace ts { 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 + // 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. @@ -7384,7 +7530,7 @@ namespace ts { } else if (lastNonTriviaToken === SyntaxKind.Identifier && token === SyntaxKind.LessThanToken) { - // Could be the start of something generic. Keep track of that by bumping + // 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++; } @@ -7399,7 +7545,7 @@ namespace ts { 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 + // 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; @@ -7507,8 +7653,8 @@ namespace ts { } if (start === 0 && offset > 0) { - // We're classifying the first token, and this was a case where we prepended - // text. We should consider the start of this token to be at the start of + // We're classifying the first token, and this was a case where we prepended + // text. We should consider the start of this token to be at the start of // the original text. start += offset; } @@ -7631,11 +7777,11 @@ namespace ts { /// getDefaultLibraryFilePath declare let __dirname: string; - + /** * Get the path of the default library files (lib.d.ts) as distributed with the typescript * node package. - * The functionality is not supported if the ts module is consumed outside of a node module. + * The functionality is not supported if the ts module is consumed outside of a node module. */ export function getDefaultLibFilePath(options: CompilerOptions): string { // Check __dirname is defined and that we are on a node.js system. diff --git a/src/services/shims.ts b/src/services/shims.ts index 6b679e70b4b50..307062cebd8cc 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -60,10 +60,12 @@ namespace ts { getNewLine?(): string; getProjectVersion?(): string; useCaseSensitiveFileNames?(): boolean; + + getModuleResolutionsForFile?(fileName: string): string; } /** Public interface of the the of a config service shim instance.*/ - export interface CoreServicesShimHost extends Logger { + export interface CoreServicesShimHost extends Logger, ModuleResolutionHost { /** * Returns a JSON-encoded value of the type: string[] * @@ -270,8 +272,18 @@ namespace ts { private files: string[]; private loggingEnabled = false; private tracingEnabled = false; - + + public resolveModuleNames: (moduleName: string[], containingFile: string) => string[]; + constructor(private shimHost: LanguageServiceShimHost) { + // if shimHost is a COM object then property check will become method call with no arguments. + // 'in' does not have this effect. + if ("getModuleResolutionsForFile" in this.shimHost) { + this.resolveModuleNames = (moduleNames: string[], containingFile: string) => { + let resolutionsInFile = >JSON.parse(this.shimHost.getModuleResolutionsForFile(containingFile)); + return map(moduleNames, name => lookUp(resolutionsInFile, name)); + }; + } } public log(s: string): void { @@ -410,6 +422,14 @@ namespace ts { } return JSON.parse(encoded); } + + public fileExists(fileName: string): boolean { + return this.shimHost.fileExists(fileName); + } + + public readFile(fileName: string): string { + return this.shimHost.readFile(fileName); + } } function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, logPerformance: boolean): any { @@ -752,7 +772,10 @@ namespace ts { return this.forwardJSONCall( "getDocumentHighlights('" + fileName + "', " + position + ")", () => { - return this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + var results = this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); + // workaround for VS document higlighting issue - keep only items from the initial file + let normalizedName = normalizeSlashes(fileName).toLowerCase(); + return filter(results, r => normalizeSlashes(r.fileName).toLowerCase() === normalizedName); }); } @@ -915,6 +938,13 @@ namespace ts { private forwardJSONCall(actionDescription: string, action: () => any): any { return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); } + + public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string { + return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => { + let compilerOptions = JSON.parse(compilerOptionsJson); + return resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host); + }); + } public getPreProcessedFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string { return this.forwardJSONCall( @@ -924,6 +954,7 @@ namespace ts { var convertResult = { referencedFiles: [], importedFiles: [], + ambientExternalModules: result.ambientExternalModules, isLibFile: result.isLibFile }; @@ -1066,4 +1097,4 @@ module TypeScript.Services { } /* @internal */ -let toolsVersion = "1.5"; +const toolsVersion = "1.6"; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 04bfd04057ce4..d5ad93260cde7 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -469,6 +469,39 @@ namespace ts { } } + /** + * Get the corresponding JSDocTag node if the position is in a jsDoc comment + */ + export function getJsDocTagAtPosition(sourceFile: SourceFile, position: number): JSDocTag { + let node = ts.getTokenAtPosition(sourceFile, position); + if (isToken(node)) { + switch (node.kind) { + case SyntaxKind.VarKeyword: + case SyntaxKind.LetKeyword: + case SyntaxKind.ConstKeyword: + // if the current token is var, let or const, skip the VariableDeclarationList + node = node.parent === undefined ? undefined : node.parent.parent; + break; + default: + node = node.parent; + break; + } + } + + if (node) { + let jsDocComment = node.jsDocComment; + if (jsDocComment) { + for (let tag of jsDocComment.tags) { + if (tag.pos <= position && position <= tag.end) { + return tag; + } + } + } + } + + return undefined; + } + function nodeHasTokens(n: Node): boolean { // If we have a token or node that has a non-zero width, it must have tokens. // Note, that getWidth() does not take trivia into account. @@ -640,7 +673,6 @@ namespace ts { else if (flags & SymbolFlags.TypeAlias) { return SymbolDisplayPartKind.aliasName; } else if (flags & SymbolFlags.Alias) { return SymbolDisplayPartKind.aliasName; } - return SymbolDisplayPartKind.text; } } diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 9d44dfdc03e98..4a467a60a8451 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -112,7 +112,7 @@ exports.delint = delint; var fileNames = process.argv.slice(2); fileNames.forEach(function (fileName) { // Parse a file - var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), 2 /* ES6 */, true); + var sourceFile = ts.createSourceFile(fileName, readFileSync(fileName).toString(), 2 /* ES6 */, /*setParentNodes */ true); // delint it delint(sourceFile); }); diff --git a/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols b/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols index 208646dc1013e..e054ff0bf9709 100644 --- a/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols +++ b/tests/baselines/reference/argumentsObjectIterator02_ES6.symbols @@ -9,9 +9,9 @@ function doubleAndReturnAsArray(x: number, y: number, z: number): [number, numbe let blah = arguments[Symbol.iterator]; >blah : Symbol(blah, Decl(argumentsObjectIterator02_ES6.ts, 2, 7)) >arguments : Symbol(arguments) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) let result = []; >result : Symbol(result, Decl(argumentsObjectIterator02_ES6.ts, 4, 7)) diff --git a/tests/baselines/reference/arrayLiterals2ES6.symbols b/tests/baselines/reference/arrayLiterals2ES6.symbols index faf0b13073815..d01fd9c39e9ca 100644 --- a/tests/baselines/reference/arrayLiterals2ES6.symbols +++ b/tests/baselines/reference/arrayLiterals2ES6.symbols @@ -72,14 +72,14 @@ var temp2: [number[], string[]] = [[1, 2, 3], ["hello", "string"]]; interface myArray extends Array { } >myArray : Symbol(myArray, Decl(arrayLiterals2ES6.ts, 40, 67)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) >Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11)) interface myArray2 extends Array { } >myArray2 : Symbol(myArray2, Decl(arrayLiterals2ES6.ts, 42, 43)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) >Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) var d0 = [1, true, ...temp, ]; // has type (string|number|boolean)[] >d0 : Symbol(d0, Decl(arrayLiterals2ES6.ts, 44, 3)) diff --git a/tests/baselines/reference/asyncArrowFunction1_es6.symbols b/tests/baselines/reference/asyncArrowFunction1_es6.symbols index cb2c5255486e5..7911ef4a246bf 100644 --- a/tests/baselines/reference/asyncArrowFunction1_es6.symbols +++ b/tests/baselines/reference/asyncArrowFunction1_es6.symbols @@ -2,6 +2,6 @@ var foo = async (): Promise => { >foo : Symbol(foo, Decl(asyncArrowFunction1_es6.ts, 1, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) }; diff --git a/tests/baselines/reference/asyncAwait_es6.symbols b/tests/baselines/reference/asyncAwait_es6.symbols index 8d4b98a20a15c..b69c9bce9d1da 100644 --- a/tests/baselines/reference/asyncAwait_es6.symbols +++ b/tests/baselines/reference/asyncAwait_es6.symbols @@ -2,16 +2,16 @@ type MyPromise = Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >T : Symbol(T, Decl(asyncAwait_es6.ts, 0, 15)) declare var MyPromise: typeof Promise; >MyPromise : Symbol(MyPromise, Decl(asyncAwait_es6.ts, 0, 0), Decl(asyncAwait_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare var p: Promise; >p : Symbol(p, Decl(asyncAwait_es6.ts, 2, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare var mp: MyPromise; >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) @@ -22,7 +22,7 @@ async function f0() { } async function f1(): Promise { } >f1 : Symbol(f1, Decl(asyncAwait_es6.ts, 5, 23)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) async function f3(): MyPromise { } >f3 : Symbol(f3, Decl(asyncAwait_es6.ts, 6, 38)) @@ -33,7 +33,7 @@ let f4 = async function() { } let f5 = async function(): Promise { } >f5 : Symbol(f5, Decl(asyncAwait_es6.ts, 10, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) let f6 = async function(): MyPromise { } >f6 : Symbol(f6, Decl(asyncAwait_es6.ts, 11, 3)) @@ -44,7 +44,7 @@ let f7 = async () => { }; let f8 = async (): Promise => { }; >f8 : Symbol(f8, Decl(asyncAwait_es6.ts, 14, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) let f9 = async (): MyPromise => { }; >f9 : Symbol(f9, Decl(asyncAwait_es6.ts, 15, 3)) @@ -60,7 +60,7 @@ let f11 = async () => mp; let f12 = async (): Promise => mp; >f12 : Symbol(f12, Decl(asyncAwait_es6.ts, 18, 3)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >mp : Symbol(mp, Decl(asyncAwait_es6.ts, 3, 11)) let f13 = async (): MyPromise => p; @@ -76,7 +76,7 @@ let o = { async m2(): Promise { }, >m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 22, 16)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) async m3(): MyPromise { } >m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 23, 31)) @@ -92,7 +92,7 @@ class C { async m2(): Promise { } >m2 : Symbol(m2, Decl(asyncAwait_es6.ts, 28, 15)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) async m3(): MyPromise { } >m3 : Symbol(m3, Decl(asyncAwait_es6.ts, 29, 30)) @@ -103,7 +103,7 @@ class C { static async m5(): Promise { } >m5 : Symbol(C.m5, Decl(asyncAwait_es6.ts, 31, 22)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) static async m6(): MyPromise { } >m6 : Symbol(C.m6, Decl(asyncAwait_es6.ts, 32, 37)) diff --git a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols index 889614387d7ff..33b11dfefe62b 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration11_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration11_es6.ts === async function await(): Promise { >await : Symbol(await, Decl(asyncFunctionDeclaration11_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) } diff --git a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols index 626b820e31290..b6eb9df0d94ff 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration14_es6.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration14_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration14_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) return; } diff --git a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols index c71592c0463b0..128caf9128f52 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols +++ b/tests/baselines/reference/asyncFunctionDeclaration1_es6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/async/es6/functionDeclarations/asyncFunctionDeclaration1_es6.ts === async function foo(): Promise { >foo : Symbol(foo, Decl(asyncFunctionDeclaration1_es6.ts, 0, 0)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) } diff --git a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols index 6a72f1b150666..b6419fa618ead 100644 --- a/tests/baselines/reference/awaitBinaryExpression1_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression1_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression1_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = await p || a; diff --git a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols index f81a146f9433b..c051aaa61a117 100644 --- a/tests/baselines/reference/awaitBinaryExpression2_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression2_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression2_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = await p && a; diff --git a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols index 479b3b306504d..b131780976f73 100644 --- a/tests/baselines/reference/awaitBinaryExpression3_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression3_es6.symbols @@ -4,11 +4,11 @@ declare var a: number; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression3_es6.ts, 1, 31)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = await p + a; diff --git a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols index 5d15c754793a0..525b97730edbd 100644 --- a/tests/baselines/reference/awaitBinaryExpression4_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression4_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression4_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = await p, a; diff --git a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols index bc1e2f1931020..65907b380be80 100644 --- a/tests/baselines/reference/awaitBinaryExpression5_es6.symbols +++ b/tests/baselines/reference/awaitBinaryExpression5_es6.symbols @@ -4,11 +4,11 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitBinaryExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) async function func(): Promise { >func : Symbol(func, Decl(awaitBinaryExpression5_es6.ts, 1, 32)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var o: { a: boolean; }; diff --git a/tests/baselines/reference/awaitCallExpression1_es6.symbols b/tests/baselines/reference/awaitCallExpression1_es6.symbols index 7e28d92cd9c17..6b8d344b0e784 100644 --- a/tests/baselines/reference/awaitCallExpression1_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression1_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression1_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression1_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression1_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression1_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >fn : Symbol(fn, Decl(awaitCallExpression1_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression1_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression1_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression1_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression2_es6.symbols b/tests/baselines/reference/awaitCallExpression2_es6.symbols index 305a4c77aa375..e08ce8bf2752c 100644 --- a/tests/baselines/reference/awaitCallExpression2_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression2_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression2_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression2_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression2_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression2_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >fn : Symbol(fn, Decl(awaitCallExpression2_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression2_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression2_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression2_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = fn(await p, a, a); diff --git a/tests/baselines/reference/awaitCallExpression3_es6.symbols b/tests/baselines/reference/awaitCallExpression3_es6.symbols index 715c125bcf077..552ce3bc36fd7 100644 --- a/tests/baselines/reference/awaitCallExpression3_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression3_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression3_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression3_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression3_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression3_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >fn : Symbol(fn, Decl(awaitCallExpression3_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression3_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression3_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression3_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = fn(a, await p, a); diff --git a/tests/baselines/reference/awaitCallExpression4_es6.symbols b/tests/baselines/reference/awaitCallExpression4_es6.symbols index 98a995d811709..1bd97c760680d 100644 --- a/tests/baselines/reference/awaitCallExpression4_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression4_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression4_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression4_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression4_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression4_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >fn : Symbol(fn, Decl(awaitCallExpression4_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression4_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression4_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression4_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = (await pfn)(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression5_es6.symbols b/tests/baselines/reference/awaitCallExpression5_es6.symbols index 30df9c8d022c2..c5260f4573cce 100644 --- a/tests/baselines/reference/awaitCallExpression5_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression5_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression5_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression5_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression5_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression5_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >fn : Symbol(fn, Decl(awaitCallExpression5_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression5_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression5_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression5_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = o.fn(a, a, a); diff --git a/tests/baselines/reference/awaitCallExpression6_es6.symbols b/tests/baselines/reference/awaitCallExpression6_es6.symbols index ac1cca1c16ff4..607a96931d32a 100644 --- a/tests/baselines/reference/awaitCallExpression6_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression6_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression6_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression6_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression6_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression6_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >fn : Symbol(fn, Decl(awaitCallExpression6_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression6_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression6_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression6_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = o.fn(await p, a, a); diff --git a/tests/baselines/reference/awaitCallExpression7_es6.symbols b/tests/baselines/reference/awaitCallExpression7_es6.symbols index b48e99ddec13b..85a75e0b71aaf 100644 --- a/tests/baselines/reference/awaitCallExpression7_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression7_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression7_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression7_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression7_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression7_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >fn : Symbol(fn, Decl(awaitCallExpression7_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression7_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression7_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression7_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = o.fn(a, await p, a); diff --git a/tests/baselines/reference/awaitCallExpression8_es6.symbols b/tests/baselines/reference/awaitCallExpression8_es6.symbols index 4dd9d500347c8..66f9a73783a76 100644 --- a/tests/baselines/reference/awaitCallExpression8_es6.symbols +++ b/tests/baselines/reference/awaitCallExpression8_es6.symbols @@ -4,7 +4,7 @@ declare var a: boolean; declare var p: Promise; >p : Symbol(p, Decl(awaitCallExpression8_es6.ts, 1, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) declare function fn(arg0: boolean, arg1: boolean, arg2: boolean): void; >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 1, 32)) @@ -21,14 +21,14 @@ declare var o: { fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }; declare var pfn: Promise<{ (arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >pfn : Symbol(pfn, Decl(awaitCallExpression8_es6.ts, 4, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 4, 28)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 4, 42)) >arg2 : Symbol(arg2, Decl(awaitCallExpression8_es6.ts, 4, 57)) declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; }>; >po : Symbol(po, Decl(awaitCallExpression8_es6.ts, 5, 11)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >fn : Symbol(fn, Decl(awaitCallExpression8_es6.ts, 5, 25)) >arg0 : Symbol(arg0, Decl(awaitCallExpression8_es6.ts, 5, 29)) >arg1 : Symbol(arg1, Decl(awaitCallExpression8_es6.ts, 5, 43)) @@ -36,7 +36,7 @@ declare var po: Promise<{ fn(arg0: boolean, arg1: boolean, arg2: boolean): void; async function func(): Promise { >func : Symbol(func, Decl(awaitCallExpression8_es6.ts, 5, 84)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) "before"; var b = (await po).fn(a, a, a); diff --git a/tests/baselines/reference/callWithSpreadES6.symbols b/tests/baselines/reference/callWithSpreadES6.symbols index 0e2368210200e..c87f9d586f306 100644 --- a/tests/baselines/reference/callWithSpreadES6.symbols +++ b/tests/baselines/reference/callWithSpreadES6.symbols @@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc"); >a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3)) (xa[1].foo)(...[1, 2, "abc"]); ->Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 1368, 1)) +>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 4042, 1)) >xa[1].foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) >xa : Symbol(xa, Decl(callWithSpreadES6.ts, 11, 3)) >foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) diff --git a/tests/baselines/reference/commentInMethodCall.js b/tests/baselines/reference/commentInMethodCall.js index 4ad2fc552d706..4cbd4824a821c 100644 --- a/tests/baselines/reference/commentInMethodCall.js +++ b/tests/baselines/reference/commentInMethodCall.js @@ -8,4 +8,5 @@ s.map(// do something //// [commentInMethodCall.js] //commment here var s; -s.map(function () { }); +s.map(// do something +function () { }); diff --git a/tests/baselines/reference/commentsArgumentsOfCallExpression1.js b/tests/baselines/reference/commentsArgumentsOfCallExpression1.js new file mode 100644 index 0000000000000..4e6d693c5c27d --- /dev/null +++ b/tests/baselines/reference/commentsArgumentsOfCallExpression1.js @@ -0,0 +1,32 @@ +//// [commentsArgumentsOfCallExpression1.ts] +function foo(/*c1*/ x: any) { } +foo(/*c2*/ 1); +foo(/*c3*/ function () { }); +foo( + /*c4*/ + () => { }); +foo( + /*c5*/ + /*c6*/ + () => { }); +foo(/*c7*/ + () => { }); +foo( + /*c7*/ + /*c8*/() => { }); + +//// [commentsArgumentsOfCallExpression1.js] +function foo(/*c1*/ x) { } +foo(/*c2*/ 1); +foo(/*c3*/ function () { }); +foo( +/*c4*/ +function () { }); +foo( +/*c5*/ +/*c6*/ +function () { }); +foo(/*c7*/ function () { }); +foo( +/*c7*/ +/*c8*/ function () { }); diff --git a/tests/baselines/reference/commentsArgumentsOfCallExpression1.symbols b/tests/baselines/reference/commentsArgumentsOfCallExpression1.symbols new file mode 100644 index 0000000000000..9d8495f948c6c --- /dev/null +++ b/tests/baselines/reference/commentsArgumentsOfCallExpression1.symbols @@ -0,0 +1,31 @@ +=== tests/cases/compiler/commentsArgumentsOfCallExpression1.ts === +function foo(/*c1*/ x: any) { } +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0)) +>x : Symbol(x, Decl(commentsArgumentsOfCallExpression1.ts, 0, 13)) + +foo(/*c2*/ 1); +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0)) + +foo(/*c3*/ function () { }); +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0)) + +foo( +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0)) + + /*c4*/ + () => { }); +foo( +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0)) + + /*c5*/ + /*c6*/ + () => { }); +foo(/*c7*/ +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0)) + + () => { }); +foo( +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression1.ts, 0, 0)) + + /*c7*/ + /*c8*/() => { }); diff --git a/tests/baselines/reference/commentsArgumentsOfCallExpression1.types b/tests/baselines/reference/commentsArgumentsOfCallExpression1.types new file mode 100644 index 0000000000000..bcab3e3de3666 --- /dev/null +++ b/tests/baselines/reference/commentsArgumentsOfCallExpression1.types @@ -0,0 +1,47 @@ +=== tests/cases/compiler/commentsArgumentsOfCallExpression1.ts === +function foo(/*c1*/ x: any) { } +>foo : (x: any) => void +>x : any + +foo(/*c2*/ 1); +>foo(/*c2*/ 1) : void +>foo : (x: any) => void +>1 : number + +foo(/*c3*/ function () { }); +>foo(/*c3*/ function () { }) : void +>foo : (x: any) => void +>function () { } : () => void + +foo( +>foo( /*c4*/ () => { }) : void +>foo : (x: any) => void + + /*c4*/ + () => { }); +>() => { } : () => void + +foo( +>foo( /*c5*/ /*c6*/ () => { }) : void +>foo : (x: any) => void + + /*c5*/ + /*c6*/ + () => { }); +>() => { } : () => void + +foo(/*c7*/ +>foo(/*c7*/ () => { }) : void +>foo : (x: any) => void + + () => { }); +>() => { } : () => void + +foo( +>foo( /*c7*/ /*c8*/() => { }) : void +>foo : (x: any) => void + + /*c7*/ + /*c8*/() => { }); +>() => { } : () => void + diff --git a/tests/baselines/reference/commentsArgumentsOfCallExpression2.js b/tests/baselines/reference/commentsArgumentsOfCallExpression2.js new file mode 100644 index 0000000000000..a7065410ff4fe --- /dev/null +++ b/tests/baselines/reference/commentsArgumentsOfCallExpression2.js @@ -0,0 +1,23 @@ +//// [commentsArgumentsOfCallExpression2.ts] +function foo(/*c1*/ x: any, /*d1*/ y: any,/*e1*/w?: any) { } +var a, b: any; +foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b); +foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b); +foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b)); +foo( + /*c4*/ function () { }, + /*d4*/() => { }, + /*e4*/ + /*e5*/ "hello"); + +//// [commentsArgumentsOfCallExpression2.js] +function foo(/*c1*/ x, /*d1*/ y, /*e1*/ w) { } +var a, b; +foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b); +foo(/*c3*/ function () { }, /*d2*/ function () { }, /*e2*/ a + b); +foo(/*c3*/ function () { }, /*d3*/ function () { }, /*e3*/ (a + b)); +foo( +/*c4*/ function () { }, +/*d4*/ function () { }, +/*e4*/ +/*e5*/ "hello"); diff --git a/tests/baselines/reference/commentsArgumentsOfCallExpression2.symbols b/tests/baselines/reference/commentsArgumentsOfCallExpression2.symbols new file mode 100644 index 0000000000000..59047dd46c3ed --- /dev/null +++ b/tests/baselines/reference/commentsArgumentsOfCallExpression2.symbols @@ -0,0 +1,33 @@ +=== tests/cases/compiler/commentsArgumentsOfCallExpression2.ts === +function foo(/*c1*/ x: any, /*d1*/ y: any,/*e1*/w?: any) { } +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0)) +>x : Symbol(x, Decl(commentsArgumentsOfCallExpression2.ts, 0, 13)) +>y : Symbol(y, Decl(commentsArgumentsOfCallExpression2.ts, 0, 27)) +>w : Symbol(w, Decl(commentsArgumentsOfCallExpression2.ts, 0, 42)) + +var a, b: any; +>a : Symbol(a, Decl(commentsArgumentsOfCallExpression2.ts, 1, 3)) +>b : Symbol(b, Decl(commentsArgumentsOfCallExpression2.ts, 1, 6)) + +foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b); +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0)) +>a : Symbol(a, Decl(commentsArgumentsOfCallExpression2.ts, 1, 3)) +>b : Symbol(b, Decl(commentsArgumentsOfCallExpression2.ts, 1, 6)) + +foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b); +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0)) +>a : Symbol(a, Decl(commentsArgumentsOfCallExpression2.ts, 1, 3)) +>b : Symbol(b, Decl(commentsArgumentsOfCallExpression2.ts, 1, 6)) + +foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b)); +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0)) +>a : Symbol(a, Decl(commentsArgumentsOfCallExpression2.ts, 1, 3)) +>b : Symbol(b, Decl(commentsArgumentsOfCallExpression2.ts, 1, 6)) + +foo( +>foo : Symbol(foo, Decl(commentsArgumentsOfCallExpression2.ts, 0, 0)) + + /*c4*/ function () { }, + /*d4*/() => { }, + /*e4*/ + /*e5*/ "hello"); diff --git a/tests/baselines/reference/commentsArgumentsOfCallExpression2.types b/tests/baselines/reference/commentsArgumentsOfCallExpression2.types new file mode 100644 index 0000000000000..f0a10077e669a --- /dev/null +++ b/tests/baselines/reference/commentsArgumentsOfCallExpression2.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/commentsArgumentsOfCallExpression2.ts === +function foo(/*c1*/ x: any, /*d1*/ y: any,/*e1*/w?: any) { } +>foo : (x: any, y: any, w?: any) => void +>x : any +>y : any +>w : any + +var a, b: any; +>a : any +>b : any + +foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b); +>foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b) : void +>foo : (x: any, y: any, w?: any) => void +>1 : number +>1 + 2 : number +>1 : number +>2 : number +>a + b : any +>a : any +>b : any + +foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b); +>foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b) : void +>foo : (x: any, y: any, w?: any) => void +>function () { } : () => void +>() => { } : () => void +>a + /*e3*/ b : any +>a : any +>b : any + +foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b)); +>foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b)) : void +>foo : (x: any, y: any, w?: any) => void +>function () { } : () => void +>() => { } : () => void +>(a + b) : any +>a + b : any +>a : any +>b : any + +foo( +>foo( /*c4*/ function () { }, /*d4*/() => { }, /*e4*/ /*e5*/ "hello") : void +>foo : (x: any, y: any, w?: any) => void + + /*c4*/ function () { }, +>function () { } : () => void + + /*d4*/() => { }, +>() => { } : () => void + + /*e4*/ + /*e5*/ "hello"); +>"hello" : string + diff --git a/tests/baselines/reference/commentsBeforeFunctionExpression1.js b/tests/baselines/reference/commentsBeforeFunctionExpression1.js index 0e23722faf393..5b250b9c06476 100644 --- a/tests/baselines/reference/commentsBeforeFunctionExpression1.js +++ b/tests/baselines/reference/commentsBeforeFunctionExpression1.js @@ -6,5 +6,5 @@ var v = { //// [commentsBeforeFunctionExpression1.js] var v = { - f: function (a) { return 0; } + f: /**own f*/ function (a) { return 0; } }; diff --git a/tests/baselines/reference/commentsInterface.js b/tests/baselines/reference/commentsInterface.js index bff79a02aa5db..3deac9871f183 100644 --- a/tests/baselines/reference/commentsInterface.js +++ b/tests/baselines/reference/commentsInterface.js @@ -89,7 +89,7 @@ var i2_i_nc_fnfoo = i2_i.nc_fnfoo; var i2_i_nc_fnfoo_r = i2_i.nc_fnfoo(10); var i3_i; i3_i = { - f: function (/**i3_i a*/ a) { return "Hello" + a; }, + f: /**own f*/ function (/**i3_i a*/ a) { return "Hello" + a; }, l: this.f, /** own x*/ x: this.f(10), diff --git a/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.js b/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.js new file mode 100644 index 0000000000000..fa7790443aca4 --- /dev/null +++ b/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.js @@ -0,0 +1,29 @@ +//// [commentsOnPropertyOfObjectLiteral1.ts] +var resolve = { + id: /*! @ngInject */ (details: any) => details.id, + id1: /* c1 */ "hello", + id2: + /*! @ngInject */ (details: any) => details.id, + id3: + /*! @ngInject */ + (details: any) => details.id, + id4: + /*! @ngInject */ + /* C2 */ + (details: any) => details.id, +}; + +//// [commentsOnPropertyOfObjectLiteral1.js] +var resolve = { + id: /*! @ngInject */ function (details) { return details.id; }, + id1: /* c1 */ "hello", + id2: + /*! @ngInject */ function (details) { return details.id; }, + id3: + /*! @ngInject */ + function (details) { return details.id; }, + id4: + /*! @ngInject */ + /* C2 */ + function (details) { return details.id; } +}; diff --git a/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.symbols b/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.symbols new file mode 100644 index 0000000000000..b48c1fb982c8c --- /dev/null +++ b/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.symbols @@ -0,0 +1,37 @@ +=== tests/cases/compiler/commentsOnPropertyOfObjectLiteral1.ts === +var resolve = { +>resolve : Symbol(resolve, Decl(commentsOnPropertyOfObjectLiteral1.ts, 0, 3)) + + id: /*! @ngInject */ (details: any) => details.id, +>id : Symbol(id, Decl(commentsOnPropertyOfObjectLiteral1.ts, 0, 15)) +>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 1, 26)) +>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 1, 26)) + + id1: /* c1 */ "hello", +>id1 : Symbol(id1, Decl(commentsOnPropertyOfObjectLiteral1.ts, 1, 54)) + + id2: +>id2 : Symbol(id2, Decl(commentsOnPropertyOfObjectLiteral1.ts, 2, 26)) + + /*! @ngInject */ (details: any) => details.id, +>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 4, 26)) +>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 4, 26)) + + id3: +>id3 : Symbol(id3, Decl(commentsOnPropertyOfObjectLiteral1.ts, 4, 54)) + + /*! @ngInject */ + (details: any) => details.id, +>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 7, 5)) +>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 7, 5)) + + id4: +>id4 : Symbol(id4, Decl(commentsOnPropertyOfObjectLiteral1.ts, 7, 33)) + + /*! @ngInject */ + /* C2 */ + (details: any) => details.id, +>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 11, 5)) +>details : Symbol(details, Decl(commentsOnPropertyOfObjectLiteral1.ts, 11, 5)) + +}; diff --git a/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.types b/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.types new file mode 100644 index 0000000000000..93ce87558d8b7 --- /dev/null +++ b/tests/baselines/reference/commentsOnPropertyOfObjectLiteral1.types @@ -0,0 +1,51 @@ +=== tests/cases/compiler/commentsOnPropertyOfObjectLiteral1.ts === +var resolve = { +>resolve : { id: (details: any) => any; id1: string; id2: (details: any) => any; id3: (details: any) => any; id4: (details: any) => any; } +>{ id: /*! @ngInject */ (details: any) => details.id, id1: /* c1 */ "hello", id2: /*! @ngInject */ (details: any) => details.id, id3: /*! @ngInject */ (details: any) => details.id, id4: /*! @ngInject */ /* C2 */ (details: any) => details.id,} : { id: (details: any) => any; id1: string; id2: (details: any) => any; id3: (details: any) => any; id4: (details: any) => any; } + + id: /*! @ngInject */ (details: any) => details.id, +>id : (details: any) => any +>(details: any) => details.id : (details: any) => any +>details : any +>details.id : any +>details : any +>id : any + + id1: /* c1 */ "hello", +>id1 : string +>"hello" : string + + id2: +>id2 : (details: any) => any + + /*! @ngInject */ (details: any) => details.id, +>(details: any) => details.id : (details: any) => any +>details : any +>details.id : any +>details : any +>id : any + + id3: +>id3 : (details: any) => any + + /*! @ngInject */ + (details: any) => details.id, +>(details: any) => details.id : (details: any) => any +>details : any +>details.id : any +>details : any +>id : any + + id4: +>id4 : (details: any) => any + + /*! @ngInject */ + /* C2 */ + (details: any) => details.id, +>(details: any) => details.id : (details: any) => any +>details : any +>details.id : any +>details : any +>id : any + +}; diff --git a/tests/baselines/reference/commonjsSafeImport.js b/tests/baselines/reference/commonjsSafeImport.js new file mode 100644 index 0000000000000..a0ef81cc27782 --- /dev/null +++ b/tests/baselines/reference/commonjsSafeImport.js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/commonjsSafeImport.ts] //// + +//// [10_lib.ts] + +export function Foo() {} + +//// [main.ts] +import { Foo } from './10_lib'; + +Foo(); + + +//// [10_lib.js] +function Foo() { } +exports.Foo = Foo; +//// [main.js] +var _10_lib_1 = require('./10_lib'); +_10_lib_1.Foo(); + + +//// [10_lib.d.ts] +export declare function Foo(): void; +//// [main.d.ts] diff --git a/tests/baselines/reference/commonjsSafeImport.symbols b/tests/baselines/reference/commonjsSafeImport.symbols new file mode 100644 index 0000000000000..45e247b46a05a --- /dev/null +++ b/tests/baselines/reference/commonjsSafeImport.symbols @@ -0,0 +1,12 @@ +=== tests/cases/compiler/10_lib.ts === + +export function Foo() {} +>Foo : Symbol(Foo, Decl(10_lib.ts, 0, 0)) + +=== tests/cases/compiler/main.ts === +import { Foo } from './10_lib'; +>Foo : Symbol(Foo, Decl(main.ts, 0, 8)) + +Foo(); +>Foo : Symbol(Foo, Decl(main.ts, 0, 8)) + diff --git a/tests/baselines/reference/commonjsSafeImport.types b/tests/baselines/reference/commonjsSafeImport.types new file mode 100644 index 0000000000000..5a4dded5b1f4b --- /dev/null +++ b/tests/baselines/reference/commonjsSafeImport.types @@ -0,0 +1,13 @@ +=== tests/cases/compiler/10_lib.ts === + +export function Foo() {} +>Foo : () => void + +=== tests/cases/compiler/main.ts === +import { Foo } from './10_lib'; +>Foo : () => void + +Foo(); +>Foo() : void +>Foo : () => void + diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index d36428a03797b..696204ae8da52 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;;CACJ,CAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACIA,QAAQA,CAACA;IACbA,CAACA;;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index 74d69f566a031..c922e4f706db5 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -28,26 +28,28 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 2 > ^^^ 3 > ^^^^^^^ 4 > ^ -5 > ^^^-> +5 > ^^^ 1->{ > 2 > [ 3 > "hello" 4 > ] +5 > 1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) 2 >Emitted(2, 8) Source(2, 6) + SourceIndex(0) 3 >Emitted(2, 15) Source(2, 13) + SourceIndex(0) 4 >Emitted(2, 16) Source(2, 14) + SourceIndex(0) +5 >Emitted(2, 19) Source(2, 5) + SourceIndex(0) --- >>> debugger; -1->^^^^^^^^ +1 >^^^^^^^^ 2 > ^^^^^^^^ 3 > ^ -1->() { +1 >["hello"]() { > 2 > debugger 3 > ; -1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"]) +1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"]) 2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"]) 3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"]) --- diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols index 172336603ab2e..3e23a7812f5b3 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.symbols @@ -82,5 +82,7 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any >IWithCallSignatures : Symbol(IWithCallSignatures, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 9, 1)) >IWithCallSignatures4 : Symbol(IWithCallSignatures4, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 18, 1)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52)) +>a.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) >a : Symbol(a, Decl(contextualTypeWithUnionTypeCallSignatures.ts, 35, 52)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types index 02dfecf5c0845..8e1915d47549d 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types +++ b/tests/baselines/reference/contextualTypeWithUnionTypeCallSignatures.types @@ -90,10 +90,10 @@ var x4: IWithCallSignatures | IWithCallSignatures4 = a => /*here a should be any >x4 : IWithCallSignatures | IWithCallSignatures4 >IWithCallSignatures : IWithCallSignatures >IWithCallSignatures4 : IWithCallSignatures4 ->a => /*here a should be any*/ a.toString() : (a: any) => any ->a : any ->a.toString() : any ->a.toString : any ->a : any ->toString : any +>a => /*here a should be any*/ a.toString() : (a: number) => string +>a : number +>a.toString() : string +>a.toString : (radix?: number) => string +>a : number +>toString : (radix?: number) => string diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index fc84d1dc31851..7c814c231e00d 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","c9t5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;;IACtCA;QACIC,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;;IAGjCC;QACIC,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;IAETE,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;cACX,CAAsB,IAAGC,CAACA;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;;IACZC,eAAYA,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,aAAa,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,eAAe,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","c9t5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAYA,sCAAsC;AACtC;IAAAA;QACIC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAED,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;AAED,gCAAgC;AAChC,IAAI,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;AAEF,qCAAqC;AACrC;IAEIC;QACIC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAED,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IAETE,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAED,+BAA+B;AAC/B,IAAI,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAE9D,kCAAkC;AAClC,IAAI,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;AACF,yBAAyB;AACzB,cAAc,CAAsB,IAAGC,CAACA;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAEH,4BAA4B;AAC5B,IAAI,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE/F,0BAA0B;AAC1B;IAAcC,eAAYA,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;AAErD,qCAAqC;AACrC,IAAI,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,aAAa,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,eAAe,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 b6b4c18b2894c..72419ef846a2e 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -10,8 +10,7 @@ sourceFile:contextualTyping.ts ------------------------------------------------------------------- >>>// CONTEXT: Class property declaration 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 >// DEFAULT INTERFACES >interface IFoo { > n: number; @@ -24,21 +23,23 @@ sourceFile:contextualTyping.ts > foo: IFoo; >} > - >// CONTEXT: Class property declaration > -2 > -3 >// CONTEXT: Class property declaration -1 >Emitted(1, 1) Source(14, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(13, 1) + SourceIndex(0) -3 >Emitted(1, 39) Source(13, 39) + SourceIndex(0) +2 >// CONTEXT: Class property declaration +1 >Emitted(1, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(1, 39) Source(13, 39) + SourceIndex(0) --- >>>var C1T5 = (function () { ->>> function C1T5() { -1 >^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(3, 5) Source(14, 1) + SourceIndex(0) name (C1T5) +1 >Emitted(2, 1) Source(14, 1) + SourceIndex(0) +--- +>>> function C1T5() { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(3, 5) Source(14, 1) + SourceIndex(0) name (C1T5) --- >>> this.foo = function (i) { 1->^^^^^^^^ @@ -127,17 +128,13 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Module property declaration 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - >// CONTEXT: Module property declaration > -2 > -3 >// CONTEXT: Module property declaration -1->Emitted(10, 1) Source(21, 1) + SourceIndex(0) -2 >Emitted(10, 1) Source(20, 1) + SourceIndex(0) -3 >Emitted(10, 40) Source(20, 40) + SourceIndex(0) +2 >// CONTEXT: Module property declaration +1->Emitted(10, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(10, 40) Source(20, 40) + SourceIndex(0) --- >>>var C2T5; 1 > @@ -257,66 +254,65 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Variable declaration 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^-> 1-> > - >// CONTEXT: Variable declaration > -2 > -3 >// CONTEXT: Variable declaration -1->Emitted(17, 1) Source(28, 1) + SourceIndex(0) -2 >Emitted(17, 1) Source(27, 1) + SourceIndex(0) -3 >Emitted(17, 33) Source(27, 33) + SourceIndex(0) +2 >// CONTEXT: Variable declaration +1->Emitted(17, 1) Source(27, 1) + SourceIndex(0) +2 >Emitted(17, 33) Source(27, 33) + SourceIndex(0) --- >>>var c3t1 = (function (s) { return s; }); -1->^^^^ -2 > ^^^^ -3 > ^^^ -4 > ^ -5 > ^^^^^^^^^^ -6 > ^ -7 > ^^^^ -8 > ^^^^^^ -9 > ^ -10> ^ -11> ^ -12> ^ -13> ^ -14> ^ -15> ^ +1-> +2 >^^^^ +3 > ^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^ +7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ 1-> - >var -2 > c3t1 -3 > : (s: string) => string = -4 > ( -5 > function( -6 > s -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) -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) + > +2 >var +3 > c3t1 +4 > : (s: string) => string = +5 > ( +6 > function( +7 > s +8 > ) { +9 > return +10> +11> s +12> +13> +14> } +15> ) +16> ; +1->Emitted(18, 1) Source(28, 1) + SourceIndex(0) +2 >Emitted(18, 5) Source(28, 5) + SourceIndex(0) +3 >Emitted(18, 9) Source(28, 9) + SourceIndex(0) +4 >Emitted(18, 12) Source(28, 35) + SourceIndex(0) +5 >Emitted(18, 13) Source(28, 36) + SourceIndex(0) +6 >Emitted(18, 23) Source(28, 45) + SourceIndex(0) +7 >Emitted(18, 24) Source(28, 46) + SourceIndex(0) +8 >Emitted(18, 28) Source(28, 50) + SourceIndex(0) +9 >Emitted(18, 34) Source(28, 56) + SourceIndex(0) +10>Emitted(18, 35) Source(28, 57) + SourceIndex(0) +11>Emitted(18, 36) Source(28, 58) + SourceIndex(0) +12>Emitted(18, 37) Source(28, 58) + SourceIndex(0) +13>Emitted(18, 38) Source(28, 59) + SourceIndex(0) +14>Emitted(18, 39) Source(28, 60) + SourceIndex(0) +15>Emitted(18, 40) Source(28, 61) + SourceIndex(0) +16>Emitted(18, 41) Source(28, 62) + SourceIndex(0) --- >>>var c3t2 = ({ 1 > @@ -945,27 +941,28 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Class property assignment 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - >// CONTEXT: Class property assignment > -2 > -3 >// CONTEXT: Class property assignment -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) +2 >// CONTEXT: Class property assignment +1->Emitted(40, 1) Source(55, 1) + SourceIndex(0) +2 >Emitted(40, 38) Source(55, 38) + SourceIndex(0) --- >>>var C4T5 = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(41, 1) Source(56, 1) + SourceIndex(0) +--- >>> function C4T5() { -1 >^^^^ +1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >class C4T5 { +1->class C4T5 { > foo: (i: number, s: string) => string; > -1 >Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5) +1->Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5) --- >>> this.foo = function (i, s) { 1->^^^^^^^^ @@ -1070,17 +1067,13 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Module property assignment 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - >// CONTEXT: Module property assignment > -2 > -3 >// CONTEXT: Module property assignment -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) +2 >// CONTEXT: Module property assignment +1->Emitted(49, 1) Source(65, 1) + SourceIndex(0) +2 >Emitted(49, 39) Source(65, 39) + SourceIndex(0) --- >>>var C5T5; 1 > @@ -1209,30 +1202,29 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Variable assignment 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - >// CONTEXT: Variable assignment > -2 > -3 >// CONTEXT: Variable assignment -1->Emitted(56, 1) Source(74, 1) + SourceIndex(0) -2 >Emitted(56, 1) Source(73, 1) + SourceIndex(0) -3 >Emitted(56, 32) Source(73, 32) + SourceIndex(0) +2 >// CONTEXT: Variable assignment +1->Emitted(56, 1) Source(73, 1) + SourceIndex(0) +2 >Emitted(56, 32) Source(73, 32) + SourceIndex(0) --- >>>var c6t5; -1 >^^^^ -2 > ^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > - >var -2 > c6t5: (n: number) => IFoo -3 > ; -1 >Emitted(57, 5) Source(74, 5) + SourceIndex(0) -2 >Emitted(57, 9) Source(74, 30) + SourceIndex(0) -3 >Emitted(57, 10) Source(74, 31) + SourceIndex(0) + > +2 >var +3 > c6t5: (n: number) => IFoo +4 > ; +1 >Emitted(57, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(57, 5) Source(74, 5) + SourceIndex(0) +3 >Emitted(57, 9) Source(74, 30) + SourceIndex(0) +4 >Emitted(57, 10) Source(74, 31) + SourceIndex(0) --- >>>c6t5 = function (n) { return ({}); }; 1-> @@ -1284,30 +1276,29 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Array index assignment 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > > - >// CONTEXT: Array index assignment > -2 > -3 >// CONTEXT: Array index assignment -1 >Emitted(59, 1) Source(78, 1) + SourceIndex(0) -2 >Emitted(59, 1) Source(77, 1) + SourceIndex(0) -3 >Emitted(59, 35) Source(77, 35) + SourceIndex(0) +2 >// CONTEXT: Array index assignment +1 >Emitted(59, 1) Source(77, 1) + SourceIndex(0) +2 >Emitted(59, 35) Source(77, 35) + SourceIndex(0) --- >>>var c7t2; -1 >^^^^ -2 > ^^^^ -3 > ^ -4 > ^^^^^^^^^^^^^-> +1 > +2 >^^^^ +3 > ^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^-> 1 > - >var -2 > c7t2: IFoo[] -3 > ; -1 >Emitted(60, 5) Source(78, 5) + SourceIndex(0) -2 >Emitted(60, 9) Source(78, 17) + SourceIndex(0) -3 >Emitted(60, 10) Source(78, 18) + SourceIndex(0) + > +2 >var +3 > c7t2: IFoo[] +4 > ; +1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(60, 5) Source(78, 5) + SourceIndex(0) +3 >Emitted(60, 9) Source(78, 17) + SourceIndex(0) +4 >Emitted(60, 10) Source(78, 18) + SourceIndex(0) --- >>>c7t2[0] = ({ n: 1 }); 1-> @@ -2140,31 +2131,30 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Function call 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> - >// CONTEXT: Function call > -2 > -3 >// CONTEXT: Function call -1->Emitted(85, 1) Source(146, 1) + SourceIndex(0) -2 >Emitted(85, 1) Source(145, 1) + SourceIndex(0) -3 >Emitted(85, 26) Source(145, 26) + SourceIndex(0) +2 >// CONTEXT: Function call +1->Emitted(85, 1) Source(145, 1) + SourceIndex(0) +2 >Emitted(85, 26) Source(145, 26) + SourceIndex(0) --- >>>function c9t5(f) { } -1 >^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^ -4 > ^ +1 > +2 >^^^^^^^^^^^^^^ +3 > ^ +4 > ^^^^ +5 > ^ 1 > - >function c9t5( -2 > f: (n: number) => IFoo -3 > ) { -4 > } -1 >Emitted(86, 15) Source(146, 15) + SourceIndex(0) -2 >Emitted(86, 16) Source(146, 37) + SourceIndex(0) -3 >Emitted(86, 20) Source(146, 40) + SourceIndex(0) name (c9t5) -4 >Emitted(86, 21) Source(146, 41) + SourceIndex(0) name (c9t5) + > +2 >function c9t5( +3 > f: (n: number) => IFoo +4 > ) { +5 > } +1 >Emitted(86, 1) Source(146, 1) + SourceIndex(0) +2 >Emitted(86, 15) Source(146, 15) + SourceIndex(0) +3 >Emitted(86, 16) Source(146, 37) + SourceIndex(0) +4 >Emitted(86, 20) Source(146, 40) + SourceIndex(0) name (c9t5) +5 >Emitted(86, 21) Source(146, 41) + SourceIndex(0) name (c9t5) --- >>>; 1 > @@ -2236,107 +2226,107 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Return statement 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > - >// CONTEXT: Return statement > -2 > -3 >// CONTEXT: Return statement -1->Emitted(91, 1) Source(152, 1) + SourceIndex(0) -2 >Emitted(91, 1) Source(151, 1) + SourceIndex(0) -3 >Emitted(91, 29) Source(151, 29) + SourceIndex(0) +2 >// CONTEXT: Return statement +1->Emitted(91, 1) Source(151, 1) + SourceIndex(0) +2 >Emitted(91, 29) Source(151, 29) + SourceIndex(0) --- >>>var c10t5 = function () { return function (n) { return ({}); }; }; -1->^^^^ -2 > ^^^^^ -3 > ^^^ -4 > ^^^^^^^^^^^^^^ -5 > ^^^^^^ -6 > ^ -7 > ^^^^^^^^^^ -8 > ^ -9 > ^^^^ -10> ^^^^^^ -11> ^ -12> ^ -13> ^^ -14> ^ -15> ^ -16> ^ -17> ^ -18> ^ -19> ^ -20> ^ -21> ^ +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^^^^^^^^^^ +9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ +21> ^ +22> ^ 1-> - >var -2 > c10t5 -3 > : () => (n: number) => IFoo = -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(92, 5) Source(152, 5) + SourceIndex(0) -2 >Emitted(92, 10) Source(152, 10) + SourceIndex(0) -3 >Emitted(92, 13) Source(152, 40) + SourceIndex(0) -4 >Emitted(92, 27) Source(152, 53) + SourceIndex(0) -5 >Emitted(92, 33) Source(152, 59) + SourceIndex(0) -6 >Emitted(92, 34) Source(152, 60) + SourceIndex(0) -7 >Emitted(92, 44) Source(152, 69) + SourceIndex(0) -8 >Emitted(92, 45) Source(152, 70) + SourceIndex(0) -9 >Emitted(92, 49) Source(152, 74) + SourceIndex(0) -10>Emitted(92, 55) Source(152, 80) + SourceIndex(0) -11>Emitted(92, 56) Source(152, 87) + SourceIndex(0) -12>Emitted(92, 57) Source(152, 88) + SourceIndex(0) -13>Emitted(92, 59) Source(152, 90) + SourceIndex(0) -14>Emitted(92, 60) Source(152, 91) + SourceIndex(0) -15>Emitted(92, 61) Source(152, 91) + SourceIndex(0) -16>Emitted(92, 62) Source(152, 92) + SourceIndex(0) -17>Emitted(92, 63) Source(152, 93) + SourceIndex(0) -18>Emitted(92, 64) Source(152, 93) + SourceIndex(0) -19>Emitted(92, 65) Source(152, 94) + SourceIndex(0) -20>Emitted(92, 66) Source(152, 95) + SourceIndex(0) -21>Emitted(92, 67) Source(152, 96) + SourceIndex(0) + > +2 >var +3 > c10t5 +4 > : () => (n: number) => IFoo = +5 > function() { +6 > return +7 > +8 > function( +9 > n +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> +20> +21> } +22> ; +1->Emitted(92, 1) Source(152, 1) + SourceIndex(0) +2 >Emitted(92, 5) Source(152, 5) + SourceIndex(0) +3 >Emitted(92, 10) Source(152, 10) + SourceIndex(0) +4 >Emitted(92, 13) Source(152, 40) + SourceIndex(0) +5 >Emitted(92, 27) Source(152, 53) + SourceIndex(0) +6 >Emitted(92, 33) Source(152, 59) + SourceIndex(0) +7 >Emitted(92, 34) Source(152, 60) + SourceIndex(0) +8 >Emitted(92, 44) Source(152, 69) + SourceIndex(0) +9 >Emitted(92, 45) Source(152, 70) + SourceIndex(0) +10>Emitted(92, 49) Source(152, 74) + SourceIndex(0) +11>Emitted(92, 55) Source(152, 80) + SourceIndex(0) +12>Emitted(92, 56) Source(152, 87) + SourceIndex(0) +13>Emitted(92, 57) Source(152, 88) + SourceIndex(0) +14>Emitted(92, 59) Source(152, 90) + SourceIndex(0) +15>Emitted(92, 60) Source(152, 91) + SourceIndex(0) +16>Emitted(92, 61) Source(152, 91) + SourceIndex(0) +17>Emitted(92, 62) Source(152, 92) + SourceIndex(0) +18>Emitted(92, 63) Source(152, 93) + SourceIndex(0) +19>Emitted(92, 64) Source(152, 93) + SourceIndex(0) +20>Emitted(92, 65) Source(152, 94) + SourceIndex(0) +21>Emitted(92, 66) Source(152, 95) + SourceIndex(0) +22>Emitted(92, 67) Source(152, 96) + SourceIndex(0) --- >>>// CONTEXT: Newing a class 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> 1 > > - >// CONTEXT: Newing a class > -2 > -3 >// CONTEXT: Newing a class -1 >Emitted(93, 1) Source(155, 1) + SourceIndex(0) -2 >Emitted(93, 1) Source(154, 1) + SourceIndex(0) -3 >Emitted(93, 27) Source(154, 27) + SourceIndex(0) +2 >// CONTEXT: Newing a class +1 >Emitted(93, 1) Source(154, 1) + SourceIndex(0) +2 >Emitted(93, 27) Source(154, 27) + SourceIndex(0) --- >>>var C11t5 = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(94, 1) Source(155, 1) + SourceIndex(0) +--- >>> function C11t5(f) { 1->^^^^ 2 > ^^^^^^^^^^^^^^^ 3 > ^ -1-> - >class C11t5 { +1->class C11t5 { 2 > constructor( 3 > f: (n: number) => IFoo 1->Emitted(95, 5) Source(155, 15) + SourceIndex(0) name (C11t5) @@ -2448,66 +2438,65 @@ sourceFile:contextualTyping.ts --- >>>// CONTEXT: Type annotated expression 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^-> 1 > > - >// CONTEXT: Type annotated expression > -2 > -3 >// CONTEXT: Type annotated expression -1 >Emitted(101, 1) Source(159, 1) + SourceIndex(0) -2 >Emitted(101, 1) Source(158, 1) + SourceIndex(0) -3 >Emitted(101, 38) Source(158, 38) + SourceIndex(0) +2 >// CONTEXT: Type annotated expression +1 >Emitted(101, 1) Source(158, 1) + SourceIndex(0) +2 >Emitted(101, 38) Source(158, 38) + SourceIndex(0) --- >>>var c12t1 = (function (s) { return s; }); -1->^^^^ -2 > ^^^^^ -3 > ^^^ -4 > ^ -5 > ^^^^^^^^^^ -6 > ^ -7 > ^^^^ -8 > ^^^^^^ -9 > ^ -10> ^ -11> ^ -12> ^ -13> ^ -14> ^ -15> ^ +1-> +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^ +6 > ^^^^^^^^^^ +7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ 1-> - >var -2 > c12t1 -3 > = <(s: string) => string> -4 > ( -5 > function( -6 > s -7 > ) { -8 > return -9 > -10> s -11> -12> -13> } -14> ) -15> ; -1->Emitted(102, 5) Source(159, 5) + SourceIndex(0) -2 >Emitted(102, 10) Source(159, 10) + SourceIndex(0) -3 >Emitted(102, 13) Source(159, 37) + SourceIndex(0) -4 >Emitted(102, 14) Source(159, 38) + SourceIndex(0) -5 >Emitted(102, 24) Source(159, 47) + SourceIndex(0) -6 >Emitted(102, 25) Source(159, 48) + SourceIndex(0) -7 >Emitted(102, 29) Source(159, 52) + SourceIndex(0) -8 >Emitted(102, 35) Source(159, 58) + SourceIndex(0) -9 >Emitted(102, 36) Source(159, 59) + SourceIndex(0) -10>Emitted(102, 37) Source(159, 60) + SourceIndex(0) -11>Emitted(102, 38) Source(159, 60) + SourceIndex(0) -12>Emitted(102, 39) Source(159, 61) + SourceIndex(0) -13>Emitted(102, 40) Source(159, 62) + SourceIndex(0) -14>Emitted(102, 41) Source(159, 63) + SourceIndex(0) -15>Emitted(102, 42) Source(159, 64) + SourceIndex(0) + > +2 >var +3 > c12t1 +4 > = <(s: string) => string> +5 > ( +6 > function( +7 > s +8 > ) { +9 > return +10> +11> s +12> +13> +14> } +15> ) +16> ; +1->Emitted(102, 1) Source(159, 1) + SourceIndex(0) +2 >Emitted(102, 5) Source(159, 5) + SourceIndex(0) +3 >Emitted(102, 10) Source(159, 10) + SourceIndex(0) +4 >Emitted(102, 13) Source(159, 37) + SourceIndex(0) +5 >Emitted(102, 14) Source(159, 38) + SourceIndex(0) +6 >Emitted(102, 24) Source(159, 47) + SourceIndex(0) +7 >Emitted(102, 25) Source(159, 48) + SourceIndex(0) +8 >Emitted(102, 29) Source(159, 52) + SourceIndex(0) +9 >Emitted(102, 35) Source(159, 58) + SourceIndex(0) +10>Emitted(102, 36) Source(159, 59) + SourceIndex(0) +11>Emitted(102, 37) Source(159, 60) + SourceIndex(0) +12>Emitted(102, 38) Source(159, 60) + SourceIndex(0) +13>Emitted(102, 39) Source(159, 61) + SourceIndex(0) +14>Emitted(102, 40) Source(159, 62) + SourceIndex(0) +15>Emitted(102, 41) Source(159, 63) + SourceIndex(0) +16>Emitted(102, 42) Source(159, 64) + SourceIndex(0) --- >>>var c12t2 = ({ 1 > diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js index 85897bc2c9d77..7886736f7e452 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js @@ -20,8 +20,8 @@ function makePoint(x) { }; } ; -var point = makePoint(2); -var x = point.x; +var /*4*/ point = makePoint(2); +var /*2*/ x = point.x; point.x = 30; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js index dd39a30f7a27f..8d79a576b06ea 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js @@ -16,8 +16,8 @@ function makePoint(x) { }; } ; -var point = makePoint(2); -var x = point.x; +var /*4*/ point = makePoint(2); +var /*2*/ x = point.x; //// [declFileObjectLiteralWithOnlyGetter.d.ts] diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js index e219e885053b3..f7a48fe810c45 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js @@ -17,7 +17,7 @@ function makePoint(x) { }; } ; -var point = makePoint(2); +var /*3*/ point = makePoint(2); point.x = 30; diff --git a/tests/baselines/reference/declarationEmit_exportAssignment.js b/tests/baselines/reference/declarationEmit_exportAssignment.js new file mode 100644 index 0000000000000..54f3eb5fd0ed8 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_exportAssignment.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/declarationEmit_exportAssignment.ts] //// + +//// [utils.ts] + +export function foo() { } +export function bar() { } +export interface Buzz { } + +//// [index.ts] +import {foo} from "utils"; +export = foo; + +//// [utils.js] +function foo() { } +exports.foo = foo; +function bar() { } +exports.bar = bar; +//// [index.js] +var utils_1 = require("utils"); +module.exports = utils_1.foo; + + +//// [utils.d.ts] +export declare function foo(): void; +export declare function bar(): void; +export interface Buzz { +} +//// [index.d.ts] +import { foo } from "utils"; +export = foo; diff --git a/tests/baselines/reference/declarationEmit_exportAssignment.symbols b/tests/baselines/reference/declarationEmit_exportAssignment.symbols new file mode 100644 index 0000000000000..b443ba6e797fc --- /dev/null +++ b/tests/baselines/reference/declarationEmit_exportAssignment.symbols @@ -0,0 +1,18 @@ +=== tests/cases/compiler/utils.ts === + +export function foo() { } +>foo : Symbol(foo, Decl(utils.ts, 0, 0)) + +export function bar() { } +>bar : Symbol(bar, Decl(utils.ts, 1, 25)) + +export interface Buzz { } +>Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25)) + +=== tests/cases/compiler/index.ts === +import {foo} from "utils"; +>foo : Symbol(foo, Decl(index.ts, 0, 8)) + +export = foo; +>foo : Symbol(foo, Decl(index.ts, 0, 8)) + diff --git a/tests/baselines/reference/declarationEmit_exportAssignment.types b/tests/baselines/reference/declarationEmit_exportAssignment.types new file mode 100644 index 0000000000000..81c56da432f5b --- /dev/null +++ b/tests/baselines/reference/declarationEmit_exportAssignment.types @@ -0,0 +1,18 @@ +=== tests/cases/compiler/utils.ts === + +export function foo() { } +>foo : () => void + +export function bar() { } +>bar : () => void + +export interface Buzz { } +>Buzz : Buzz + +=== tests/cases/compiler/index.ts === +import {foo} from "utils"; +>foo : () => void + +export = foo; +>foo : () => void + diff --git a/tests/baselines/reference/declarationEmit_exportDeclaration.js b/tests/baselines/reference/declarationEmit_exportDeclaration.js new file mode 100644 index 0000000000000..f05639dc18f30 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_exportDeclaration.js @@ -0,0 +1,35 @@ +//// [tests/cases/compiler/declarationEmit_exportDeclaration.ts] //// + +//// [utils.ts] + +export function foo() { } +export function bar() { } +export interface Buzz { } + +//// [index.ts] +import {foo, bar, Buzz} from "utils"; + +foo(); +let obj: Buzz; +export {bar}; + +//// [utils.js] +function foo() { } +exports.foo = foo; +function bar() { } +exports.bar = bar; +//// [index.js] +var utils_1 = require("utils"); +exports.bar = utils_1.bar; +utils_1.foo(); +var obj; + + +//// [utils.d.ts] +export declare function foo(): void; +export declare function bar(): void; +export interface Buzz { +} +//// [index.d.ts] +import { bar } from "utils"; +export { bar }; diff --git a/tests/baselines/reference/declarationEmit_exportDeclaration.symbols b/tests/baselines/reference/declarationEmit_exportDeclaration.symbols new file mode 100644 index 0000000000000..5cd8c5fee9968 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_exportDeclaration.symbols @@ -0,0 +1,27 @@ +=== tests/cases/compiler/utils.ts === + +export function foo() { } +>foo : Symbol(foo, Decl(utils.ts, 0, 0)) + +export function bar() { } +>bar : Symbol(bar, Decl(utils.ts, 1, 25)) + +export interface Buzz { } +>Buzz : Symbol(Buzz, Decl(utils.ts, 2, 25)) + +=== tests/cases/compiler/index.ts === +import {foo, bar, Buzz} from "utils"; +>foo : Symbol(foo, Decl(index.ts, 0, 8)) +>bar : Symbol(bar, Decl(index.ts, 0, 12)) +>Buzz : Symbol(Buzz, Decl(index.ts, 0, 17)) + +foo(); +>foo : Symbol(foo, Decl(index.ts, 0, 8)) + +let obj: Buzz; +>obj : Symbol(obj, Decl(index.ts, 3, 3)) +>Buzz : Symbol(Buzz, Decl(index.ts, 0, 17)) + +export {bar}; +>bar : Symbol(bar, Decl(index.ts, 4, 8)) + diff --git a/tests/baselines/reference/declarationEmit_exportDeclaration.types b/tests/baselines/reference/declarationEmit_exportDeclaration.types new file mode 100644 index 0000000000000..058ee863c6140 --- /dev/null +++ b/tests/baselines/reference/declarationEmit_exportDeclaration.types @@ -0,0 +1,28 @@ +=== tests/cases/compiler/utils.ts === + +export function foo() { } +>foo : () => void + +export function bar() { } +>bar : () => void + +export interface Buzz { } +>Buzz : Buzz + +=== tests/cases/compiler/index.ts === +import {foo, bar, Buzz} from "utils"; +>foo : () => void +>bar : () => void +>Buzz : any + +foo(); +>foo() : void +>foo : () => void + +let obj: Buzz; +>obj : Buzz +>Buzz : Buzz + +export {bar}; +>bar : () => void + diff --git a/tests/baselines/reference/decoratorMetadata.js b/tests/baselines/reference/decoratorMetadata.js index ea776d09910c9..5c2ce580507dd 100644 --- a/tests/baselines/reference/decoratorMetadata.js +++ b/tests/baselines/reference/decoratorMetadata.js @@ -34,6 +34,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; +var service_1 = require("./service"); var MyComponent = (function () { function MyComponent(Service) { this.Service = Service; diff --git a/tests/baselines/reference/decoratorMetadataWithConstructorType.js b/tests/baselines/reference/decoratorMetadataWithConstructorType.js new file mode 100644 index 0000000000000..1523915a3900b --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithConstructorType.js @@ -0,0 +1,39 @@ +//// [decoratorMetadataWithConstructorType.ts] + +declare var console: { + log(msg: string): void; +}; + +class A { + constructor() { console.log('new A'); } +} + +function decorator(target: Object, propertyKey: string) { +} + +export class B { + @decorator + x: A = new A(); +} + + +//// [decoratorMetadataWithConstructorType.js] +var A = (function () { + function A() { + console.log('new A'); + } + return A; +})(); +function decorator(target, propertyKey) { +} +var B = (function () { + function B() { + this.x = new A(); + } + __decorate([ + decorator, + __metadata('design:type', A) + ], B.prototype, "x"); + return B; +})(); +exports.B = B; diff --git a/tests/baselines/reference/decoratorMetadataWithConstructorType.symbols b/tests/baselines/reference/decoratorMetadataWithConstructorType.symbols new file mode 100644 index 0000000000000..57221f0d13912 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithConstructorType.symbols @@ -0,0 +1,39 @@ +=== tests/cases/compiler/decoratorMetadataWithConstructorType.ts === + +declare var console: { +>console : Symbol(console, Decl(decoratorMetadataWithConstructorType.ts, 1, 11)) + + log(msg: string): void; +>log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22)) +>msg : Symbol(msg, Decl(decoratorMetadataWithConstructorType.ts, 2, 8)) + +}; + +class A { +>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2)) + + constructor() { console.log('new A'); } +>console.log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22)) +>console : Symbol(console, Decl(decoratorMetadataWithConstructorType.ts, 1, 11)) +>log : Symbol(log, Decl(decoratorMetadataWithConstructorType.ts, 1, 22)) +} + +function decorator(target: Object, propertyKey: string) { +>decorator : Symbol(decorator, Decl(decoratorMetadataWithConstructorType.ts, 7, 1)) +>target : Symbol(target, Decl(decoratorMetadataWithConstructorType.ts, 9, 19)) +>Object : Symbol(Object, Decl(lib.d.ts, 92, 1), Decl(lib.d.ts, 223, 11)) +>propertyKey : Symbol(propertyKey, Decl(decoratorMetadataWithConstructorType.ts, 9, 34)) +} + +export class B { +>B : Symbol(B, Decl(decoratorMetadataWithConstructorType.ts, 10, 1)) + + @decorator +>decorator : Symbol(decorator, Decl(decoratorMetadataWithConstructorType.ts, 7, 1)) + + x: A = new A(); +>x : Symbol(x, Decl(decoratorMetadataWithConstructorType.ts, 12, 16)) +>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2)) +>A : Symbol(A, Decl(decoratorMetadataWithConstructorType.ts, 3, 2)) +} + diff --git a/tests/baselines/reference/decoratorMetadataWithConstructorType.types b/tests/baselines/reference/decoratorMetadataWithConstructorType.types new file mode 100644 index 0000000000000..ad83706f4f997 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithConstructorType.types @@ -0,0 +1,42 @@ +=== tests/cases/compiler/decoratorMetadataWithConstructorType.ts === + +declare var console: { +>console : { log(msg: string): void; } + + log(msg: string): void; +>log : (msg: string) => void +>msg : string + +}; + +class A { +>A : A + + constructor() { console.log('new A'); } +>console.log('new A') : void +>console.log : (msg: string) => void +>console : { log(msg: string): void; } +>log : (msg: string) => void +>'new A' : string +} + +function decorator(target: Object, propertyKey: string) { +>decorator : (target: Object, propertyKey: string) => void +>target : Object +>Object : Object +>propertyKey : string +} + +export class B { +>B : B + + @decorator +>decorator : (target: Object, propertyKey: string) => void + + x: A = new A(); +>x : A +>A : A +>new A() : A +>A : typeof A +} + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js new file mode 100644 index 0000000000000..392506e53683f --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.js @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts] //// + +//// [db.ts] +export class db { + public doSomething() { + } +} + +//// [service.ts] +import {db} from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db; + + constructor(db: db) { + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +exports.db = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db_1.db]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols new file mode 100644 index 0000000000000..c967239df99ea --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/db.ts === +export class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) + } +} + +=== tests/cases/compiler/service.ts === +import {db} from './db'; +>db : Symbol(db, Decl(service.ts, 0, 8)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 24)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 24)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: db; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 0, 8)) + + constructor(db: db) { +>db : Symbol(db, Decl(service.ts, 8, 16)) +>db : Symbol(db, Decl(service.ts, 0, 8)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 17)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types new file mode 100644 index 0000000000000..60cf7f10cea19 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/db.ts === +export class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + +=== tests/cases/compiler/service.ts === +import {db} from './db'; +>db : typeof db + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: db; +>db : db +>db : db + + constructor(db: db) { +>db : db +>db : db + + this.db = db; +>this.db = db : db +>this.db : db +>this : MyClass +>db : db +>db : db + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : db +>this : MyClass +>db : db +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js new file mode 100644 index 0000000000000..da011acf1105c --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.js @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts] //// + +//// [db.ts] +export class db { + public doSomething() { + } +} + +//// [service.ts] +import {db as Database} from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: Database; + + constructor(db: Database) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +exports.db = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db_1.db]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols new file mode 100644 index 0000000000000..d79b05f68f680 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.symbols @@ -0,0 +1,52 @@ +=== tests/cases/compiler/db.ts === +export class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) + } +} + +=== tests/cases/compiler/service.ts === +import {db as Database} from './db'; +>db : Symbol(Database, Decl(service.ts, 0, 8)) +>Database : Symbol(Database, Decl(service.ts, 0, 8)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 36)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 36)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: Database; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>Database : Symbol(Database, Decl(service.ts, 0, 8)) + + constructor(db: Database) { // no collision +>db : Symbol(db, Decl(service.ts, 8, 16)) +>Database : Symbol(Database, Decl(service.ts, 0, 8)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(Database.doSomething, Decl(db.ts, 0, 17)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types new file mode 100644 index 0000000000000..73005b4673f9b --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision2.types @@ -0,0 +1,54 @@ +=== tests/cases/compiler/db.ts === +export class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + +=== tests/cases/compiler/service.ts === +import {db as Database} from './db'; +>db : typeof Database +>Database : typeof Database + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: Database; +>db : Database +>Database : Database + + constructor(db: Database) { // no collision +>db : Database +>Database : Database + + this.db = db; +>this.db = db : Database +>this.db : Database +>this : MyClass +>db : Database +>db : Database + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : Database +>this : MyClass +>db : Database +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.js new file mode 100644 index 0000000000000..b219bba4102f0 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.js @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision3.ts] //// + +//// [db.ts] +export class db { + public doSomething() { + } +} + +//// [service.ts] +import db = require('./db'); +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db.db; + + constructor(db: db.db) { // collision with namespace of external module db + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +exports.db = db; +//// [service.js] +var db = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db.db]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.symbols new file mode 100644 index 0000000000000..b34468c7bd54f --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.symbols @@ -0,0 +1,53 @@ +=== tests/cases/compiler/service.ts === +import db = require('./db'); +>db : Symbol(db, Decl(service.ts, 0, 0)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: db.db; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 0, 0)) +>db : Symbol(db.db, Decl(db.ts, 0, 0)) + + constructor(db: db.db) { // collision with namespace of external module db +>db : Symbol(db, Decl(service.ts, 8, 16)) +>db : Symbol(db, Decl(service.ts, 0, 0)) +>db : Symbol(db.db, Decl(db.ts, 0, 0)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(db.db.doSomething, Decl(db.ts, 0, 17)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(db.db.doSomething, Decl(db.ts, 0, 17)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + +=== tests/cases/compiler/db.ts === +export class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) + } +} + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.types new file mode 100644 index 0000000000000..0eea3e13b660a --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision3.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/service.ts === +import db = require('./db'); +>db : typeof db + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: db.db; +>db : db.db +>db : any +>db : db.db + + constructor(db: db.db) { // collision with namespace of external module db +>db : db.db +>db : any +>db : db.db + + this.db = db; +>this.db = db : db.db +>this.db : db.db +>this : MyClass +>db : db.db +>db : db.db + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : db.db +>this : MyClass +>db : db.db +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + +=== tests/cases/compiler/db.ts === +export class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.errors.txt b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.errors.txt new file mode 100644 index 0000000000000..611a080481285 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.errors.txt @@ -0,0 +1,27 @@ +tests/cases/compiler/service.ts(1,8): error TS1192: Module '"tests/cases/compiler/db"' has no default export. + + +==== tests/cases/compiler/db.ts (0 errors) ==== + export class db { + public doSomething() { + } + } + +==== tests/cases/compiler/service.ts (1 errors) ==== + import db from './db'; // error no default export + ~~ +!!! error TS1192: Module '"tests/cases/compiler/db"' has no default export. + function someDecorator(target) { + return target; + } + @someDecorator + class MyClass { + db: db.db; + + constructor(db: db.db) { + this.db = db; + this.db.doSomething(); + } + } + export {MyClass}; + \ No newline at end of file diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js new file mode 100644 index 0000000000000..d0d201e62b5f2 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision4.js @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision4.ts] //// + +//// [db.ts] +export class db { + public doSomething() { + } +} + +//// [service.ts] +import db from './db'; // error no default export +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db.db; + + constructor(db: db.db) { + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +exports.db = db; +//// [service.js] +var db_1 = require('./db'); // error no default export +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [Object]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js new file mode 100644 index 0000000000000..a25995153382b --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts] //// + +//// [db.ts] +export default class db { + public doSomething() { + } +} + +//// [service.ts] +import db from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db; + + constructor(db: db) { // collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db_1.default]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols new file mode 100644 index 0000000000000..6047d7f288216 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/db.ts === +export default class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 25)) + } +} + +=== tests/cases/compiler/service.ts === +import db from './db'; +>db : Symbol(db, Decl(service.ts, 0, 6)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 22)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 22)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: db; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 0, 6)) + + constructor(db: db) { // collision +>db : Symbol(db, Decl(service.ts, 8, 16)) +>db : Symbol(db, Decl(service.ts, 0, 6)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(db.doSomething, Decl(db.ts, 0, 25)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types new file mode 100644 index 0000000000000..0fbc48db15718 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision5.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/db.ts === +export default class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + +=== tests/cases/compiler/service.ts === +import db from './db'; +>db : typeof db + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: db; +>db : db +>db : db + + constructor(db: db) { // collision +>db : db +>db : db + + this.db = db; +>this.db = db : db +>this.db : db +>this : MyClass +>db : db +>db : db + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : db +>this : MyClass +>db : db +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js new file mode 100644 index 0000000000000..917cdc7036f0e --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts] //// + +//// [db.ts] +export default class db { + public doSomething() { + } +} + +//// [service.ts] +import database from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: database; + + constructor(db: database) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [db_1.default]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols new file mode 100644 index 0000000000000..27f807503bfd7 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.symbols @@ -0,0 +1,51 @@ +=== tests/cases/compiler/db.ts === +export default class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 25)) + } +} + +=== tests/cases/compiler/service.ts === +import database from './db'; +>database : Symbol(database, Decl(service.ts, 0, 6)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 28)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: database; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>database : Symbol(database, Decl(service.ts, 0, 6)) + + constructor(db: database) { // no collision +>db : Symbol(db, Decl(service.ts, 8, 16)) +>database : Symbol(database, Decl(service.ts, 0, 6)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(database.doSomething, Decl(db.ts, 0, 25)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(database.doSomething, Decl(db.ts, 0, 25)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types new file mode 100644 index 0000000000000..e3a68882dfb9d --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision6.types @@ -0,0 +1,53 @@ +=== tests/cases/compiler/db.ts === +export default class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + +=== tests/cases/compiler/service.ts === +import database from './db'; +>database : typeof database + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: database; +>db : database +>database : database + + constructor(db: database) { // no collision +>db : database +>database : database + + this.db = db; +>this.db = db : database +>this.db : database +>this : MyClass +>db : database +>db : database + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : database +>this : MyClass +>db : database +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.errors.txt b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.errors.txt new file mode 100644 index 0000000000000..d4b714f1d4ae2 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.errors.txt @@ -0,0 +1,30 @@ +tests/cases/compiler/service.ts(7,9): error TS2503: Cannot find namespace 'db'. +tests/cases/compiler/service.ts(9,21): error TS2503: Cannot find namespace 'db'. + + +==== tests/cases/compiler/db.ts (0 errors) ==== + export default class db { + public doSomething() { + } + } + +==== tests/cases/compiler/service.ts (2 errors) ==== + import db from './db'; + function someDecorator(target) { + return target; + } + @someDecorator + class MyClass { + db: db.db; //error + ~~ +!!! error TS2503: Cannot find namespace 'db'. + + constructor(db: db.db) { // error + ~~ +!!! error TS2503: Cannot find namespace 'db'. + this.db = db; + this.db.doSomething(); + } + } + export {MyClass}; + \ No newline at end of file diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.js new file mode 100644 index 0000000000000..1dd93b12915f5 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision7.js @@ -0,0 +1,52 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision7.ts] //// + +//// [db.ts] +export default class db { + public doSomething() { + } +} + +//// [service.ts] +import db from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db.db; //error + + constructor(db: db.db) { // error + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = db; +//// [service.js] +var db_1 = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [Object]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.js b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.js new file mode 100644 index 0000000000000..0aee9e471dd43 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.js @@ -0,0 +1,51 @@ +//// [tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision8.ts] //// + +//// [db.ts] +export class db { + public doSomething() { + } +} + +//// [service.ts] +import database = require('./db'); +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: database.db; + + constructor(db: database.db) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; + + +//// [db.js] +var db = (function () { + function db() { + } + db.prototype.doSomething = function () { + }; + return db; +})(); +exports.db = db; +//// [service.js] +var database = require('./db'); +function someDecorator(target) { + return target; +} +var MyClass = (function () { + function MyClass(db) { + this.db = db; + this.db.doSomething(); + } + MyClass = __decorate([ + someDecorator, + __metadata('design:paramtypes', [database.db]) + ], MyClass); + return MyClass; +})(); +exports.MyClass = MyClass; diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.symbols b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.symbols new file mode 100644 index 0000000000000..1b73ea2e9a343 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.symbols @@ -0,0 +1,53 @@ +=== tests/cases/compiler/service.ts === +import database = require('./db'); +>database : Symbol(database, Decl(service.ts, 0, 0)) + +function someDecorator(target) { +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 34)) +>target : Symbol(target, Decl(service.ts, 1, 23)) + + return target; +>target : Symbol(target, Decl(service.ts, 1, 23)) +} +@someDecorator +>someDecorator : Symbol(someDecorator, Decl(service.ts, 0, 34)) + +class MyClass { +>MyClass : Symbol(MyClass, Decl(service.ts, 3, 1)) + + db: database.db; +>db : Symbol(db, Decl(service.ts, 5, 15)) +>database : Symbol(database, Decl(service.ts, 0, 0)) +>db : Symbol(database.db, Decl(db.ts, 0, 0)) + + constructor(db: database.db) { // no collision +>db : Symbol(db, Decl(service.ts, 8, 16)) +>database : Symbol(database, Decl(service.ts, 0, 0)) +>db : Symbol(database.db, Decl(db.ts, 0, 0)) + + this.db = db; +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>db : Symbol(db, Decl(service.ts, 8, 16)) + + this.db.doSomething(); +>this.db.doSomething : Symbol(database.db.doSomething, Decl(db.ts, 0, 17)) +>this.db : Symbol(db, Decl(service.ts, 5, 15)) +>this : Symbol(MyClass, Decl(service.ts, 3, 1)) +>db : Symbol(db, Decl(service.ts, 5, 15)) +>doSomething : Symbol(database.db.doSomething, Decl(db.ts, 0, 17)) + } +} +export {MyClass}; +>MyClass : Symbol(MyClass, Decl(service.ts, 13, 8)) + +=== tests/cases/compiler/db.ts === +export class db { +>db : Symbol(db, Decl(db.ts, 0, 0)) + + public doSomething() { +>doSomething : Symbol(doSomething, Decl(db.ts, 0, 17)) + } +} + diff --git a/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.types b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.types new file mode 100644 index 0000000000000..faaab05688541 --- /dev/null +++ b/tests/baselines/reference/decoratorMetadataWithImportDeclarationNameCollision8.types @@ -0,0 +1,55 @@ +=== tests/cases/compiler/service.ts === +import database = require('./db'); +>database : typeof database + +function someDecorator(target) { +>someDecorator : (target: any) => any +>target : any + + return target; +>target : any +} +@someDecorator +>someDecorator : (target: any) => any + +class MyClass { +>MyClass : MyClass + + db: database.db; +>db : database.db +>database : any +>db : database.db + + constructor(db: database.db) { // no collision +>db : database.db +>database : any +>db : database.db + + this.db = db; +>this.db = db : database.db +>this.db : database.db +>this : MyClass +>db : database.db +>db : database.db + + this.db.doSomething(); +>this.db.doSomething() : void +>this.db.doSomething : () => void +>this.db : database.db +>this : MyClass +>db : database.db +>doSomething : () => void + } +} +export {MyClass}; +>MyClass : typeof MyClass + +=== tests/cases/compiler/db.ts === +export class db { +>db : db + + public doSomething() { +>doSomething : () => void + } +} + diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols index c232eb2463682..68f4b65c463e6 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5.symbols @@ -8,18 +8,18 @@ type arrayString = Array >arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES5.ts, 0, 0)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) type someArray = Array | number[]; >someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES5.ts, 7, 32)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) type stringOrNumArray = Array; >stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES5.ts, 8, 42)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) >Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11)) function a1(...x: (number|string)[]) { } @@ -33,8 +33,8 @@ function a2(...a) { } function a3(...a: Array) { } >a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES5.ts, 12, 21)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES5.ts, 13, 12)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) function a4(...a: arrayString) { } >a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES5.ts, 13, 36)) diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols b/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols index 89f62f9718593..cabeaa26d3124 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES6.symbols @@ -8,18 +8,18 @@ type arrayString = Array >arrayString : Symbol(arrayString, Decl(destructuringParameterDeclaration3ES6.ts, 0, 0)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) type someArray = Array | number[]; >someArray : Symbol(someArray, Decl(destructuringParameterDeclaration3ES6.ts, 7, 32)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) type stringOrNumArray = Array; >stringOrNumArray : Symbol(stringOrNumArray, Decl(destructuringParameterDeclaration3ES6.ts, 8, 42)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) >Number : Symbol(Number, Decl(lib.d.ts, 456, 40), Decl(lib.d.ts, 518, 11)) function a1(...x: (number|string)[]) { } @@ -33,8 +33,8 @@ function a2(...a) { } function a3(...a: Array) { } >a3 : Symbol(a3, Decl(destructuringParameterDeclaration3ES6.ts, 12, 21)) >a : Symbol(a, Decl(destructuringParameterDeclaration3ES6.ts, 13, 12)) ->Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 1452, 1)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>Array : Symbol(Array, Decl(lib.d.ts, 1000, 23), Decl(lib.d.ts, 1171, 11), Decl(lib.d.ts, 4124, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) function a4(...a: arrayString) { } >a4 : Symbol(a4, Decl(destructuringParameterDeclaration3ES6.ts, 13, 36)) diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols index ad1482e7f1afd..9b651ec300134 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols @@ -5,7 +5,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4425, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) let arguments = 100; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols index 42db5aeaa859f..6238fc15f29d2 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols @@ -8,7 +8,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4425, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) const arguments = 100; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols index 453e04d752136..8b044779f1802 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols @@ -8,7 +8,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4425, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments[0]; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols index b686dd1959243..7925806abd843 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols @@ -9,7 +9,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4425, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments[0]; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols index 707b99c82c117..73568b91d2d7c 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols @@ -10,7 +10,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1704, 60)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 4425, 60)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments; diff --git a/tests/baselines/reference/emitBOM.js.map b/tests/baselines/reference/emitBOM.js.map index af5fd260813bb..69ccb88429509 100644 --- a/tests/baselines/reference/emitBOM.js.map +++ b/tests/baselines/reference/emitBOM.js.map @@ -1,2 +1,2 @@ //// [emitBOM.js.map] -{"version":3,"file":"emitBOM.js","sourceRoot":"","sources":["emitBOM.ts"],"names":[],"mappings":"AAEA,AADA,6DAA6D;IACzD,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"emitBOM.js","sourceRoot":"","sources":["emitBOM.ts"],"names":[],"mappings":"AACA,6DAA6D;AAC7D,IAAI,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/emitBOM.sourcemap.txt b/tests/baselines/reference/emitBOM.sourcemap.txt index cd49155d24f11..4cf35c4d1e39c 100644 --- a/tests/baselines/reference/emitBOM.sourcemap.txt +++ b/tests/baselines/reference/emitBOM.sourcemap.txt @@ -10,28 +10,27 @@ sourceFile:emitBOM.ts ------------------------------------------------------------------- >>>// JS and d.ts output should have a BOM but not the sourcemap 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > - >// JS and d.ts output should have a BOM but not the sourcemap > -2 > -3 >// JS and d.ts output should have a BOM but not the sourcemap -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -3 >Emitted(1, 62) Source(2, 62) + SourceIndex(0) +2 >// JS and d.ts output should have a BOM but not the sourcemap +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 62) Source(2, 62) + SourceIndex(0) --- >>>var x; -1 >^^^^ -2 > ^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > - >var -2 > x -3 > ; -1 >Emitted(2, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(2, 6) Source(3, 6) + SourceIndex(0) -3 >Emitted(2, 7) Source(3, 7) + SourceIndex(0) + > +2 >var +3 > x +4 > ; +1 >Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(2, 6) Source(3, 6) + SourceIndex(0) +4 >Emitted(2, 7) Source(3, 7) + SourceIndex(0) --- >>>//# sourceMappingURL=emitBOM.js.map \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportEqualsDeclaration2.js b/tests/baselines/reference/es6ImportEqualsDeclaration2.js new file mode 100644 index 0000000000000..c7a009a17cf9e --- /dev/null +++ b/tests/baselines/reference/es6ImportEqualsDeclaration2.js @@ -0,0 +1,23 @@ +//// [tests/cases/compiler/es6ImportEqualsDeclaration2.ts] //// + +//// [server.d.ts] + +declare module "other" { + export class C { } +} + +declare module "server" { + import events = require("other"); // Ambient declaration, no error expected. + + module S { + export var a: number; + } + + export = S; // Ambient declaration, no error expected. +} + +//// [client.ts] +import {a} from "server"; + + +//// [client.js] diff --git a/tests/baselines/reference/es6ImportEqualsDeclaration2.symbols b/tests/baselines/reference/es6ImportEqualsDeclaration2.symbols new file mode 100644 index 0000000000000..a7c556f5be041 --- /dev/null +++ b/tests/baselines/reference/es6ImportEqualsDeclaration2.symbols @@ -0,0 +1,26 @@ +=== tests/cases/compiler/server.d.ts === + +declare module "other" { + export class C { } +>C : Symbol(C, Decl(server.d.ts, 1, 24)) +} + +declare module "server" { + import events = require("other"); // Ambient declaration, no error expected. +>events : Symbol(events, Decl(server.d.ts, 5, 25)) + + module S { +>S : Symbol(S, Decl(server.d.ts, 6, 37)) + + export var a: number; +>a : Symbol(a, Decl(server.d.ts, 9, 18)) + } + + export = S; // Ambient declaration, no error expected. +>S : Symbol(S, Decl(server.d.ts, 6, 37)) +} + +=== tests/cases/compiler/client.ts === +import {a} from "server"; +>a : Symbol(a, Decl(client.ts, 0, 8)) + diff --git a/tests/baselines/reference/es6ImportEqualsDeclaration2.types b/tests/baselines/reference/es6ImportEqualsDeclaration2.types new file mode 100644 index 0000000000000..a483d10f25c60 --- /dev/null +++ b/tests/baselines/reference/es6ImportEqualsDeclaration2.types @@ -0,0 +1,26 @@ +=== tests/cases/compiler/server.d.ts === + +declare module "other" { + export class C { } +>C : C +} + +declare module "server" { + import events = require("other"); // Ambient declaration, no error expected. +>events : typeof events + + module S { +>S : typeof S + + export var a: number; +>a : number + } + + export = S; // Ambient declaration, no error expected. +>S : typeof S +} + +=== tests/cases/compiler/client.ts === +import {a} from "server"; +>a : number + diff --git a/tests/baselines/reference/extendClassExpressionFromModule.js b/tests/baselines/reference/extendClassExpressionFromModule.js new file mode 100644 index 0000000000000..cbd36f7e7998a --- /dev/null +++ b/tests/baselines/reference/extendClassExpressionFromModule.js @@ -0,0 +1,35 @@ +//// [tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts] //// + +//// [foo1.ts] +class x{} + +export = x; + +//// [foo2.ts] +import foo1 = require('./foo1'); +var x = foo1; +class y extends x {} + + +//// [foo1.js] +var x = (function () { + function x() { + } + return x; +})(); +module.exports = x; +//// [foo2.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var foo1 = require('./foo1'); +var x = foo1; +var y = (function (_super) { + __extends(y, _super); + function y() { + _super.apply(this, arguments); + } + return y; +})(x); diff --git a/tests/baselines/reference/extendClassExpressionFromModule.symbols b/tests/baselines/reference/extendClassExpressionFromModule.symbols new file mode 100644 index 0000000000000..c131ea8fa28c5 --- /dev/null +++ b/tests/baselines/reference/extendClassExpressionFromModule.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/classes/classExpressions/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +var x = foo1; +>x : Symbol(x, Decl(foo2.ts, 1, 3)) +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +class y extends x {} +>y : Symbol(y, Decl(foo2.ts, 1, 13)) + +=== tests/cases/conformance/classes/classExpressions/foo1.ts === +class x{} +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + +export = x; +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + diff --git a/tests/baselines/reference/extendClassExpressionFromModule.types b/tests/baselines/reference/extendClassExpressionFromModule.types new file mode 100644 index 0000000000000..d03623d50aa91 --- /dev/null +++ b/tests/baselines/reference/extendClassExpressionFromModule.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/classes/classExpressions/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : typeof foo1 + +var x = foo1; +>x : typeof foo1 +>foo1 : typeof foo1 + +class y extends x {} +>y : y +>x : foo1 + +=== tests/cases/conformance/classes/classExpressions/foo1.ts === +class x{} +>x : x + +export = x; +>x : x + diff --git a/tests/baselines/reference/for-of13.symbols b/tests/baselines/reference/for-of13.symbols index 08e5f4ff4683e..83e059f091569 100644 --- a/tests/baselines/reference/for-of13.symbols +++ b/tests/baselines/reference/for-of13.symbols @@ -4,6 +4,6 @@ var v: string; for (v of [""].values()) { } >v : Symbol(v, Decl(for-of13.ts, 0, 3)) ->[""].values : Symbol(Array.values, Decl(lib.d.ts, 1466, 37)) ->values : Symbol(Array.values, Decl(lib.d.ts, 1466, 37)) +>[""].values : Symbol(Array.values, Decl(lib.d.ts, 4152, 37)) +>values : Symbol(Array.values, Decl(lib.d.ts, 4152, 37)) diff --git a/tests/baselines/reference/for-of18.symbols b/tests/baselines/reference/for-of18.symbols index 066d9534051ef..41707bd941186 100644 --- a/tests/baselines/reference/for-of18.symbols +++ b/tests/baselines/reference/for-of18.symbols @@ -22,9 +22,9 @@ class StringIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(StringIterator, Decl(for-of18.ts, 1, 33)) diff --git a/tests/baselines/reference/for-of19.symbols b/tests/baselines/reference/for-of19.symbols index 8c34f6f0d7a4e..cd9cba854e985 100644 --- a/tests/baselines/reference/for-of19.symbols +++ b/tests/baselines/reference/for-of19.symbols @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(for-of19.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of20.symbols b/tests/baselines/reference/for-of20.symbols index 4e7aaf7e362bf..9d10b28095c6e 100644 --- a/tests/baselines/reference/for-of20.symbols +++ b/tests/baselines/reference/for-of20.symbols @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(for-of20.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of21.symbols b/tests/baselines/reference/for-of21.symbols index 70c1132afbd6d..1e4c1750fd406 100644 --- a/tests/baselines/reference/for-of21.symbols +++ b/tests/baselines/reference/for-of21.symbols @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(for-of21.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of22.symbols b/tests/baselines/reference/for-of22.symbols index 4650725593796..01da895a84552 100644 --- a/tests/baselines/reference/for-of22.symbols +++ b/tests/baselines/reference/for-of22.symbols @@ -28,9 +28,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(for-of22.ts, 5, 13)) diff --git a/tests/baselines/reference/for-of23.symbols b/tests/baselines/reference/for-of23.symbols index 8401de024d976..37e1eee25f4f4 100644 --- a/tests/baselines/reference/for-of23.symbols +++ b/tests/baselines/reference/for-of23.symbols @@ -27,9 +27,9 @@ class FooIterator { }; } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(for-of23.ts, 4, 13)) diff --git a/tests/baselines/reference/for-of25.symbols b/tests/baselines/reference/for-of25.symbols index 93e918c4bcdbd..96d25ba453f81 100644 --- a/tests/baselines/reference/for-of25.symbols +++ b/tests/baselines/reference/for-of25.symbols @@ -10,9 +10,9 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of25.ts, 1, 37)) [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return x; >x : Symbol(x, Decl(for-of25.ts, 0, 3)) diff --git a/tests/baselines/reference/for-of26.symbols b/tests/baselines/reference/for-of26.symbols index 04445f50171ab..f70965d152681 100644 --- a/tests/baselines/reference/for-of26.symbols +++ b/tests/baselines/reference/for-of26.symbols @@ -16,9 +16,9 @@ class StringIterator { >x : Symbol(x, Decl(for-of26.ts, 0, 3)) } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(StringIterator, Decl(for-of26.ts, 1, 37)) diff --git a/tests/baselines/reference/for-of27.symbols b/tests/baselines/reference/for-of27.symbols index 4c645d359dd55..3d7b258b96a21 100644 --- a/tests/baselines/reference/for-of27.symbols +++ b/tests/baselines/reference/for-of27.symbols @@ -7,7 +7,7 @@ class StringIterator { >StringIterator : Symbol(StringIterator, Decl(for-of27.ts, 0, 37)) [Symbol.iterator]: any; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) } diff --git a/tests/baselines/reference/for-of28.symbols b/tests/baselines/reference/for-of28.symbols index 6887b46a44de7..44c6b186e352d 100644 --- a/tests/baselines/reference/for-of28.symbols +++ b/tests/baselines/reference/for-of28.symbols @@ -10,9 +10,9 @@ class StringIterator { >next : Symbol(next, Decl(for-of28.ts, 2, 22)) [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(StringIterator, Decl(for-of28.ts, 0, 37)) diff --git a/tests/baselines/reference/for-of37.symbols b/tests/baselines/reference/for-of37.symbols index a726b7eedc24f..78506c4c95dbf 100644 --- a/tests/baselines/reference/for-of37.symbols +++ b/tests/baselines/reference/for-of37.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of37.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of37.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4641, 1), Decl(lib.d.ts, 4664, 11)) for (var v of map) { >v : Symbol(v, Decl(for-of37.ts, 1, 8)) diff --git a/tests/baselines/reference/for-of38.symbols b/tests/baselines/reference/for-of38.symbols index 11ff91e116269..ff488c045b248 100644 --- a/tests/baselines/reference/for-of38.symbols +++ b/tests/baselines/reference/for-of38.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of38.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of38.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4641, 1), Decl(lib.d.ts, 4664, 11)) for (var [k, v] of map) { >k : Symbol(k, Decl(for-of38.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of40.symbols b/tests/baselines/reference/for-of40.symbols index f6619ff753d17..0c3644c1e41d3 100644 --- a/tests/baselines/reference/for-of40.symbols +++ b/tests/baselines/reference/for-of40.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of40.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of40.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4641, 1), Decl(lib.d.ts, 4664, 11)) for (var [k = "", v = false] of map) { >k : Symbol(k, Decl(for-of40.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of44.symbols b/tests/baselines/reference/for-of44.symbols index a9ea283d6736b..6e02bbbd746bf 100644 --- a/tests/baselines/reference/for-of44.symbols +++ b/tests/baselines/reference/for-of44.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of44.ts === var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]] >array : Symbol(array, Decl(for-of44.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) for (var [num, strBoolSym] of array) { >num : Symbol(num, Decl(for-of44.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of45.symbols b/tests/baselines/reference/for-of45.symbols index 1d447ea87cce4..a4121564e732b 100644 --- a/tests/baselines/reference/for-of45.symbols +++ b/tests/baselines/reference/for-of45.symbols @@ -5,7 +5,7 @@ var k: string, v: boolean; var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of45.ts, 1, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4641, 1), Decl(lib.d.ts, 4664, 11)) for ([k = "", v = false] of map) { >k : Symbol(k, Decl(for-of45.ts, 0, 3)) diff --git a/tests/baselines/reference/for-of50.symbols b/tests/baselines/reference/for-of50.symbols index 6b8012c792946..b1dd2dd888691 100644 --- a/tests/baselines/reference/for-of50.symbols +++ b/tests/baselines/reference/for-of50.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of50.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of50.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4641, 1), Decl(lib.d.ts, 4664, 11)) for (const [k, v] of map) { >k : Symbol(k, Decl(for-of50.ts, 1, 12)) diff --git a/tests/baselines/reference/for-of57.symbols b/tests/baselines/reference/for-of57.symbols index b8d01d3bd1b06..cc5bd37539b2a 100644 --- a/tests/baselines/reference/for-of57.symbols +++ b/tests/baselines/reference/for-of57.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of57.ts === var iter: Iterable; >iter : Symbol(iter, Decl(for-of57.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) for (let num of iter) { } >num : Symbol(num, Decl(for-of57.ts, 1, 8)) diff --git a/tests/baselines/reference/generatorES6_6.symbols b/tests/baselines/reference/generatorES6_6.symbols index 7f30b4f67973a..93ad8eea8056f 100644 --- a/tests/baselines/reference/generatorES6_6.symbols +++ b/tests/baselines/reference/generatorES6_6.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(generatorES6_6.ts, 0, 0)) *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) let a = yield 1; >a : Symbol(a, Decl(generatorES6_6.ts, 2, 7)) diff --git a/tests/baselines/reference/generatorOverloads4.symbols b/tests/baselines/reference/generatorOverloads4.symbols index c4fb9401517ab..1b9a5a536db9c 100644 --- a/tests/baselines/reference/generatorOverloads4.symbols +++ b/tests/baselines/reference/generatorOverloads4.symbols @@ -5,15 +5,15 @@ class C { f(s: string): Iterable; >f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 1, 6)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) f(s: number): Iterable; >f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 2, 6)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) *f(s: any): Iterable { } >f : Symbol(f, Decl(generatorOverloads4.ts, 0, 9), Decl(generatorOverloads4.ts, 1, 32), Decl(generatorOverloads4.ts, 2, 32)) >s : Symbol(s, Decl(generatorOverloads4.ts, 3, 7)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) } diff --git a/tests/baselines/reference/generatorOverloads5.symbols b/tests/baselines/reference/generatorOverloads5.symbols index 509ed22d1976c..750061c05ba29 100644 --- a/tests/baselines/reference/generatorOverloads5.symbols +++ b/tests/baselines/reference/generatorOverloads5.symbols @@ -5,15 +5,15 @@ module M { function f(s: string): Iterable; >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 1, 15)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) function f(s: number): Iterable; >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 2, 15)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) function* f(s: any): Iterable { } >f : Symbol(f, Decl(generatorOverloads5.ts, 0, 10), Decl(generatorOverloads5.ts, 1, 41), Decl(generatorOverloads5.ts, 2, 41)) >s : Symbol(s, Decl(generatorOverloads5.ts, 3, 16)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) } diff --git a/tests/baselines/reference/generatorTypeCheck1.symbols b/tests/baselines/reference/generatorTypeCheck1.symbols index 79cc3e275ad61..cefbf28e549a6 100644 --- a/tests/baselines/reference/generatorTypeCheck1.symbols +++ b/tests/baselines/reference/generatorTypeCheck1.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck1.ts === function* g1(): Iterator { } >g1 : Symbol(g1, Decl(generatorTypeCheck1.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, 1675, 1)) +>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4396, 1)) diff --git a/tests/baselines/reference/generatorTypeCheck10.symbols b/tests/baselines/reference/generatorTypeCheck10.symbols index 6247bd7b85ca4..3465815829ab8 100644 --- a/tests/baselines/reference/generatorTypeCheck10.symbols +++ b/tests/baselines/reference/generatorTypeCheck10.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck10.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck10.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) return; } diff --git a/tests/baselines/reference/generatorTypeCheck11.symbols b/tests/baselines/reference/generatorTypeCheck11.symbols index dce2524d1ba3f..7bedd0dec70a6 100644 --- a/tests/baselines/reference/generatorTypeCheck11.symbols +++ b/tests/baselines/reference/generatorTypeCheck11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck11.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck11.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) return 0; } diff --git a/tests/baselines/reference/generatorTypeCheck12.symbols b/tests/baselines/reference/generatorTypeCheck12.symbols index f9c9b7b6e22a7..5f4e8f7f94ed8 100644 --- a/tests/baselines/reference/generatorTypeCheck12.symbols +++ b/tests/baselines/reference/generatorTypeCheck12.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck12.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck12.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) return ""; } diff --git a/tests/baselines/reference/generatorTypeCheck13.symbols b/tests/baselines/reference/generatorTypeCheck13.symbols index bc43ea8c8f909..9b328cbd92d0a 100644 --- a/tests/baselines/reference/generatorTypeCheck13.symbols +++ b/tests/baselines/reference/generatorTypeCheck13.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck13.ts === function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck13.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) yield 0; return ""; diff --git a/tests/baselines/reference/generatorTypeCheck17.symbols b/tests/baselines/reference/generatorTypeCheck17.symbols index 789eb22347cfc..40d663f3f8b7a 100644 --- a/tests/baselines/reference/generatorTypeCheck17.symbols +++ b/tests/baselines/reference/generatorTypeCheck17.symbols @@ -10,7 +10,7 @@ class Bar extends Foo { y: string } function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck17.ts, 1, 35)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) >Foo : Symbol(Foo, Decl(generatorTypeCheck17.ts, 0, 0)) yield; diff --git a/tests/baselines/reference/generatorTypeCheck19.symbols b/tests/baselines/reference/generatorTypeCheck19.symbols index e7a5898099f29..34d18be0d2951 100644 --- a/tests/baselines/reference/generatorTypeCheck19.symbols +++ b/tests/baselines/reference/generatorTypeCheck19.symbols @@ -10,7 +10,7 @@ class Bar extends Foo { y: string } function* g(): IterableIterator { >g : Symbol(g, Decl(generatorTypeCheck19.ts, 1, 35)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) >Foo : Symbol(Foo, Decl(generatorTypeCheck19.ts, 0, 0)) yield; diff --git a/tests/baselines/reference/generatorTypeCheck2.symbols b/tests/baselines/reference/generatorTypeCheck2.symbols index 5a0aec4d59224..20eda4a75a815 100644 --- a/tests/baselines/reference/generatorTypeCheck2.symbols +++ b/tests/baselines/reference/generatorTypeCheck2.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck2.ts === function* g1(): Iterable { } >g1 : Symbol(g1, Decl(generatorTypeCheck2.ts, 0, 0)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) diff --git a/tests/baselines/reference/generatorTypeCheck26.symbols b/tests/baselines/reference/generatorTypeCheck26.symbols index 08cc7289ef872..1c7d0dec7481f 100644 --- a/tests/baselines/reference/generatorTypeCheck26.symbols +++ b/tests/baselines/reference/generatorTypeCheck26.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck26.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck26.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) >x : Symbol(x, Decl(generatorTypeCheck26.ts, 0, 33)) yield x => x.length; diff --git a/tests/baselines/reference/generatorTypeCheck27.symbols b/tests/baselines/reference/generatorTypeCheck27.symbols index fcee922d1e909..c96a01328235a 100644 --- a/tests/baselines/reference/generatorTypeCheck27.symbols +++ b/tests/baselines/reference/generatorTypeCheck27.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck27.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck27.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) >x : Symbol(x, Decl(generatorTypeCheck27.ts, 0, 33)) yield * function* () { diff --git a/tests/baselines/reference/generatorTypeCheck28.symbols b/tests/baselines/reference/generatorTypeCheck28.symbols index 27b246515f603..66c23f9fcc9b4 100644 --- a/tests/baselines/reference/generatorTypeCheck28.symbols +++ b/tests/baselines/reference/generatorTypeCheck28.symbols @@ -1,14 +1,14 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck28.ts === function* g(): IterableIterator<(x: string) => number> { >g : Symbol(g, Decl(generatorTypeCheck28.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) >x : Symbol(x, Decl(generatorTypeCheck28.ts, 0, 33)) yield * { *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) yield x => x.length; >x : Symbol(x, Decl(generatorTypeCheck28.ts, 3, 17)) diff --git a/tests/baselines/reference/generatorTypeCheck29.symbols b/tests/baselines/reference/generatorTypeCheck29.symbols index 260137dd1cf3a..255b629e44590 100644 --- a/tests/baselines/reference/generatorTypeCheck29.symbols +++ b/tests/baselines/reference/generatorTypeCheck29.symbols @@ -1,8 +1,8 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck29.ts === function* g2(): Iterator number>> { >g2 : Symbol(g2, Decl(generatorTypeCheck29.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, 1675, 1)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4396, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) >x : Symbol(x, Decl(generatorTypeCheck29.ts, 0, 35)) yield function* () { diff --git a/tests/baselines/reference/generatorTypeCheck3.symbols b/tests/baselines/reference/generatorTypeCheck3.symbols index a149a592e3d3c..61c6fbc63c7a5 100644 --- a/tests/baselines/reference/generatorTypeCheck3.symbols +++ b/tests/baselines/reference/generatorTypeCheck3.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck3.ts === function* g1(): IterableIterator { } >g1 : Symbol(g1, Decl(generatorTypeCheck3.ts, 0, 0)) ->IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 1685, 1)) +>IterableIterator : Symbol(IterableIterator, Decl(lib.d.ts, 4406, 1)) diff --git a/tests/baselines/reference/generatorTypeCheck30.symbols b/tests/baselines/reference/generatorTypeCheck30.symbols index 086c65685a8e3..65456374363b0 100644 --- a/tests/baselines/reference/generatorTypeCheck30.symbols +++ b/tests/baselines/reference/generatorTypeCheck30.symbols @@ -1,8 +1,8 @@ === tests/cases/conformance/es6/yieldExpressions/generatorTypeCheck30.ts === function* g2(): Iterator number>> { >g2 : Symbol(g2, Decl(generatorTypeCheck30.ts, 0, 0)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, 1675, 1)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4396, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) >x : Symbol(x, Decl(generatorTypeCheck30.ts, 0, 35)) yield function* () { diff --git a/tests/baselines/reference/generatorTypeCheck45.symbols b/tests/baselines/reference/generatorTypeCheck45.symbols index 89c01ff020353..cb360d8d81472 100644 --- a/tests/baselines/reference/generatorTypeCheck45.symbols +++ b/tests/baselines/reference/generatorTypeCheck45.symbols @@ -6,7 +6,7 @@ declare function foo(x: T, fun: () => Iterator<(x: T) => U>, fun2: (y: U) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 0, 27)) >T : Symbol(T, Decl(generatorTypeCheck45.ts, 0, 21)) >fun : Symbol(fun, Decl(generatorTypeCheck45.ts, 0, 32)) ->Iterator : Symbol(Iterator, Decl(lib.d.ts, 1675, 1)) +>Iterator : Symbol(Iterator, Decl(lib.d.ts, 4396, 1)) >x : Symbol(x, Decl(generatorTypeCheck45.ts, 0, 54)) >T : Symbol(T, Decl(generatorTypeCheck45.ts, 0, 21)) >U : Symbol(U, Decl(generatorTypeCheck45.ts, 0, 23)) diff --git a/tests/baselines/reference/generatorTypeCheck46.symbols b/tests/baselines/reference/generatorTypeCheck46.symbols index 72d8ebf57a167..a47e89c242a58 100644 --- a/tests/baselines/reference/generatorTypeCheck46.symbols +++ b/tests/baselines/reference/generatorTypeCheck46.symbols @@ -6,7 +6,7 @@ declare function foo(x: T, fun: () => Iterable<(x: T) => U>, fun2: (y: U) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 0, 27)) >T : Symbol(T, Decl(generatorTypeCheck46.ts, 0, 21)) >fun : Symbol(fun, Decl(generatorTypeCheck46.ts, 0, 32)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) >x : Symbol(x, Decl(generatorTypeCheck46.ts, 0, 54)) >T : Symbol(T, Decl(generatorTypeCheck46.ts, 0, 21)) >U : Symbol(U, Decl(generatorTypeCheck46.ts, 0, 23)) @@ -21,9 +21,9 @@ foo("", function* () { yield* { *[Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) yield x => x.length >x : Symbol(x, Decl(generatorTypeCheck46.ts, 5, 17)) diff --git a/tests/baselines/reference/getEmitOutput-pp.baseline b/tests/baselines/reference/getEmitOutput-pp.baseline new file mode 100644 index 0000000000000..d5487a14d95a3 --- /dev/null +++ b/tests/baselines/reference/getEmitOutput-pp.baseline @@ -0,0 +1,30 @@ +EmitSkipped: false +FileName : tests/cases/fourslash/shims-pp/inputFile1.js +var x = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +FileName : tests/cases/fourslash/shims-pp/inputFile1.d.ts +declare var x: number; +declare class Bar { + x: string; + y: number; +} + +EmitSkipped: false +FileName : tests/cases/fourslash/shims-pp/inputFile2.js +var x1 = "hello world"; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +FileName : tests/cases/fourslash/shims-pp/inputFile2.d.ts +declare var x1: string; +declare class Foo { + x: string; + y: number; +} + diff --git a/tests/baselines/reference/getEmitOutputOutFile.baseline b/tests/baselines/reference/getEmitOutputOutFile.baseline new file mode 100644 index 0000000000000..702097a7c0364 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputOutFile.baseline @@ -0,0 +1,26 @@ +EmitSkipped: false +FileName : outFile.js +var x = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +var x1 = "hello world"; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +FileName : outFile.d.ts +declare var x: number; +declare class Bar { + x: string; + y: number; +} +declare var x1: string; +declare class Foo { + x: string; + y: number; +} + diff --git a/tests/baselines/reference/getEmitOutputTsxFile_Preserve.baseline b/tests/baselines/reference/getEmitOutputTsxFile_Preserve.baseline new file mode 100644 index 0000000000000..2ae820dd53886 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputTsxFile_Preserve.baseline @@ -0,0 +1,26 @@ +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile1.js.map +{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["inputFile1.ts"],"names":["Bar","Bar.constructor"],"mappings":"AAAA,kBAAkB;AACjB,IAAI,CAAC,GAAW,CAAC,CAAC;AAClB;IAAAA;IAGAC,CAACA;IAADD,UAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile1.js +// regular ts file +var t = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +//# sourceMappingURL=inputFile1.js.mapFileName : tests/cases/fourslash/inputFile1.d.ts +declare var t: number; +declare class Bar { + x: string; + y: number; +} + +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile2.jsx.map +{"version":3,"file":"inputFile2.jsx","sourceRoot":"","sources":["inputFile2.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,QAAQ,CAAC;AACjB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,EAAG,CAAA"}FileName : tests/cases/fourslash/inputFile2.jsx +var y = "my div"; +var x =
; +//# sourceMappingURL=inputFile2.jsx.mapFileName : tests/cases/fourslash/inputFile2.d.ts +declare var y: string; +declare var x: any; + diff --git a/tests/baselines/reference/getEmitOutputTsxFile_React.baseline b/tests/baselines/reference/getEmitOutputTsxFile_React.baseline new file mode 100644 index 0000000000000..c796f8e78bc85 --- /dev/null +++ b/tests/baselines/reference/getEmitOutputTsxFile_React.baseline @@ -0,0 +1,26 @@ +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile1.js.map +{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["inputFile1.ts"],"names":["Bar","Bar.constructor"],"mappings":"AAAA,kBAAkB;AACjB,IAAI,CAAC,GAAW,CAAC,CAAC;AAClB;IAAAA;IAGAC,CAACA;IAADD,UAACA;AAADA,CAACA,AAHD,IAGC"}FileName : tests/cases/fourslash/inputFile1.js +// regular ts file +var t = 5; +var Bar = (function () { + function Bar() { + } + return Bar; +})(); +//# sourceMappingURL=inputFile1.js.mapFileName : tests/cases/fourslash/inputFile1.d.ts +declare var t: number; +declare class Bar { + x: string; + y: number; +} + +EmitSkipped: false +FileName : tests/cases/fourslash/inputFile2.js.map +{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["inputFile2.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,QAAQ,CAAC;AACjB,IAAI,CAAC,GAAG,qBAAC,GAAG,KAAC,IAAI,GAAG,CAAE,EAAG,CAAA"}FileName : tests/cases/fourslash/inputFile2.js +var y = "my div"; +var x = React.createElement("div", {"name": y}); +//# sourceMappingURL=inputFile2.js.mapFileName : tests/cases/fourslash/inputFile2.d.ts +declare var y: string; +declare var x: any; + diff --git a/tests/baselines/reference/importInsideModule.errors.txt b/tests/baselines/reference/importInsideModule.errors.txt index fcf82bd24940f..65fc90f65f106 100644 --- a/tests/baselines/reference/importInsideModule.errors.txt +++ b/tests/baselines/reference/importInsideModule.errors.txt @@ -1,14 +1,11 @@ tests/cases/compiler/importInsideModule_file2.ts(2,26): error TS1147: Import declarations in a namespace cannot reference a module. -tests/cases/compiler/importInsideModule_file2.ts(2,26): error TS2307: Cannot find module 'importInsideModule_file1'. -==== tests/cases/compiler/importInsideModule_file2.ts (2 errors) ==== +==== tests/cases/compiler/importInsideModule_file2.ts (1 errors) ==== export module myModule { import foo = require("importInsideModule_file1"); ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'importInsideModule_file1'. var a = foo.x; } ==== tests/cases/compiler/importInsideModule_file1.ts (0 errors) ==== diff --git a/tests/baselines/reference/importInsideModule.js b/tests/baselines/reference/importInsideModule.js index 5151e01f764e1..08b222c3503c8 100644 --- a/tests/baselines/reference/importInsideModule.js +++ b/tests/baselines/reference/importInsideModule.js @@ -9,6 +9,8 @@ export module myModule { var a = foo.x; } +//// [importInsideModule_file1.js] +exports.x = 1; //// [importInsideModule_file2.js] var myModule; (function (myModule) { diff --git a/tests/baselines/reference/inlineSourceMap2.errors.txt b/tests/baselines/reference/inlineSourceMap2.errors.txt index 2d8bc4be0c174..24b0fddf942f1 100644 --- a/tests/baselines/reference/inlineSourceMap2.errors.txt +++ b/tests/baselines/reference/inlineSourceMap2.errors.txt @@ -1,12 +1,12 @@ -error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. -error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. -error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. +error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. tests/cases/compiler/inlineSourceMap2.ts(5,1): error TS2304: Cannot find name 'console'. -!!! error TS5048: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. -!!! error TS5049: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. -!!! error TS5050: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +!!! error TS5053: Option 'mapRoot' cannot be specified with option 'inlineSourceMap'. +!!! error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'. +!!! error TS5053: Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'. ==== tests/cases/compiler/inlineSourceMap2.ts (1 errors) ==== // configuration errors diff --git a/tests/baselines/reference/isolatedModulesDeclaration.errors.txt b/tests/baselines/reference/isolatedModulesDeclaration.errors.txt index de5cb97586c02..749e86116e863 100644 --- a/tests/baselines/reference/isolatedModulesDeclaration.errors.txt +++ b/tests/baselines/reference/isolatedModulesDeclaration.errors.txt @@ -1,7 +1,7 @@ -error TS5044: Option 'declaration' cannot be specified with option 'isolatedModules'. +error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'. -!!! error TS5044: Option 'declaration' cannot be specified with option 'isolatedModules'. +!!! error TS5053: Option 'declaration' cannot be specified with option 'isolatedModules'. ==== tests/cases/compiler/isolatedModulesDeclaration.ts (0 errors) ==== export var x; \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt b/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt index 68b2747cf6b5a..337fcb16ba315 100644 --- a/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt +++ b/tests/baselines/reference/isolatedModulesNoEmitOnError.errors.txt @@ -1,7 +1,7 @@ -error TS5045: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'. +error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'. -!!! error TS5045: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'. +!!! error TS5053: Option 'noEmitOnError' cannot be specified with option 'isolatedModules'. ==== tests/cases/compiler/isolatedModulesNoEmitOnError.ts (0 errors) ==== export var x; \ No newline at end of file diff --git a/tests/baselines/reference/isolatedModulesOut.errors.txt b/tests/baselines/reference/isolatedModulesOut.errors.txt index 8234ba945850d..7d16ac946669d 100644 --- a/tests/baselines/reference/isolatedModulesOut.errors.txt +++ b/tests/baselines/reference/isolatedModulesOut.errors.txt @@ -1,8 +1,8 @@ -error TS5046: Option 'out' cannot be specified with option 'isolatedModules'. +error TS5053: Option 'out' cannot be specified with option 'isolatedModules'. tests/cases/compiler/file2.ts(1,1): error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. -!!! error TS5046: Option 'out' cannot be specified with option 'isolatedModules'. +!!! error TS5053: Option 'out' cannot be specified with option 'isolatedModules'. ==== tests/cases/compiler/file1.ts (0 errors) ==== export var x; diff --git a/tests/baselines/reference/iterableArrayPattern1.symbols b/tests/baselines/reference/iterableArrayPattern1.symbols index 3920dc1cef466..80d6a07f58863 100644 --- a/tests/baselines/reference/iterableArrayPattern1.symbols +++ b/tests/baselines/reference/iterableArrayPattern1.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iterableArrayPattern1.ts, 3, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iterableArrayPattern1.ts, 4, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iterableArrayPattern1.ts, 0, 32)) diff --git a/tests/baselines/reference/iterableArrayPattern11.symbols b/tests/baselines/reference/iterableArrayPattern11.symbols index 06e38c57af41d..331b6d3f16ccf 100644 --- a/tests/baselines/reference/iterableArrayPattern11.symbols +++ b/tests/baselines/reference/iterableArrayPattern11.symbols @@ -36,9 +36,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern11.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern12.symbols b/tests/baselines/reference/iterableArrayPattern12.symbols index e16fe5255e4fd..10533f87a0dd1 100644 --- a/tests/baselines/reference/iterableArrayPattern12.symbols +++ b/tests/baselines/reference/iterableArrayPattern12.symbols @@ -36,9 +36,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern12.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern13.symbols b/tests/baselines/reference/iterableArrayPattern13.symbols index b870919782926..11c712002f136 100644 --- a/tests/baselines/reference/iterableArrayPattern13.symbols +++ b/tests/baselines/reference/iterableArrayPattern13.symbols @@ -35,9 +35,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern13.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern2.symbols b/tests/baselines/reference/iterableArrayPattern2.symbols index 17ac6a1feacef..e58f5202b37cb 100644 --- a/tests/baselines/reference/iterableArrayPattern2.symbols +++ b/tests/baselines/reference/iterableArrayPattern2.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iterableArrayPattern2.ts, 3, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iterableArrayPattern2.ts, 4, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iterableArrayPattern2.ts, 0, 35)) diff --git a/tests/baselines/reference/iterableArrayPattern3.symbols b/tests/baselines/reference/iterableArrayPattern3.symbols index 468866ca32404..7a038dacfebef 100644 --- a/tests/baselines/reference/iterableArrayPattern3.symbols +++ b/tests/baselines/reference/iterableArrayPattern3.symbols @@ -37,9 +37,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern3.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern30.symbols b/tests/baselines/reference/iterableArrayPattern30.symbols index 6f0d347d9b409..c2fc0a4c1e372 100644 --- a/tests/baselines/reference/iterableArrayPattern30.symbols +++ b/tests/baselines/reference/iterableArrayPattern30.symbols @@ -4,5 +4,5 @@ const [[k1, v1], [k2, v2]] = new Map([["", true], ["hello", true]]) >v1 : Symbol(v1, Decl(iterableArrayPattern30.ts, 0, 11)) >k2 : Symbol(k2, Decl(iterableArrayPattern30.ts, 0, 18)) >v2 : Symbol(v2, Decl(iterableArrayPattern30.ts, 0, 21)) ->Map : Symbol(Map, Decl(lib.d.ts, 1877, 1), Decl(lib.d.ts, 1900, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 4641, 1), Decl(lib.d.ts, 4664, 11)) diff --git a/tests/baselines/reference/iterableArrayPattern4.symbols b/tests/baselines/reference/iterableArrayPattern4.symbols index 10225e183e6cb..286cb04e45b03 100644 --- a/tests/baselines/reference/iterableArrayPattern4.symbols +++ b/tests/baselines/reference/iterableArrayPattern4.symbols @@ -37,9 +37,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern4.ts, 3, 27)) diff --git a/tests/baselines/reference/iterableArrayPattern9.symbols b/tests/baselines/reference/iterableArrayPattern9.symbols index 86c46812688fa..eb90bcbf321b2 100644 --- a/tests/baselines/reference/iterableArrayPattern9.symbols +++ b/tests/baselines/reference/iterableArrayPattern9.symbols @@ -32,9 +32,9 @@ class FooIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(FooIterator, Decl(iterableArrayPattern9.ts, 2, 27)) diff --git a/tests/baselines/reference/iterableContextualTyping1.symbols b/tests/baselines/reference/iterableContextualTyping1.symbols index ae99a4b52554e..7b85a66aef604 100644 --- a/tests/baselines/reference/iterableContextualTyping1.symbols +++ b/tests/baselines/reference/iterableContextualTyping1.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts === var iter: Iterable<(x: string) => number> = [s => s.length]; >iter : Symbol(iter, Decl(iterableContextualTyping1.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) >x : Symbol(x, Decl(iterableContextualTyping1.ts, 0, 20)) >s : Symbol(s, Decl(iterableContextualTyping1.ts, 0, 45)) >s.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) diff --git a/tests/baselines/reference/iteratorSpreadInArray.symbols b/tests/baselines/reference/iteratorSpreadInArray.symbols index c4a2459e26276..4c0f249595d99 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray.ts, 0, 36)) diff --git a/tests/baselines/reference/iteratorSpreadInArray11.symbols b/tests/baselines/reference/iteratorSpreadInArray11.symbols index c2fce062fb007..123d4fe1120f2 100644 --- a/tests/baselines/reference/iteratorSpreadInArray11.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray11.ts === var iter: Iterable; >iter : Symbol(iter, Decl(iteratorSpreadInArray11.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) var array = [...iter]; >array : Symbol(array, Decl(iteratorSpreadInArray11.ts, 1, 3)) diff --git a/tests/baselines/reference/iteratorSpreadInArray2.symbols b/tests/baselines/reference/iteratorSpreadInArray2.symbols index cdc7bb3e2bcb6..ba076380be058 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray2.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 5, 28)) @@ -22,9 +22,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray2.ts, 0, 59)) @@ -48,9 +48,9 @@ class NumberIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(NumberIterator, Decl(iteratorSpreadInArray2.ts, 13, 1)) diff --git a/tests/baselines/reference/iteratorSpreadInArray3.symbols b/tests/baselines/reference/iteratorSpreadInArray3.symbols index e4d1b508bb5d4..a5ab2e8a43455 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray3.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray3.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray3.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray3.ts, 0, 47)) diff --git a/tests/baselines/reference/iteratorSpreadInArray4.symbols b/tests/baselines/reference/iteratorSpreadInArray4.symbols index bd6760dd0aa21..f8cd1ade48d8f 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray4.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray4.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray4.ts, 5, 28)) @@ -21,9 +21,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray4.ts, 0, 42)) diff --git a/tests/baselines/reference/iteratorSpreadInArray7.symbols b/tests/baselines/reference/iteratorSpreadInArray7.symbols index d0bc97907526d..695cd69452400 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray7.symbols @@ -17,7 +17,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray7.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray7.ts, 6, 28)) @@ -26,9 +26,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInArray7.ts, 1, 38)) diff --git a/tests/baselines/reference/iteratorSpreadInCall11.symbols b/tests/baselines/reference/iteratorSpreadInCall11.symbols index a7e5d7b8919f8..c09a010c0b59d 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall11.symbols @@ -19,7 +19,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall11.ts, 6, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall11.ts, 7, 28)) @@ -28,9 +28,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall11.ts, 2, 42)) diff --git a/tests/baselines/reference/iteratorSpreadInCall12.symbols b/tests/baselines/reference/iteratorSpreadInCall12.symbols index 67b9e9e500daf..b627f5f3bd8cb 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall12.symbols @@ -22,7 +22,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 8, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 9, 28)) @@ -31,9 +31,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall12.ts, 4, 1)) @@ -57,9 +57,9 @@ class StringIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(StringIterator, Decl(iteratorSpreadInCall12.ts, 17, 1)) diff --git a/tests/baselines/reference/iteratorSpreadInCall3.symbols b/tests/baselines/reference/iteratorSpreadInCall3.symbols index 0c3c11c84f470..7f47bfcf2b5cf 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall3.symbols @@ -16,7 +16,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall3.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall3.ts, 6, 28)) @@ -25,9 +25,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall3.ts, 2, 32)) diff --git a/tests/baselines/reference/iteratorSpreadInCall5.symbols b/tests/baselines/reference/iteratorSpreadInCall5.symbols index 03faf4b593ea8..05db89decd3bc 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall5.symbols @@ -17,7 +17,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 6, 28)) @@ -26,9 +26,9 @@ class SymbolIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(SymbolIterator, Decl(iteratorSpreadInCall5.ts, 2, 43)) @@ -52,9 +52,9 @@ class StringIterator { } [Symbol.iterator]() { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) return this; >this : Symbol(StringIterator, Decl(iteratorSpreadInCall5.ts, 14, 1)) diff --git a/tests/baselines/reference/jsxHash.types b/tests/baselines/reference/jsxHash.types index e614ebd3e0b5c..6d413141ca624 100644 --- a/tests/baselines/reference/jsxHash.types +++ b/tests/baselines/reference/jsxHash.types @@ -3,18 +3,21 @@ var t02 = {0}#; >t02 : any >{0}# : any >a : any +>0 : number >a : any var t03 = #{0}; >t03 : any >#{0} : any >a : any +>0 : number >a : any var t04 = #{0}#; >t04 : any >#{0}# : any >a : any +>0 : number >a : any var t05 = #; diff --git a/tests/baselines/reference/jsxImportInAttribute.symbols b/tests/baselines/reference/jsxImportInAttribute.symbols index 8481771f085c4..845001b22c0aa 100644 --- a/tests/baselines/reference/jsxImportInAttribute.symbols +++ b/tests/baselines/reference/jsxImportInAttribute.symbols @@ -9,6 +9,7 @@ let x = Test; // emit test_1.default ; // ? >attr : Symbol(unknown) +>Test : Symbol(Test, Decl(consumer.tsx, 1, 6)) === tests/cases/compiler/component.d.ts === diff --git a/tests/baselines/reference/jsxImportInAttribute.types b/tests/baselines/reference/jsxImportInAttribute.types index 8dfbe292fe05d..8dc5c370fa84d 100644 --- a/tests/baselines/reference/jsxImportInAttribute.types +++ b/tests/baselines/reference/jsxImportInAttribute.types @@ -11,7 +11,7 @@ let x = Test; // emit test_1.default > : any >anything : any >attr : any ->Test : any +>Test : typeof Test === tests/cases/compiler/component.d.ts === diff --git a/tests/baselines/reference/jsxReactTestSuite.symbols b/tests/baselines/reference/jsxReactTestSuite.symbols index ba32994993957..1fe64cbfdd717 100644 --- a/tests/baselines/reference/jsxReactTestSuite.symbols +++ b/tests/baselines/reference/jsxReactTestSuite.symbols @@ -46,6 +46,8 @@ declare var hasOwnProperty:any;

{foo}
{bar}
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11)) +>foo : Symbol(foo, Decl(jsxReactTestSuite.tsx, 7, 11)) +>bar : Symbol(bar, Decl(jsxReactTestSuite.tsx, 8, 11)) >Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
@@ -159,6 +161,7 @@ var x = ; >Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11)) >x : Symbol(unknown) +>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 9, 11)) ; diff --git a/tests/baselines/reference/jsxReactTestSuite.types b/tests/baselines/reference/jsxReactTestSuite.types index db7ebf8d912dc..88c2c278e59a3 100644 --- a/tests/baselines/reference/jsxReactTestSuite.types +++ b/tests/baselines/reference/jsxReactTestSuite.types @@ -251,6 +251,7 @@ var x = >y : any ={2 } z />; +>2 : number >z : any Component : any >x : any >y : any +>2 : number ; > : any >Component : any >x : any >y : any +>2 : number >z : any ; > : any >Component : any >x : any +>1 : number >y : any @@ -306,6 +310,7 @@ var x = > : any >Component : any >x : any +>1 : number >y : any >z : any >z : any @@ -326,6 +331,7 @@ var x = >2 : number >z : any >z : any +>3 : number >Component : any diff --git a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt index 7445ab85a54c9..e8649cfb5672a 100644 --- a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt +++ b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.errors.txt @@ -1,11 +1,10 @@ -tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(7,30): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(10,30): error TS2345: Argument of type '(number | string)[]' is not assignable to parameter of type 'number[]'. Type 'number | string' is not assignable to type 'number'. Type 'string' is not assignable to type 'number'. tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): error TS2346: Supplied parameters do not match any signature of call target. -==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (3 errors) ==== +==== tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts (2 errors) ==== function map(xs: T[], f: (x: T) => U) { var ys: U[] = []; xs.forEach(x => ys.push(f(x))); @@ -13,8 +12,6 @@ tests/cases/compiler/mismatchedExplicitTypeParameterAndArgumentType.ts(11,11): e } var r0 = map([1, ""], (x) => x.toString()); - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. var r5 = map([1, ""], (x) => x.toString()); var r6 = map([1, ""], (x) => x.toString()); var r7 = map([1, ""], (x) => x.toString()); // error diff --git a/tests/baselines/reference/moduleResolutionNoResolve.js b/tests/baselines/reference/moduleResolutionNoResolve.js new file mode 100644 index 0000000000000..9f0537a5ad5c2 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionNoResolve.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/moduleResolutionNoResolve.ts] //// + +//// [a.ts] + +import a = require('./b'); + +//// [b.ts] +export var c = ''; + + +//// [a.js] +//// [b.js] +exports.c = ''; diff --git a/tests/baselines/reference/moduleResolutionNoResolve.symbols b/tests/baselines/reference/moduleResolutionNoResolve.symbols new file mode 100644 index 0000000000000..17ccfeab49680 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionNoResolve.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/a.ts === + +import a = require('./b'); +>a : Symbol(a, Decl(a.ts, 0, 0)) + +=== tests/cases/compiler/b.ts === +export var c = ''; +>c : Symbol(c, Decl(b.ts, 0, 10)) + diff --git a/tests/baselines/reference/moduleResolutionNoResolve.types b/tests/baselines/reference/moduleResolutionNoResolve.types new file mode 100644 index 0000000000000..3e96ed2b19762 --- /dev/null +++ b/tests/baselines/reference/moduleResolutionNoResolve.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/a.ts === + +import a = require('./b'); +>a : typeof a + +=== tests/cases/compiler/b.ts === +export var c = ''; +>c : string +>'' : string + diff --git a/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.symbols b/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.symbols index 4bddb6a1f71b0..9144d725efbfe 100644 --- a/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.symbols +++ b/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.symbols @@ -8,7 +8,7 @@ regexMatchList.forEach(match => ''.replace(match, '')); >regexMatchList : Symbol(regexMatchList, Decl(noImplicitAnyInContextuallyTypesFunctionParamter.ts, 1, 3)) >forEach : Symbol(Array.forEach, Decl(lib.d.ts, 1108, 95)) >match : Symbol(match, Decl(noImplicitAnyInContextuallyTypesFunctionParamter.ts, 2, 23)) ->''.replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) ->replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) +>''.replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) +>replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) >match : Symbol(match, Decl(noImplicitAnyInContextuallyTypesFunctionParamter.ts, 2, 23)) diff --git a/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.types b/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.types index 81fd614cb0e28..afe2ff7bd22e0 100644 --- a/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.types +++ b/tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.types @@ -14,9 +14,9 @@ regexMatchList.forEach(match => ''.replace(match, '')); >match => ''.replace(match, '') : (match: string) => string >match : string >''.replace(match, '') : string ->''.replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>''.replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >'' : string ->replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >match : string >'' : string diff --git a/tests/baselines/reference/nodeResolution1.js b/tests/baselines/reference/nodeResolution1.js new file mode 100644 index 0000000000000..3516342e3b22f --- /dev/null +++ b/tests/baselines/reference/nodeResolution1.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/nodeResolution1.ts] //// + +//// [a.ts] + +export var x = 1; + +//// [b.ts] +import y = require("./a"); + +//// [a.js] +exports.x = 1; +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution1.symbols b/tests/baselines/reference/nodeResolution1.symbols new file mode 100644 index 0000000000000..0cc98206e90fb --- /dev/null +++ b/tests/baselines/reference/nodeResolution1.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/b.ts === +import y = require("./a"); +>y : Symbol(y, Decl(b.ts, 0, 0)) + +=== tests/cases/compiler/a.ts === + +export var x = 1; +>x : Symbol(x, Decl(a.ts, 1, 10)) + diff --git a/tests/baselines/reference/nodeResolution1.types b/tests/baselines/reference/nodeResolution1.types new file mode 100644 index 0000000000000..4f29acfcc032d --- /dev/null +++ b/tests/baselines/reference/nodeResolution1.types @@ -0,0 +1,10 @@ +=== tests/cases/compiler/b.ts === +import y = require("./a"); +>y : typeof y + +=== tests/cases/compiler/a.ts === + +export var x = 1; +>x : number +>1 : number + diff --git a/tests/baselines/reference/nodeResolution2.js b/tests/baselines/reference/nodeResolution2.js new file mode 100644 index 0000000000000..a5935461088c9 --- /dev/null +++ b/tests/baselines/reference/nodeResolution2.js @@ -0,0 +1,10 @@ +//// [tests/cases/compiler/nodeResolution2.ts] //// + +//// [a.d.ts] + +export var x: number; + +//// [b.ts] +import y = require("a"); + +//// [b.js] diff --git a/tests/baselines/reference/nodeResolution2.symbols b/tests/baselines/reference/nodeResolution2.symbols new file mode 100644 index 0000000000000..643d285e7b8c6 --- /dev/null +++ b/tests/baselines/reference/nodeResolution2.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/b.ts === +import y = require("a"); +>y : Symbol(y, Decl(b.ts, 0, 0)) + +=== tests/cases/compiler/node_modules/a.d.ts === + +export var x: number; +>x : Symbol(x, Decl(a.d.ts, 1, 10)) + diff --git a/tests/baselines/reference/nodeResolution2.types b/tests/baselines/reference/nodeResolution2.types new file mode 100644 index 0000000000000..896af7f8bdaf6 --- /dev/null +++ b/tests/baselines/reference/nodeResolution2.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/b.ts === +import y = require("a"); +>y : typeof y + +=== tests/cases/compiler/node_modules/a.d.ts === + +export var x: number; +>x : number + diff --git a/tests/baselines/reference/nodeResolution3.js b/tests/baselines/reference/nodeResolution3.js new file mode 100644 index 0000000000000..6e0ec60832301 --- /dev/null +++ b/tests/baselines/reference/nodeResolution3.js @@ -0,0 +1,10 @@ +//// [tests/cases/compiler/nodeResolution3.ts] //// + +//// [index.d.ts] + +export var x: number; + +//// [a.ts] +import y = require("b"); + +//// [a.js] diff --git a/tests/baselines/reference/nodeResolution3.symbols b/tests/baselines/reference/nodeResolution3.symbols new file mode 100644 index 0000000000000..0fca588676f1c --- /dev/null +++ b/tests/baselines/reference/nodeResolution3.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/a.ts === +import y = require("b"); +>y : Symbol(y, Decl(a.ts, 0, 0)) + +=== tests/cases/compiler/node_modules/b/index.d.ts === + +export var x: number; +>x : Symbol(x, Decl(index.d.ts, 1, 10)) + diff --git a/tests/baselines/reference/nodeResolution3.types b/tests/baselines/reference/nodeResolution3.types new file mode 100644 index 0000000000000..82a1ccb27d34a --- /dev/null +++ b/tests/baselines/reference/nodeResolution3.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/a.ts === +import y = require("b"); +>y : typeof y + +=== tests/cases/compiler/node_modules/b/index.d.ts === + +export var x: number; +>x : number + diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.js b/tests/baselines/reference/objectTypesWithOptionalProperties2.js index cf0d113c244a0..e5ffbf09c10ca 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.js +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.js @@ -42,5 +42,6 @@ var C2 = (function () { return C2; })(); var b = { - x: function () { }, 1: // error + x: function () { }, 1: // error + // error }; diff --git a/tests/baselines/reference/out-flag.js.map b/tests/baselines/reference/out-flag.js.map index ec4c14aac2b19..1d33d382ebacb 100644 --- a/tests/baselines/reference/out-flag.js.map +++ b/tests/baselines/reference/out-flag.js.map @@ -1,2 +1,2 @@ //// [out-flag.js.map] -{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count","MyClass.SetCount"],"mappings":"AAAA,eAAe;AAGf,AADA,oBAAoB;;IACpBA;IAYAC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBG,EAAEA;IACNA,CAACA;IACLH,cAACA;AAADA,CAACA,AAZD,IAYC"} \ No newline at end of file +{"version":3,"file":"out-flag.js","sourceRoot":"","sources":["out-flag.ts"],"names":["MyClass","MyClass.constructor","MyClass.Count","MyClass.SetCount"],"mappings":"AAAA,eAAe;AAEf,oBAAoB;AACpB;IAAAA;IAYAC,CAACA;IAVGD,uBAAuBA;IAChBA,uBAAKA,GAAZA;QAEIE,MAAMA,CAACA,EAAEA,CAACA;IACdA,CAACA;IAEMF,0BAAQA,GAAfA,UAAgBA,KAAaA;QAEzBG,EAAEA;IACNA,CAACA;IACLH,cAACA;AAADA,CAACA,AAZD,IAYC"} \ No newline at end of file diff --git a/tests/baselines/reference/out-flag.sourcemap.txt b/tests/baselines/reference/out-flag.sourcemap.txt index 0e69e34d62fad..397cfe346a386 100644 --- a/tests/baselines/reference/out-flag.sourcemap.txt +++ b/tests/baselines/reference/out-flag.sourcemap.txt @@ -19,25 +19,26 @@ sourceFile:out-flag.ts --- >>>// my class comments 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^-> 1-> > - >// my class comments > -2 > -3 >// my class comments -1->Emitted(2, 1) Source(4, 1) + SourceIndex(0) -2 >Emitted(2, 1) Source(3, 1) + SourceIndex(0) -3 >Emitted(2, 21) Source(3, 21) + SourceIndex(0) +2 >// my class comments +1->Emitted(2, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(2, 21) Source(3, 21) + SourceIndex(0) --- >>>var MyClass = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(3, 1) Source(4, 1) + SourceIndex(0) +--- >>> function MyClass() { 1->^^^^ 2 > ^^-> -1-> - > +1-> 1->Emitted(4, 5) Source(4, 1) + SourceIndex(0) name (MyClass) --- >>> } diff --git a/tests/baselines/reference/out-flag2.js b/tests/baselines/reference/out-flag2.js new file mode 100644 index 0000000000000..e2a30f169e371 --- /dev/null +++ b/tests/baselines/reference/out-flag2.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/out-flag2.ts] //// + +//// [a.ts] + +class A { } + +//// [b.ts] +class B { } + +//// [c.js] +var A = (function () { + function A() { + } + return A; +})(); +var B = (function () { + function B() { + } + return B; +})(); +//# sourceMappingURL=c.js.map + +//// [c.d.ts] +declare class A { +} +declare class B { +} diff --git a/tests/baselines/reference/out-flag2.js.map b/tests/baselines/reference/out-flag2.js.map new file mode 100644 index 0000000000000..c1523e7578492 --- /dev/null +++ b/tests/baselines/reference/out-flag2.js.map @@ -0,0 +1,2 @@ +//// [c.js.map] +{"version":3,"file":"c.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":"AACA;IAAAA;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW;ACDX;IAAAE;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/out-flag2.sourcemap.txt b/tests/baselines/reference/out-flag2.sourcemap.txt new file mode 100644 index 0000000000000..6a67e61bc918d --- /dev/null +++ b/tests/baselines/reference/out-flag2.sourcemap.txt @@ -0,0 +1,104 @@ +=================================================================== +JsFile: c.js +mapUrl: c.js.map +sourceRoot: +sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:c.js +sourceFile:tests/cases/compiler/a.ts +------------------------------------------------------------------- +>>>var A = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(2, 5) Source(2, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class A { +2 > } +1->Emitted(3, 5) Source(2, 11) + SourceIndex(0) name (A.constructor) +2 >Emitted(3, 6) Source(2, 12) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(4, 5) Source(2, 11) + SourceIndex(0) name (A) +2 >Emitted(4, 13) Source(2, 12) + SourceIndex(0) name (A) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class A { } +1 >Emitted(5, 1) Source(2, 11) + SourceIndex(0) name (A) +2 >Emitted(5, 2) Source(2, 12) + SourceIndex(0) name (A) +3 >Emitted(5, 2) Source(2, 1) + SourceIndex(0) +4 >Emitted(5, 6) Source(2, 12) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:c.js +sourceFile:tests/cases/compiler/b.ts +------------------------------------------------------------------- +>>>var B = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(6, 1) Source(1, 1) + SourceIndex(1) +--- +>>> function B() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(7, 5) Source(1, 1) + SourceIndex(1) name (B) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class B { +2 > } +1->Emitted(8, 5) Source(1, 11) + SourceIndex(1) name (B.constructor) +2 >Emitted(8, 6) Source(1, 12) + SourceIndex(1) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(9, 5) Source(1, 11) + SourceIndex(1) name (B) +2 >Emitted(9, 13) Source(1, 12) + SourceIndex(1) name (B) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class B { } +1 >Emitted(10, 1) Source(1, 11) + SourceIndex(1) name (B) +2 >Emitted(10, 2) Source(1, 12) + SourceIndex(1) name (B) +3 >Emitted(10, 2) Source(1, 1) + SourceIndex(1) +4 >Emitted(10, 6) Source(1, 12) + SourceIndex(1) +--- +>>>//# sourceMappingURL=c.js.map \ No newline at end of file diff --git a/tests/baselines/reference/out-flag2.symbols b/tests/baselines/reference/out-flag2.symbols new file mode 100644 index 0000000000000..1bca057c58030 --- /dev/null +++ b/tests/baselines/reference/out-flag2.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/a.ts === + +class A { } +>A : Symbol(A, Decl(a.ts, 0, 0)) + +=== tests/cases/compiler/b.ts === +class B { } +>B : Symbol(B, Decl(b.ts, 0, 0)) + diff --git a/tests/baselines/reference/out-flag2.types b/tests/baselines/reference/out-flag2.types new file mode 100644 index 0000000000000..5a13642f99f50 --- /dev/null +++ b/tests/baselines/reference/out-flag2.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/a.ts === + +class A { } +>A : A + +=== tests/cases/compiler/b.ts === +class B { } +>B : B + diff --git a/tests/baselines/reference/out-flag3.errors.txt b/tests/baselines/reference/out-flag3.errors.txt new file mode 100644 index 0000000000000..6b7dda7c962b9 --- /dev/null +++ b/tests/baselines/reference/out-flag3.errors.txt @@ -0,0 +1,12 @@ +error TS5053: Option 'out' cannot be specified with option 'outFile'. + + +!!! error TS5053: Option 'out' cannot be specified with option 'outFile'. +==== tests/cases/compiler/a.ts (0 errors) ==== + + // --out and --outFile error + + class A { } + +==== tests/cases/compiler/b.ts (0 errors) ==== + class B { } \ No newline at end of file diff --git a/tests/baselines/reference/out-flag3.js b/tests/baselines/reference/out-flag3.js new file mode 100644 index 0000000000000..8327c3429d3ae --- /dev/null +++ b/tests/baselines/reference/out-flag3.js @@ -0,0 +1,30 @@ +//// [tests/cases/compiler/out-flag3.ts] //// + +//// [a.ts] + +// --out and --outFile error + +class A { } + +//// [b.ts] +class B { } + +//// [c.js] +// --out and --outFile error +var A = (function () { + function A() { + } + return A; +})(); +var B = (function () { + function B() { + } + return B; +})(); +//# sourceMappingURL=c.js.map + +//// [c.d.ts] +declare class A { +} +declare class B { +} diff --git a/tests/baselines/reference/out-flag3.js.map b/tests/baselines/reference/out-flag3.js.map new file mode 100644 index 0000000000000..a52d66589c7ac --- /dev/null +++ b/tests/baselines/reference/out-flag3.js.map @@ -0,0 +1,2 @@ +//// [c.js.map] +{"version":3,"file":"c.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":["A","A.constructor","B","B.constructor"],"mappings":"AACA,4BAA4B;AAE5B;IAAAA;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW;ACHX;IAAAE;IAAUC,CAACA;IAADD,QAACA;AAADA,CAACA,AAAX,IAAW"} \ No newline at end of file diff --git a/tests/baselines/reference/out-flag3.sourcemap.txt b/tests/baselines/reference/out-flag3.sourcemap.txt new file mode 100644 index 0000000000000..c30c9f63020cc --- /dev/null +++ b/tests/baselines/reference/out-flag3.sourcemap.txt @@ -0,0 +1,114 @@ +=================================================================== +JsFile: c.js +mapUrl: c.js.map +sourceRoot: +sources: tests/cases/compiler/a.ts,tests/cases/compiler/b.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:c.js +sourceFile:tests/cases/compiler/a.ts +------------------------------------------------------------------- +>>>// --out and --outFile error +1 > +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > + > +2 >// --out and --outFile error +1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(1, 29) Source(2, 29) + SourceIndex(0) +--- +>>>var A = (function () { +1 > +2 >^^^^^^^^^^^^^^^^^^^-> +1 > + > + > +1 >Emitted(2, 1) Source(4, 1) + SourceIndex(0) +--- +>>> function A() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(3, 5) Source(4, 1) + SourceIndex(0) name (A) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class A { +2 > } +1->Emitted(4, 5) Source(4, 11) + SourceIndex(0) name (A.constructor) +2 >Emitted(4, 6) Source(4, 12) + SourceIndex(0) name (A.constructor) +--- +>>> return A; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(5, 5) Source(4, 11) + SourceIndex(0) name (A) +2 >Emitted(5, 13) Source(4, 12) + SourceIndex(0) name (A) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class A { } +1 >Emitted(6, 1) Source(4, 11) + SourceIndex(0) name (A) +2 >Emitted(6, 2) Source(4, 12) + SourceIndex(0) name (A) +3 >Emitted(6, 2) Source(4, 1) + SourceIndex(0) +4 >Emitted(6, 6) Source(4, 12) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:c.js +sourceFile:tests/cases/compiler/b.ts +------------------------------------------------------------------- +>>>var B = (function () { +1-> +2 >^^^^^^^^^^^^^^^^^^^-> +1-> +1->Emitted(7, 1) Source(1, 1) + SourceIndex(1) +--- +>>> function B() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(8, 5) Source(1, 1) + SourceIndex(1) name (B) +--- +>>> } +1->^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1->class B { +2 > } +1->Emitted(9, 5) Source(1, 11) + SourceIndex(1) name (B.constructor) +2 >Emitted(9, 6) Source(1, 12) + SourceIndex(1) name (B.constructor) +--- +>>> return B; +1->^^^^ +2 > ^^^^^^^^ +1-> +2 > } +1->Emitted(10, 5) Source(1, 11) + SourceIndex(1) name (B) +2 >Emitted(10, 13) Source(1, 12) + SourceIndex(1) name (B) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class B { } +1 >Emitted(11, 1) Source(1, 11) + SourceIndex(1) name (B) +2 >Emitted(11, 2) Source(1, 12) + SourceIndex(1) name (B) +3 >Emitted(11, 2) Source(1, 1) + SourceIndex(1) +4 >Emitted(11, 6) Source(1, 12) + SourceIndex(1) +--- +>>>//# sourceMappingURL=c.js.map \ No newline at end of file diff --git a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.symbols b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.symbols index 815f977d60508..bc2bd0785b978 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.symbols +++ b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.symbols @@ -14,9 +14,9 @@ module Bugs { var result= message.replace(/\{(\d+)\}/g, function(match, ...rest) { >result : Symbol(result, Decl(overloadResolutionOverNonCTLambdas.ts, 6, 7)) ->message.replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) +>message.replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) >message : Symbol(message, Decl(overloadResolutionOverNonCTLambdas.ts, 5, 16)) ->replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) +>replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) >match : Symbol(match, Decl(overloadResolutionOverNonCTLambdas.ts, 6, 55)) >rest : Symbol(rest, Decl(overloadResolutionOverNonCTLambdas.ts, 6, 61)) diff --git a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.types b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.types index f62bb4e83738f..066015389d220 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.types +++ b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.types @@ -15,9 +15,9 @@ module Bugs { var result= message.replace(/\{(\d+)\}/g, function(match, ...rest) { >result : string >message.replace(/\{(\d+)\}/g, function(match, ...rest) { var index= rest[0]; return typeof args[index] !== 'undefined' ? args[index] : match; }) : string ->message.replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>message.replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >message : string ->replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >/\{(\d+)\}/g : RegExp >function(match, ...rest) { var index= rest[0]; return typeof args[index] !== 'undefined' ? args[index] : match; } : (match: string, ...rest: any[]) => any >match : string diff --git a/tests/baselines/reference/parserSymbolProperty1.symbols b/tests/baselines/reference/parserSymbolProperty1.symbols index 5d97b2d7a017f..60e04fe09e03a 100644 --- a/tests/baselines/reference/parserSymbolProperty1.symbols +++ b/tests/baselines/reference/parserSymbolProperty1.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(parserSymbolProperty1.ts, 0, 0)) [Symbol.iterator]: string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) } diff --git a/tests/baselines/reference/parserSymbolProperty2.symbols b/tests/baselines/reference/parserSymbolProperty2.symbols index 69764d70b4531..5004e539d315e 100644 --- a/tests/baselines/reference/parserSymbolProperty2.symbols +++ b/tests/baselines/reference/parserSymbolProperty2.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(parserSymbolProperty2.ts, 0, 0)) [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) } diff --git a/tests/baselines/reference/parserSymbolProperty3.symbols b/tests/baselines/reference/parserSymbolProperty3.symbols index c42bb3abb8343..0ad3e43fbad9f 100644 --- a/tests/baselines/reference/parserSymbolProperty3.symbols +++ b/tests/baselines/reference/parserSymbolProperty3.symbols @@ -3,7 +3,7 @@ declare class C { >C : Symbol(C, Decl(parserSymbolProperty3.ts, 0, 0)) [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) } diff --git a/tests/baselines/reference/parserSymbolProperty4.symbols b/tests/baselines/reference/parserSymbolProperty4.symbols index ba93afde83716..de4adbf5bc132 100644 --- a/tests/baselines/reference/parserSymbolProperty4.symbols +++ b/tests/baselines/reference/parserSymbolProperty4.symbols @@ -3,7 +3,7 @@ declare class C { >C : Symbol(C, Decl(parserSymbolProperty4.ts, 0, 0)) [Symbol.toPrimitive]: string; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) } diff --git a/tests/baselines/reference/parserSymbolProperty5.symbols b/tests/baselines/reference/parserSymbolProperty5.symbols index 4829677f5160c..9857e86558c70 100644 --- a/tests/baselines/reference/parserSymbolProperty5.symbols +++ b/tests/baselines/reference/parserSymbolProperty5.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty5.ts, 0, 0)) [Symbol.toPrimitive]: string; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) } diff --git a/tests/baselines/reference/parserSymbolProperty6.symbols b/tests/baselines/reference/parserSymbolProperty6.symbols index 793b925b382dd..286c0df602bfc 100644 --- a/tests/baselines/reference/parserSymbolProperty6.symbols +++ b/tests/baselines/reference/parserSymbolProperty6.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty6.ts, 0, 0)) [Symbol.toStringTag]: string = ""; ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) } diff --git a/tests/baselines/reference/parserSymbolProperty7.symbols b/tests/baselines/reference/parserSymbolProperty7.symbols index e1b85f2a3b996..7b299034931f4 100644 --- a/tests/baselines/reference/parserSymbolProperty7.symbols +++ b/tests/baselines/reference/parserSymbolProperty7.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty7.ts, 0, 0)) [Symbol.toStringTag](): void { } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) } diff --git a/tests/baselines/reference/parserSymbolProperty8.symbols b/tests/baselines/reference/parserSymbolProperty8.symbols index 05b002eb56940..eaa820b20767c 100644 --- a/tests/baselines/reference/parserSymbolProperty8.symbols +++ b/tests/baselines/reference/parserSymbolProperty8.symbols @@ -3,7 +3,7 @@ var x: { >x : Symbol(x, Decl(parserSymbolProperty8.ts, 0, 3)) [Symbol.toPrimitive](): string ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) } diff --git a/tests/baselines/reference/parserSymbolProperty9.symbols b/tests/baselines/reference/parserSymbolProperty9.symbols index 774eb2dcc4b34..c0142e5cbbb25 100644 --- a/tests/baselines/reference/parserSymbolProperty9.symbols +++ b/tests/baselines/reference/parserSymbolProperty9.symbols @@ -3,7 +3,7 @@ var x: { >x : Symbol(x, Decl(parserSymbolProperty9.ts, 0, 3)) [Symbol.toPrimitive]: string ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) } diff --git a/tests/baselines/reference/parserindenter.js b/tests/baselines/reference/parserindenter.js index 511e75ea1350c..a60eadc66a1da 100644 --- a/tests/baselines/reference/parserindenter.js +++ b/tests/baselines/reference/parserindenter.js @@ -890,7 +890,7 @@ var Formatting; return result; }; Indenter.GetIndentSizeFromIndentText = function (indentText, editorOptions) { - return GetIndentSizeFromText(indentText, editorOptions, false); + return GetIndentSizeFromText(indentText, editorOptions, /*includeNonIndentChars:*/ false); }; Indenter.GetIndentSizeFromText = function (text, editorOptions, includeNonIndentChars) { var indentSize = 0; @@ -1174,7 +1174,7 @@ var Formatting; return null; var origIndentText = this.snapshot.GetText(new Span(indentEditInfo.OrigIndentPosition, indentEditInfo.OrigIndentLength())); var newIndentText = indentEditInfo.Indentation(); - var origIndentSize = Indenter.GetIndentSizeFromText(origIndentText, this.editorOptions, true); + var origIndentSize = Indenter.GetIndentSizeFromText(origIndentText, this.editorOptions, /*includeNonIndentChars*/ true); var newIndentSize = Indenter.GetIndentSizeFromIndentText(newIndentText, this.editorOptions); // Check the child's position whether it's before the parent position // if so indent the child based on the first token on the line as opposed to the parent position diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt index c4ad5e69c83d8..dc355a9c199d4 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt +++ b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.errors.txt @@ -1,14 +1,15 @@ internal2.ts(2,21): error TS1147: Import declarations in a namespace cannot reference a module. -internal2.ts(2,21): error TS2307: Cannot find module 'external2'. -==== internal2.ts (2 errors) ==== +==== external2.ts (0 errors) ==== + export function square(x: number) { + return (x * x); + } +==== internal2.ts (1 errors) ==== module outer { import g = require("external2") ~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'external2'. export var a = g.square(5); export var b = "foo"; } \ No newline at end of file diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.json b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.json index 8febea7a2eb82..1408030c706bb 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.json +++ b/tests/baselines/reference/project/intReferencingExtAndInt/amd/intReferencingExtAndInt.json @@ -6,9 +6,11 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "external2.ts", "internal2.ts" ], "emittedFiles": [ + "external2.js", "internal2.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt index c4ad5e69c83d8..dc355a9c199d4 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt +++ b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.errors.txt @@ -1,14 +1,15 @@ internal2.ts(2,21): error TS1147: Import declarations in a namespace cannot reference a module. -internal2.ts(2,21): error TS2307: Cannot find module 'external2'. -==== internal2.ts (2 errors) ==== +==== external2.ts (0 errors) ==== + export function square(x: number) { + return (x * x); + } +==== internal2.ts (1 errors) ==== module outer { import g = require("external2") ~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'external2'. export var a = g.square(5); export var b = "foo"; } \ No newline at end of file diff --git a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.json b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.json index 8febea7a2eb82..1408030c706bb 100644 --- a/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.json +++ b/tests/baselines/reference/project/intReferencingExtAndInt/node/intReferencingExtAndInt.json @@ -6,9 +6,11 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "external2.ts", "internal2.ts" ], "emittedFiles": [ + "external2.js", "internal2.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt index bafcc39f48d33..9cd0dd7b0cf0a 100644 --- a/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt +++ b/tests/baselines/reference/project/invalidRootFile/amd/invalidRootFile.errors.txt @@ -1,6 +1,6 @@ error TS6053: File 'a.ts' not found. -error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.tsx', '.ts', '.d.ts'. +error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. !!! error TS6053: File 'a.ts' not found. -!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.tsx', '.ts', '.d.ts'. \ No newline at end of file +!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. \ No newline at end of file diff --git a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt index bafcc39f48d33..9cd0dd7b0cf0a 100644 --- a/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt +++ b/tests/baselines/reference/project/invalidRootFile/node/invalidRootFile.errors.txt @@ -1,6 +1,6 @@ error TS6053: File 'a.ts' not found. -error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.tsx', '.ts', '.d.ts'. +error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. !!! error TS6053: File 'a.ts' not found. -!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.tsx', '.ts', '.d.ts'. \ No newline at end of file +!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts'. \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/mapRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/mapRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt index 401347e92f12f..8e555fb23f217 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/mapRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/mapRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:../test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/test.js.map index af309c1684b7a..1602fe4d4e088 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/mapRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/mapRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt index 8d9c30d628864..240277bfc7004 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/mapRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/mapRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:../test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/test.js.map index af309c1684b7a..1602fe4d4e088 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 44306f12661c8..1a530c850e242 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:../test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index af309c1684b7a..1602fe4d4e088 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 55483177e5bcd..511832f1de058 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:../test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index af309c1684b7a..1602fe4d4e088 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index d1972c6fac718..a1d591a049765 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 8a778d7b74bdb..133c266cc9e22 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:../test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index d1972c6fac718..a1d591a049765 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index dfc6d1e756f06..0b573b627cf41 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:../test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index eb72bfc3c0299..4f87045fd2524 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 534b9497bda3c..a9e2e3f0e3ced 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:../test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index eb72bfc3c0299..4f87045fd2524 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 71ac223414299..c4c267ec39510 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:../test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/mapRootAbsolutePathMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/mapRootAbsolutePathMultifolderNoOutdir.sourcemap.txt index 9d64326a562ee..f630a92b4a99d 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/mapRootAbsolutePathMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/mapRootAbsolutePathMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/test.js.map index b6fc8f2562707..05ee1332d71ef 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/mapRootAbsolutePathMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/mapRootAbsolutePathMultifolderNoOutdir.sourcemap.txt index 9d64326a562ee..f630a92b4a99d 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/mapRootAbsolutePathMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/mapRootAbsolutePathMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/test.js.map index b6fc8f2562707..05ee1332d71ef 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt index d83cb1fe788f6..74b8b777ec312 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map index b6fc8f2562707..05ee1332d71ef 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt index d83cb1fe788f6..74b8b777ec312 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/mapRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map index b6fc8f2562707..05ee1332d71ef 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/bin/test.js.map index 8df103744b531..37b77beb154fa 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt index 66573712ce778..69830c04b5641 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/amd/mapRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:../test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/bin/test.js.map index 8df103744b531..37b77beb154fa 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt index 66573712ce778..69830c04b5641 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathMultifolderSpecifyOutputFile/node/mapRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:../test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/mapRootAbsolutePathSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/mapRootAbsolutePathSimpleNoOutdir.sourcemap.txt index ad89f7cfe8614..86dae9982ec27 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/mapRootAbsolutePathSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/mapRootAbsolutePathSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/test.js.map index 08a7411226ae3..230b0e3381744 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/mapRootAbsolutePathSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/mapRootAbsolutePathSimpleNoOutdir.sourcemap.txt index ad89f7cfe8614..86dae9982ec27 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/mapRootAbsolutePathSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/mapRootAbsolutePathSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/test.js.map index 08a7411226ae3..230b0e3381744 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt index fbca4c774c770..84f8b2e886a2e 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/mapRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 08a7411226ae3..230b0e3381744 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt index fbca4c774c770..84f8b2e886a2e 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/mapRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map index 08a7411226ae3..230b0e3381744 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/bin/test.js.map index f358b98d465d7..b7b29ed1cf834 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/mapRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/mapRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt index ca11421c73367..e020abba5a5b9 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/mapRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/amd/mapRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/bin/test.js.map index f358b98d465d7..b7b29ed1cf834 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt index ca11421c73367..e020abba5a5b9 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSimpleSpecifyOutputFile/node/mapRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/mapRootAbsolutePathSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/mapRootAbsolutePathSubfolderNoOutdir.sourcemap.txt index 2c8142a51efdb..702f520b4a6a1 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/mapRootAbsolutePathSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/mapRootAbsolutePathSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/test.js.map index 1d5372ad9c9d1..cba32efbabea0 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/mapRootAbsolutePathSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/mapRootAbsolutePathSubfolderNoOutdir.sourcemap.txt index 2c8142a51efdb..702f520b4a6a1 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/mapRootAbsolutePathSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/mapRootAbsolutePathSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/test.js.map index 1d5372ad9c9d1..cba32efbabea0 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt index b87a91089b367..68ca3d32ac991 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 1d5372ad9c9d1..cba32efbabea0 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt index b87a91089b367..68ca3d32ac991 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/mapRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 1d5372ad9c9d1..cba32efbabea0 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/bin/test.js.map index 6882b70c3898a..91ea14b3da422 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt index cfa708b107d19..a82ab38507bc8 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/amd/mapRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/bin/test.js.map index 6882b70c3898a..91ea14b3da422 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt index cfa708b107d19..a82ab38507bc8 100644 --- a/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootAbsolutePathSubfolderSpecifyOutputFile/node/mapRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/mapRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/mapRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt index c4ea7bd21236a..e6c67f2d66a12 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/mapRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/mapRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/test.js.map index 515473b17f7d2..3fcfc31e4d1be 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/mapRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/mapRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt index 0eed3e7d5bab2..ad208f9375c4f 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/mapRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/mapRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/test.js.map index 515473b17f7d2..3fcfc31e4d1be 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 1fdab4bbb568a..181b1b84b5f27 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 515473b17f7d2..3fcfc31e4d1be 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 129d326ecacae..4230c8e6366f1 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 515473b17f7d2..3fcfc31e4d1be 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 9d7accaa452b2..b63911a2bc886 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index e5fd70c64348b..f1cc6df9de8b0 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 9d7accaa452b2..b63911a2bc886 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 2fc592160a1da..0a373a2035952 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFile/node/mapRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 1b716998db305..630508cb9f884 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 78467c99eccde..fd08e128cfe51 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 1b716998db305..630508cb9f884 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../outputdir_mixed_subfolder/ref/m1.ts","../outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 7603a4ca2b0da..eb9ad2993b2a7 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/mapRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:../outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:../outputdir_mixed_subfolder/test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/mapRootRelativePathMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/mapRootRelativePathMultifolderNoOutdir.sourcemap.txt index a0f444928eaa3..f820fb19c6506 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/mapRootRelativePathMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/mapRootRelativePathMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../projects/outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/test.js.map index b6c5ca846815a..ee5a589cb6289 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/mapRootRelativePathMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/mapRootRelativePathMultifolderNoOutdir.sourcemap.txt index a0f444928eaa3..f820fb19c6506 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/mapRootRelativePathMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/mapRootRelativePathMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../projects/outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/test.js.map index b6c5ca846815a..ee5a589cb6289 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt index ff91d92f2c999..f9b0d9fd57ef6 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/mapRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../projects/outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map index b6c5ca846815a..ee5a589cb6289 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/mapRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/mapRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt index ff91d92f2c999..f9b0d9fd57ef6 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/mapRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/mapRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../projects/outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map index b6c5ca846815a..ee5a589cb6289 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map index fdcfeeef82a7c..03cefb2f8d3fc 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_multifolder/ref/m1.ts","../outputdir_multifolder_ref/m2.ts","../outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_multifolder/ref/m1.ts","../outputdir_multifolder_ref/m2.ts","../outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt index ebe3cd999ae8b..d173bd36fb20a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/amd/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:../outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:../outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map index fdcfeeef82a7c..03cefb2f8d3fc 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_multifolder/ref/m1.ts","../outputdir_multifolder_ref/m2.ts","../outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_multifolder/ref/m1.ts","../outputdir_multifolder_ref/m2.ts","../outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt index ebe3cd999ae8b..d173bd36fb20a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathMultifolderSpecifyOutputFile/node/mapRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:../outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:../outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/mapRootRelativePathSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/mapRootRelativePathSimpleNoOutdir.sourcemap.txt index 1af999bf589b2..880f12ff46171 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/mapRootRelativePathSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/mapRootRelativePathSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/test.js.map index ee9a236558d6f..bb43574904809 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/mapRootRelativePathSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/mapRootRelativePathSimpleNoOutdir.sourcemap.txt index 1af999bf589b2..880f12ff46171 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/mapRootRelativePathSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/mapRootRelativePathSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/test.js.map index ee9a236558d6f..bb43574904809 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/mapRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/mapRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt index f62798ba3fe90..3ac5b5906405d 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/mapRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/mapRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map index ee9a236558d6f..bb43574904809 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/mapRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/mapRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt index f62798ba3fe90..3ac5b5906405d 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/mapRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/mapRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map index ee9a236558d6f..bb43574904809 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/bin/test.js.map index e2b612e58515e..11bf13c6ac81c 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/m1.ts","../outputdir_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/m1.ts","../outputdir_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/mapRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/mapRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt index 0c75ab9d5e151..452ad2eb84115 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/mapRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/amd/mapRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/bin/test.js.map index e2b612e58515e..11bf13c6ac81c 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/m1.ts","../outputdir_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_simple/m1.ts","../outputdir_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt index 0c75ab9d5e151..452ad2eb84115 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSimpleSpecifyOutputFile/node/mapRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/mapRootRelativePathSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/mapRootRelativePathSubfolderNoOutdir.sourcemap.txt index 3ec9d9c435c5f..87f1e589a1251 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/mapRootRelativePathSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/mapRootRelativePathSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/test.js.map index f1475afcba78b..fe7aaf2252b05 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/mapRootRelativePathSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/mapRootRelativePathSubfolderNoOutdir.sourcemap.txt index 3ec9d9c435c5f..87f1e589a1251 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/mapRootRelativePathSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/mapRootRelativePathSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/test.js.map index f1475afcba78b..fe7aaf2252b05 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt index 0ff5484326638..f68430b295d2a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/mapRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index f1475afcba78b..fe7aaf2252b05 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/mapRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/mapRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt index 0ff5484326638..f68430b295d2a 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/mapRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/mapRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index f1475afcba78b..fe7aaf2252b05 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/bin/test.js.map index 1760e9f41247e..9e7077cbe2511 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/ref/m1.ts","../outputdir_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/ref/m1.ts","../outputdir_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/mapRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/mapRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt index 3bad00b19d783..8c4bedb4b3005 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/mapRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/amd/mapRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/bin/test.js.map index 1760e9f41247e..9e7077cbe2511 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/ref/m1.ts","../outputdir_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../outputdir_subfolder/ref/m1.ts","../outputdir_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt index 3bad00b19d783..8c4bedb4b3005 100644 --- a/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/mapRootRelativePathSubfolderSpecifyOutputFile/node/mapRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt index bef02272064b5..44d2c93d9a596 100644 --- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/amd/mapRootSourceRootWithNoSourceMapOption.errors.txt @@ -1,9 +1,9 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. +error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. +!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt index bef02272064b5..44d2c93d9a596 100644 --- a/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootSourceRootWithNoSourceMapOption/node/mapRootSourceRootWithNoSourceMapOption.errors.txt @@ -1,9 +1,9 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. +error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. +!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt index d00f552ef9749..97e3ed02cf915 100644 --- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/amd/mapRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt index d00f552ef9749..97e3ed02cf915 100644 --- a/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/mapRootWithNoSourceMapOption/node/mapRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5038: Option 'mapRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'mapRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/maprootUrlMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/maprootUrlMixedSubfolderNoOutdir.sourcemap.txt index c13865cf8f3e7..7c797a023a2ff 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/maprootUrlMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/maprootUrlMixedSubfolderNoOutdir.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/test.js.map index 5b6ec16659ff2..767d260e0b828 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/maprootUrlMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/maprootUrlMixedSubfolderNoOutdir.sourcemap.txt index 0b663f820bb90..6aecdcd084ae7 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/maprootUrlMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/maprootUrlMixedSubfolderNoOutdir.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/test.js.map index 5b6ec16659ff2..767d260e0b828 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index e0f4f03c27a45..06b8e768334c6 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 5b6ec16659ff2..767d260e0b828 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 96f7d6f45aad3..468e5d2338b7f 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 5b6ec16659ff2..767d260e0b828 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 420891e501989..df57785d945b7 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 26d86253ec1ab..0c806666ef01a 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 420891e501989..df57785d945b7 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 0510b7e7e3376..aede30c6f7386 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index e0b70849bc151..e7042dca90aa3 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 00fddd7206ef4..5637274312dc0 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index e0b70849bc151..e7042dca90aa3 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_mixed_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 9d9bdbe17a2b0..fa3d551306116 100644 --- a/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:file:///tests/cases/projects/outputdir_mixed_subfolder/test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/maprootUrlMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/maprootUrlMultifolderNoOutdir.sourcemap.txt index a2fc3dfe05ebc..ceda6b4c058ad 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/maprootUrlMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/maprootUrlMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/test.js.map index 06903d6fc5126..04ab805bfcb24 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/maprootUrlMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/maprootUrlMultifolderNoOutdir.sourcemap.txt index a2fc3dfe05ebc..ceda6b4c058ad 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/maprootUrlMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/maprootUrlMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/test.js.map index 06903d6fc5126..04ab805bfcb24 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMultifolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt index 3bbfa8afdfa45..2bf3e6591183b 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map index 06903d6fc5126..04ab805bfcb24 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt index 3bbfa8afdfa45..2bf3e6591183b 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map index 06903d6fc5126..04ab805bfcb24 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map index 06f3e72443dcf..aecd97d513692 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/ref/m1.ts","file:///tests/cases/projects/outputdir_multifolder_ref/m2.ts","file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/ref/m1.ts","file:///tests/cases/projects/outputdir_multifolder_ref/m2.ts","file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/maprootUrlMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/maprootUrlMultifolderSpecifyOutputFile.sourcemap.txt index f889da36fe60b..344b620620d79 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/maprootUrlMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/amd/maprootUrlMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map index 06f3e72443dcf..aecd97d513692 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/ref/m1.ts","file:///tests/cases/projects/outputdir_multifolder_ref/m2.ts","file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_multifolder/ref/m1.ts","file:///tests/cases/projects/outputdir_multifolder_ref/m2.ts","file:///tests/cases/projects/outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.sourcemap.txt index f889da36fe60b..344b620620d79 100644 --- a/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlMultifolderSpecifyOutputFile/node/maprootUrlMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:file:///tests/cases/projects/outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/maprootUrlSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/maprootUrlSimpleNoOutdir.sourcemap.txt index 173dec7706957..f13225988bd0b 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/maprootUrlSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/maprootUrlSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:file:///tests/cases/projects/outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/test.js.map b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/test.js.map index 5b13c1897d9a2..ede8f059f004e 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/maprootUrlSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/maprootUrlSimpleNoOutdir.sourcemap.txt index 173dec7706957..f13225988bd0b 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/maprootUrlSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/maprootUrlSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:file:///tests/cases/projects/outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/test.js.map b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/test.js.map index 5b13c1897d9a2..ede8f059f004e 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSimpleNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlSimpleSpecifyOutputDirectory.sourcemap.txt index e1589c0feff05..c5c7205d89447 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:file:///tests/cases/projects/outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 5b13c1897d9a2..ede8f059f004e 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/maprootUrlSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/maprootUrlSimpleSpecifyOutputDirectory.sourcemap.txt index e1589c0feff05..c5c7205d89447 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/maprootUrlSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/maprootUrlSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:file:///tests/cases/projects/outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map index 5b13c1897d9a2..ede8f059f004e 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map index b1aa6b79fb645..29ba590802a13 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/m1.ts","file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/m1.ts","file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/maprootUrlSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/maprootUrlSimpleSpecifyOutputFile.sourcemap.txt index fb91eae125433..27d691b2b1090 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/maprootUrlSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/amd/maprootUrlSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:file:///tests/cases/projects/outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/bin/test.js.map index b1aa6b79fb645..29ba590802a13 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/m1.ts","file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_simple/m1.ts","file:///tests/cases/projects/outputdir_simple/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.sourcemap.txt index fb91eae125433..27d691b2b1090 100644 --- a/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSimpleSpecifyOutputFile/node/maprootUrlSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:file:///tests/cases/projects/outputdir_simple/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/maprootUrlSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/maprootUrlSubfolderNoOutdir.sourcemap.txt index 1d778de19b1cb..7f311cb64eeb9 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/maprootUrlSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/maprootUrlSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:file:///tests/cases/projects/outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/test.js.map index ec6296f132381..5883b6aac3f50 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/maprootUrlSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/maprootUrlSubfolderNoOutdir.sourcemap.txt index 1d778de19b1cb..7f311cb64eeb9 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/maprootUrlSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/maprootUrlSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:file:///tests/cases/projects/outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/test.js.map index ec6296f132381..5883b6aac3f50 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt index 003ceee4d9339..5f992db632392 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:file:///tests/cases/projects/outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index ec6296f132381..5883b6aac3f50 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt index 003ceee4d9339..5f992db632392 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:file:///tests/cases/projects/outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index ec6296f132381..5883b6aac3f50 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map index e56b1937c6d57..25ed0e8fc92f5 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/maprootUrlSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/maprootUrlSubfolderSpecifyOutputFile.sourcemap.txt index 5f63c0e5142ba..b8a52baa41e5f 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/maprootUrlSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/amd/maprootUrlSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:file:///tests/cases/projects/outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map index e56b1937c6d57..25ed0e8fc92f5 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["file:///tests/cases/projects/outputdir_subfolder/ref/m1.ts","file:///tests/cases/projects/outputdir_subfolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.sourcemap.txt index 5f63c0e5142ba..b8a52baa41e5f 100644 --- a/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlSubfolderSpecifyOutputFile/node/maprootUrlSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:file:///tests/cases/projects/outputdir_subfolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt index 679505e864800..d7a3195e99556 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/test.js.map index 2a21f42296010..e425f41290b8a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt index 341a676141d4d..fe1ebdb1cc96a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/maprootUrlsourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/test.js.map index 2a21f42296010..e425f41290b8a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 39fe2de604c1c..6f2bf783957ab 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 2a21f42296010..e425f41290b8a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 4483b21610f4a..eff1de8b03918 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 2a21f42296010..e425f41290b8a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 156e391d66926..7a70d18105c23 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 877c5b5035cd3..49c44cde80e70 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 156e391d66926..7a70d18105c23 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index a15e54dd06914..d54d4d6245e9e 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index c5ec380afae9b..53e31e30260a3 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index b75fe639eb918..7793026dd6e2d 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index c5ec380afae9b..53e31e30260a3 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 7a54e2110285e..a6deca122077e 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/maprootUrlsourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/maprootUrlsourcerootUrlMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/maprootUrlsourcerootUrlMultifolderNoOutdir.sourcemap.txt index 96940f59a3f26..8bcabc44e3ab9 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/maprootUrlsourcerootUrlMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/maprootUrlsourcerootUrlMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/test.js.map index 63113a4746807..859053b551029 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/maprootUrlsourcerootUrlMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/maprootUrlsourcerootUrlMultifolderNoOutdir.sourcemap.txt index 96940f59a3f26..8bcabc44e3ab9 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/maprootUrlsourcerootUrlMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/maprootUrlsourcerootUrlMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/test.js.map index 63113a4746807..859053b551029 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt index 5a945f4c71d8d..e2d9eaa8dda3c 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map index 63113a4746807..859053b551029 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt index 5a945f4c71d8d..e2d9eaa8dda3c 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map index 63113a4746807..859053b551029 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map index df7254bd00071..2e0ee57fe0504 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt index 4e24018adafa8..f64fa277957ca 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map index df7254bd00071..2e0ee57fe0504 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt index 4e24018adafa8..f64fa277957ca 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile/node/maprootUrlsourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/maprootUrlsourcerootUrlSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/maprootUrlsourcerootUrlSimpleNoOutdir.sourcemap.txt index 6be1df8d85dfc..a3179d120d8b6 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/maprootUrlsourcerootUrlSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/maprootUrlsourcerootUrlSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/test.js.map index ec67c8da25b06..ad9ad3d5ce04a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/maprootUrlsourcerootUrlSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/maprootUrlsourcerootUrlSimpleNoOutdir.sourcemap.txt index 6be1df8d85dfc..a3179d120d8b6 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/maprootUrlsourcerootUrlSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/maprootUrlsourcerootUrlSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/test.js.map index ec67c8da25b06..ad9ad3d5ce04a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt index 90059c5401603..232cdca7916b9 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map index ec67c8da25b06..ad9ad3d5ce04a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt index 90059c5401603..232cdca7916b9 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map index ec67c8da25b06..ad9ad3d5ce04a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map index a107f15c1bf1a..f1c6e3bd1b7a7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt index 6ce817a2afca5..8d22ea01f1692 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/amd/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/bin/test.js.map index a107f15c1bf1a..f1c6e3bd1b7a7 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt index 6ce817a2afca5..8d22ea01f1692 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSimpleSpecifyOutputFile/node/maprootUrlsourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/maprootUrlsourcerootUrlSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/maprootUrlsourcerootUrlSubfolderNoOutdir.sourcemap.txt index e6031c87b2b74..e697e24c64d4c 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/maprootUrlsourcerootUrlSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/maprootUrlsourcerootUrlSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/test.js.map index 7a5bbb049d941..014979baf0321 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/maprootUrlsourcerootUrlSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/maprootUrlsourcerootUrlSubfolderNoOutdir.sourcemap.txt index e6031c87b2b74..e697e24c64d4c 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/maprootUrlsourcerootUrlSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/maprootUrlsourcerootUrlSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/test.js.map index 7a5bbb049d941..014979baf0321 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt index aff09cc2ec580..50bebc38cbeb5 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 7a5bbb049d941..014979baf0321 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt index aff09cc2ec580..50bebc38cbeb5 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 7a5bbb049d941..014979baf0321 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map index 6e45ee8da7df9..e80a550275c2a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt index 8a2e3c01e1034..b885327d18679 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/amd/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map index 6e45ee8da7df9..e80a550275c2a 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt index 8a2e3c01e1034..b885327d18679 100644 --- a/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile/node/maprootUrlsourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.errors.txt b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.errors.txt index 2b17a05139aff..5ff8f921fc22e 100644 --- a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.errors.txt @@ -1,6 +1,8 @@ test1.ts(2,23): error TS1147: Import declarations in a namespace cannot reference a module. +==== test2.ts (0 errors) ==== + export var $; ==== test1.ts (1 errors) ==== export module myModule { import foo = require("test2"); diff --git a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.json b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.json index 70843a6a43b99..9e117694e856a 100644 --- a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.json +++ b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/amd/nestedLocalModuleSimpleCase.json @@ -6,9 +6,11 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "test2.ts", "test1.ts" ], "emittedFiles": [ + "test2.js", "test1.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.errors.txt b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.errors.txt index 2b17a05139aff..5ff8f921fc22e 100644 --- a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.errors.txt @@ -1,6 +1,8 @@ test1.ts(2,23): error TS1147: Import declarations in a namespace cannot reference a module. +==== test2.ts (0 errors) ==== + export var $; ==== test1.ts (1 errors) ==== export module myModule { import foo = require("test2"); diff --git a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.json b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.json index 70843a6a43b99..9e117694e856a 100644 --- a/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.json +++ b/tests/baselines/reference/project/nestedLocalModuleSimpleCase/node/nestedLocalModuleSimpleCase.json @@ -6,9 +6,11 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "test2.ts", "test1.ts" ], "emittedFiles": [ + "test2.js", "test1.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt index a8fb4fc1b2318..e3793fd098372 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.errors.txt @@ -1,15 +1,25 @@ test1.ts(3,23): error TS1147: Import declarations in a namespace cannot reference a module. -test1.ts(3,23): error TS2307: Cannot find module 'test2'. +test2.ts(5,27): error TS1147: Import declarations in a namespace cannot reference a module. -==== test1.ts (2 errors) ==== +==== test2.ts (1 errors) ==== + export var $; + + + export module Yo { + import test = require("test1"); + ~~~~~~~ +!!! error TS1147: Import declarations in a namespace cannot reference a module. + test.x; + + export function y() { return 0; } + } +==== test1.ts (1 errors) ==== module myModule { import foo = require("test2"); ~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~ -!!! error TS2307: Cannot find module 'test2'. //console.log(foo.$); diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.json b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.json index e31d3ce8a33be..9df6118c1b906 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.json +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/amd/nestedLocalModuleWithRecursiveTypecheck.json @@ -6,9 +6,11 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "test2.ts", "test1.ts" ], "emittedFiles": [ + "test2.js", "test1.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt index a8fb4fc1b2318..e3793fd098372 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.errors.txt @@ -1,15 +1,25 @@ test1.ts(3,23): error TS1147: Import declarations in a namespace cannot reference a module. -test1.ts(3,23): error TS2307: Cannot find module 'test2'. +test2.ts(5,27): error TS1147: Import declarations in a namespace cannot reference a module. -==== test1.ts (2 errors) ==== +==== test2.ts (1 errors) ==== + export var $; + + + export module Yo { + import test = require("test1"); + ~~~~~~~ +!!! error TS1147: Import declarations in a namespace cannot reference a module. + test.x; + + export function y() { return 0; } + } +==== test1.ts (1 errors) ==== module myModule { import foo = require("test2"); ~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~ -!!! error TS2307: Cannot find module 'test2'. //console.log(foo.$); diff --git a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.json b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.json index e31d3ce8a33be..9df6118c1b906 100644 --- a/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.json +++ b/tests/baselines/reference/project/nestedLocalModuleWithRecursiveTypecheck/node/nestedLocalModuleWithRecursiveTypecheck.json @@ -6,9 +6,11 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "test2.ts", "test1.ts" ], "emittedFiles": [ + "test2.js", "test1.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/mExported.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/mExported.js new file mode 100644 index 0000000000000..ff0a700017dad --- /dev/null +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/mExported.js @@ -0,0 +1,17 @@ +define(["require", "exports"], function (require, exports) { + var me; + (function (me) { + var class1 = (function () { + function class1() { + this.prop1 = 0; + } + return class1; + })(); + me.class1 = class1; + me.x = class1; + function foo() { + return new class1(); + } + me.foo = foo; + })(me = exports.me || (exports.me = {})); +}); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/mNonExported.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/mNonExported.js new file mode 100644 index 0000000000000..6932510a05566 --- /dev/null +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/mNonExported.js @@ -0,0 +1,17 @@ +define(["require", "exports"], function (require, exports) { + var mne; + (function (mne) { + var class1 = (function () { + function class1() { + this.prop1 = 0; + } + return class1; + })(); + mne.class1 = class1; + mne.x = class1; + function foo() { + return new class1(); + } + mne.foo = foo; + })(mne = exports.mne || (exports.mne = {})); +}); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt index 0ed31c4ea38c1..b9b8732b76f8f 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt @@ -1,16 +1,34 @@ testGlo.ts(2,39): error TS1147: Import declarations in a namespace cannot reference a module. -testGlo.ts(2,39): error TS2307: Cannot find module 'mExported'. testGlo.ts(21,35): error TS1147: Import declarations in a namespace cannot reference a module. -testGlo.ts(21,35): error TS2307: Cannot find module 'mNonExported'. -==== testGlo.ts (4 errors) ==== +==== mExported.ts (0 errors) ==== + export module me { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== mNonExported.ts (0 errors) ==== + export module mne { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== testGlo.ts (2 errors) ==== module m2 { export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mExported'. export var c1 = new mExported.me.class1; export function f1() { return new mExported.me.class1(); @@ -32,8 +50,6 @@ testGlo.ts(21,35): error TS2307: Cannot find module 'mNonExported'. import mNonExported = require("mNonExported"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mNonExported'. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.json index 7c2ab06498a1c..a07e42bde11e5 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/privacyCheckOnImportedModuleDeclarationsInsideModule.json @@ -7,9 +7,13 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.d.ts", + "mExported.ts", + "mNonExported.ts", "testGlo.ts" ], "emittedFiles": [ + "mExported.js", + "mNonExported.js", "testGlo.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/mExported.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/mExported.js new file mode 100644 index 0000000000000..a5ea2680154b5 --- /dev/null +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/mExported.js @@ -0,0 +1,15 @@ +var me; +(function (me) { + var class1 = (function () { + function class1() { + this.prop1 = 0; + } + return class1; + })(); + me.class1 = class1; + me.x = class1; + function foo() { + return new class1(); + } + me.foo = foo; +})(me = exports.me || (exports.me = {})); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/mNonExported.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/mNonExported.js new file mode 100644 index 0000000000000..624e260c07375 --- /dev/null +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/mNonExported.js @@ -0,0 +1,15 @@ +var mne; +(function (mne) { + var class1 = (function () { + function class1() { + this.prop1 = 0; + } + return class1; + })(); + mne.class1 = class1; + mne.x = class1; + function foo() { + return new class1(); + } + mne.foo = foo; +})(mne = exports.mne || (exports.mne = {})); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt index 0ed31c4ea38c1..b9b8732b76f8f 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.errors.txt @@ -1,16 +1,34 @@ testGlo.ts(2,39): error TS1147: Import declarations in a namespace cannot reference a module. -testGlo.ts(2,39): error TS2307: Cannot find module 'mExported'. testGlo.ts(21,35): error TS1147: Import declarations in a namespace cannot reference a module. -testGlo.ts(21,35): error TS2307: Cannot find module 'mNonExported'. -==== testGlo.ts (4 errors) ==== +==== mExported.ts (0 errors) ==== + export module me { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== mNonExported.ts (0 errors) ==== + export module mne { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== testGlo.ts (2 errors) ==== module m2 { export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mExported'. export var c1 = new mExported.me.class1; export function f1() { return new mExported.me.class1(); @@ -32,8 +50,6 @@ testGlo.ts(21,35): error TS2307: Cannot find module 'mNonExported'. import mNonExported = require("mNonExported"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mNonExported'. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.json index 7c2ab06498a1c..a07e42bde11e5 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/privacyCheckOnImportedModuleDeclarationsInsideModule.json @@ -7,9 +7,13 @@ "baselineCheck": true, "resolvedInputFiles": [ "lib.d.ts", + "mExported.ts", + "mNonExported.ts", "testGlo.ts" ], "emittedFiles": [ + "mExported.js", + "mNonExported.js", "testGlo.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt index 126d5b696c1cf..04a563bbdebcf 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt @@ -1,10 +1,30 @@ test.ts(5,39): error TS1147: Import declarations in a namespace cannot reference a module. -test.ts(5,39): error TS2307: Cannot find module 'mExported'. test.ts(24,35): error TS1147: Import declarations in a namespace cannot reference a module. -test.ts(24,35): error TS2307: Cannot find module 'mNonExported'. -==== test.ts (4 errors) ==== +==== mExported.ts (0 errors) ==== + export module me { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== mNonExported.ts (0 errors) ==== + export module mne { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== test.ts (2 errors) ==== export module m1 { } @@ -12,8 +32,6 @@ test.ts(24,35): error TS2307: Cannot find module 'mNonExported'. export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mExported'. export var c1 = new mExported.me.class1; export function f1() { return new mExported.me.class1(); @@ -35,8 +53,6 @@ test.ts(24,35): error TS2307: Cannot find module 'mNonExported'. import mNonExported = require("mNonExported"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mNonExported'. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json index 3d6f683911441..10e3d6adc9806 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/amd/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json @@ -6,9 +6,13 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "mExported.ts", + "mNonExported.ts", "test.ts" ], "emittedFiles": [ + "mExported.js", + "mNonExported.js", "test.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt index 126d5b696c1cf..04a563bbdebcf 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.errors.txt @@ -1,10 +1,30 @@ test.ts(5,39): error TS1147: Import declarations in a namespace cannot reference a module. -test.ts(5,39): error TS2307: Cannot find module 'mExported'. test.ts(24,35): error TS1147: Import declarations in a namespace cannot reference a module. -test.ts(24,35): error TS2307: Cannot find module 'mNonExported'. -==== test.ts (4 errors) ==== +==== mExported.ts (0 errors) ==== + export module me { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== mNonExported.ts (0 errors) ==== + export module mne { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== test.ts (2 errors) ==== export module m1 { } @@ -12,8 +32,6 @@ test.ts(24,35): error TS2307: Cannot find module 'mNonExported'. export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mExported'. export var c1 = new mExported.me.class1; export function f1() { return new mExported.me.class1(); @@ -35,8 +53,6 @@ test.ts(24,35): error TS2307: Cannot find module 'mNonExported'. import mNonExported = require("mNonExported"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mNonExported'. export var c3 = new mNonExported.mne.class1; export function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json index 3d6f683911441..10e3d6adc9806 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule/node/privacyCheckOnImportedModuleDeclarationsInsideNonExportedModule.json @@ -6,9 +6,13 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "mExported.ts", + "mNonExported.ts", "test.ts" ], "emittedFiles": [ + "mExported.js", + "mNonExported.js", "test.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt index 872e43a9b4f1d..734efb4f704c5 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt @@ -1,16 +1,34 @@ test.ts(2,39): error TS1147: Import declarations in a namespace cannot reference a module. -test.ts(2,39): error TS2307: Cannot find module 'mExported'. test.ts(42,35): error TS1147: Import declarations in a namespace cannot reference a module. -test.ts(42,35): error TS2307: Cannot find module 'mNonExported'. -==== test.ts (4 errors) ==== +==== mExported.ts (0 errors) ==== + export module me { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== mNonExported.ts (0 errors) ==== + export module mne { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== test.ts (2 errors) ==== export module m2 { export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mExported'. module Internal_M1 { export var c1 = new mExported.me.class1; @@ -53,8 +71,6 @@ test.ts(42,35): error TS2307: Cannot find module 'mNonExported'. import mNonExported = require("mNonExported"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mNonExported'. module Internal_M3 { export var c3 = new mNonExported.mne.class1; export function f3() { diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.json index 6b6e79d9c0dcf..3d58a1861e6e0 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/amd/privacyCheckOnImportedModuleImportStatementInParentModule.json @@ -6,9 +6,13 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "mExported.ts", + "mNonExported.ts", "test.ts" ], "emittedFiles": [ + "mExported.js", + "mNonExported.js", "test.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt index 872e43a9b4f1d..734efb4f704c5 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.errors.txt @@ -1,16 +1,34 @@ test.ts(2,39): error TS1147: Import declarations in a namespace cannot reference a module. -test.ts(2,39): error TS2307: Cannot find module 'mExported'. test.ts(42,35): error TS1147: Import declarations in a namespace cannot reference a module. -test.ts(42,35): error TS2307: Cannot find module 'mNonExported'. -==== test.ts (4 errors) ==== +==== mExported.ts (0 errors) ==== + export module me { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== mNonExported.ts (0 errors) ==== + export module mne { + export class class1 { + public prop1 = 0; + } + + export var x = class1; + export function foo() { + return new class1(); + } + } +==== test.ts (2 errors) ==== export module m2 { export import mExported = require("mExported"); ~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mExported'. module Internal_M1 { export var c1 = new mExported.me.class1; @@ -53,8 +71,6 @@ test.ts(42,35): error TS2307: Cannot find module 'mNonExported'. import mNonExported = require("mNonExported"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in a namespace cannot reference a module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'mNonExported'. module Internal_M3 { export var c3 = new mNonExported.mne.class1; export function f3() { diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.json b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.json index 6b6e79d9c0dcf..3d58a1861e6e0 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.json +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleImportStatementInParentModule/node/privacyCheckOnImportedModuleImportStatementInParentModule.json @@ -6,9 +6,13 @@ ], "resolvedInputFiles": [ "lib.d.ts", + "mExported.ts", + "mNonExported.ts", "test.ts" ], "emittedFiles": [ + "mExported.js", + "mNonExported.js", "test.js" ] } \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js.map b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js.map index d1c844d32478d..79496de73d952 100644 --- a/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js.map +++ b/tests/baselines/reference/project/rootDirectory/amd/outdir/simple/FolderB/fileB.js.map @@ -1 +1 @@ -{"version":3,"file":"fileB.js","sourceRoot":"","sources":["../../../FolderA/FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AACA,AADA,wCAAwC;;IACxCA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file +{"version":3,"file":"fileB.js","sourceRoot":"","sources":["../../../FolderA/FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AAAA,wCAAwC;AACxC;IAAAA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.sourcemap.txt b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.sourcemap.txt index 83ee3b40181b4..0833854ab17d3 100644 --- a/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/rootDirectory/amd/rootDirectory.sourcemap.txt @@ -66,23 +66,24 @@ sourceFile:../../../FolderA/FolderB/fileB.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) --- >>>var B = (function () { ->>> function B() { -1 >^^^^ -2 > ^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function B() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) --- >>> } 1->^^^^ diff --git a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js.map b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js.map index d1c844d32478d..79496de73d952 100644 --- a/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js.map +++ b/tests/baselines/reference/project/rootDirectory/node/outdir/simple/FolderB/fileB.js.map @@ -1 +1 @@ -{"version":3,"file":"fileB.js","sourceRoot":"","sources":["../../../FolderA/FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AACA,AADA,wCAAwC;;IACxCA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file +{"version":3,"file":"fileB.js","sourceRoot":"","sources":["../../../FolderA/FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AAAA,wCAAwC;AACxC;IAAAA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectory/node/rootDirectory.sourcemap.txt b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.sourcemap.txt index 83ee3b40181b4..0833854ab17d3 100644 --- a/tests/baselines/reference/project/rootDirectory/node/rootDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/rootDirectory/node/rootDirectory.sourcemap.txt @@ -66,23 +66,24 @@ sourceFile:../../../FolderA/FolderB/fileB.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) --- >>>var B = (function () { ->>> function B() { -1 >^^^^ -2 > ^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function B() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) --- >>> } 1->^^^^ diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js.map b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js.map index 16a4538542059..41ef956764844 100644 --- a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js.map +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/outdir/simple/FolderB/fileB.js.map @@ -1 +1 @@ -{"version":3,"file":"fileB.js","sourceRoot":"SourceRootPath/","sources":["FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AACA,AADA,wCAAwC;;IACxCA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file +{"version":3,"file":"fileB.js","sourceRoot":"SourceRootPath/","sources":["FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AAAA,wCAAwC;AACxC;IAAAA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.sourcemap.txt b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.sourcemap.txt index 7c5843bdd3433..c0f24c52650a4 100644 --- a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.sourcemap.txt +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/amd/rootDirectoryWithSourceRoot.sourcemap.txt @@ -66,23 +66,24 @@ sourceFile:FolderB/fileB.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) --- >>>var B = (function () { ->>> function B() { -1 >^^^^ -2 > ^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function B() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) --- >>> } 1->^^^^ diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js.map b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js.map index 16a4538542059..41ef956764844 100644 --- a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js.map +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/outdir/simple/FolderB/fileB.js.map @@ -1 +1 @@ -{"version":3,"file":"fileB.js","sourceRoot":"SourceRootPath/","sources":["FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AACA,AADA,wCAAwC;;IACxCA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file +{"version":3,"file":"fileB.js","sourceRoot":"SourceRootPath/","sources":["FolderB/fileB.ts"],"names":["B","B.constructor"],"mappings":"AAAA,wCAAwC;AACxC;IAAAA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC"} \ No newline at end of file diff --git a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.sourcemap.txt b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.sourcemap.txt index 7c5843bdd3433..c0f24c52650a4 100644 --- a/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.sourcemap.txt +++ b/tests/baselines/reference/project/rootDirectoryWithSourceRoot/node/rootDirectoryWithSourceRoot.sourcemap.txt @@ -66,23 +66,24 @@ sourceFile:FolderB/fileB.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 41) Source(1, 41) + SourceIndex(0) --- >>>var B = (function () { ->>> function B() { -1 >^^^^ -2 > ^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +--- +>>> function B() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(3, 5) Source(2, 1) + SourceIndex(0) name (B) --- >>> } 1->^^^^ diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/sourceRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/sourceRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt index 154daaa4a70c4..7e234d178b806 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/sourceRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/sourceRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/test.js.map index 9bf8cc497596f..b5e6eec3623b3 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/sourceRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/sourceRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt index 95d78aa3a6f03..f0b41e615ae1f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/sourceRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/sourceRootAbsolutePathMixedSubfolderNoOutdir.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/test.js.map index 9bf8cc497596f..b5e6eec3623b3 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 9bf8cc497596f..b5e6eec3623b3 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 7197c780765d6..999019984d6cf 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 9bf8cc497596f..b5e6eec3623b3 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 68ab2e1cb0ef1..9ed3d1262fa7b 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 63116c3c3ec4f..65bbb0e67c215 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 7579aa9cc1c32..bbad2c102f998 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 63116c3c3ec4f..65bbb0e67c215 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 8fe4fb35089b9..c409dc99f1449 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index 81d4981890103..820efe6d9d1bf 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 1a0944395743d..8536097d11177 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index 81d4981890103..820efe6d9d1bf 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"/tests/cases/projects/outputdir_mixed_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 1b485f8a450b7..47e9f1da73a76 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootAbsolutePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/sourceRootAbsolutePathMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/sourceRootAbsolutePathMultifolderNoOutdir.sourcemap.txt index 06c05bb438b02..b7293d81f542d 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/sourceRootAbsolutePathMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/sourceRootAbsolutePathMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/test.js.map index 54f77cba804d0..da7206b4e32be 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/sourceRootAbsolutePathMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/sourceRootAbsolutePathMultifolderNoOutdir.sourcemap.txt index 06c05bb438b02..b7293d81f542d 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/sourceRootAbsolutePathMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/sourceRootAbsolutePathMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/test.js.map index 54f77cba804d0..da7206b4e32be 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map index 54f77cba804d0..da7206b4e32be 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt index 0cd80fd563da1..a76377a99e468 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map index 54f77cba804d0..da7206b4e32be 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt index 0cd80fd563da1..a76377a99e468 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory/node/sourceRootAbsolutePathMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/bin/test.js.map index 6baf87e6a0a3e..9ce443017eb07 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt index c686916fecfe1..23f41f64947a5 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/amd/sourceRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/bin/test.js.map index 6baf87e6a0a3e..9ce443017eb07 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_multifolder/src/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt index c686916fecfe1..23f41f64947a5 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathMultifolderSpecifyOutputFile/node/sourceRootAbsolutePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/sourceRootAbsolutePathSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/sourceRootAbsolutePathSimpleNoOutdir.sourcemap.txt index 937975a41dc65..0087d5d671695 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/sourceRootAbsolutePathSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/sourceRootAbsolutePathSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/test.js.map index 2c82359c39eda..68302f9245b3f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/sourceRootAbsolutePathSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/sourceRootAbsolutePathSimpleNoOutdir.sourcemap.txt index 937975a41dc65..0087d5d671695 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/sourceRootAbsolutePathSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/sourceRootAbsolutePathSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/test.js.map index 2c82359c39eda..68302f9245b3f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 2c82359c39eda..68302f9245b3f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt index b94aa72552f65..a0c7d8cd9768a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/amd/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map index 2c82359c39eda..68302f9245b3f 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt index b94aa72552f65..a0c7d8cd9768a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputDirectory/node/sourceRootAbsolutePathSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/bin/test.js.map index 725dab2980684..28168d6c0ced4 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt index 1091dae5c0636..f4897f2cd52e4 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/amd/sourceRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/bin/test.js.map index 725dab2980684..28168d6c0ced4 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_simple/src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt index 1091dae5c0636..f4897f2cd52e4 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSimpleSpecifyOutputFile/node/sourceRootAbsolutePathSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/sourceRootAbsolutePathSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/sourceRootAbsolutePathSubfolderNoOutdir.sourcemap.txt index e76f86d4edfd4..9d5c143cfd46c 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/sourceRootAbsolutePathSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/sourceRootAbsolutePathSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/test.js.map index 7aecf7bb79798..9979f6eb7d561 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/sourceRootAbsolutePathSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/sourceRootAbsolutePathSubfolderNoOutdir.sourcemap.txt index e76f86d4edfd4..9d5c143cfd46c 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/sourceRootAbsolutePathSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/sourceRootAbsolutePathSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/test.js.map index 7aecf7bb79798..9979f6eb7d561 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 7aecf7bb79798..9979f6eb7d561 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt index e8ad9ce990cf4..63af6359f7ef6 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/amd/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 7aecf7bb79798..9979f6eb7d561 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt index e8ad9ce990cf4..63af6359f7ef6 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory/node/sourceRootAbsolutePathSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/bin/test.js.map index 9d1c6c2187101..d11b23b98c4c7 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt index d51d030afc49f..6a0176bdacd0a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/amd/sourceRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/bin/test.js.map index 9d1c6c2187101..d11b23b98c4c7 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"/tests/cases/projects/outputdir_subfolder/src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt index d51d030afc49f..6a0176bdacd0a 100644 --- a/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootAbsolutePathSubfolderSpecifyOutputFile/node/sourceRootAbsolutePathSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/sourceRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/sourceRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt index 4492ea156cd31..a144760b69f8f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/sourceRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/sourceRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/test.js.map index 7b83f21b71526..6014ca9159858 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/sourceRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/sourceRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt index 18997be9365a0..64ebd330860a1 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/sourceRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/sourceRootRelativePathMixedSubfolderNoOutdir.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/test.js.map index 7b83f21b71526..6014ca9159858 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 7b83f21b71526..6014ca9159858 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 4af0f38468e7d..a8377701181ab 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 7b83f21b71526..6014ca9159858 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index bdfda8e946b04..d8857daae5c01 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index f3b07b196ea96..86afcf32e2521 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 9bf843435cb17..94b86ffdde1b6 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index f3b07b196ea96..86afcf32e2521 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt index 59f5f96fc763c..12a6fdbc6ddea 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFile/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index bae3da16f5119..13b958b102519 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index d4f1ba4f5aae8..11e34ee5a2e36 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index bae3da16f5119..13b958b102519 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 47a5afc6d80e7..5b9ec51c2702c 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourceRootRelativePathMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/sourceRootRelativePathMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/sourceRootRelativePathMultifolderNoOutdir.sourcemap.txt index 88e6b10a24687..20c4a628b797f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/sourceRootRelativePathMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/sourceRootRelativePathMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/test.js.map index 3f2781e7135d1..1c3b0105b5f0b 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/sourceRootRelativePathMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/sourceRootRelativePathMultifolderNoOutdir.sourcemap.txt index 88e6b10a24687..20c4a628b797f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/sourceRootRelativePathMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/sourceRootRelativePathMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/test.js.map index 3f2781e7135d1..1c3b0105b5f0b 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map index 3f2781e7135d1..1c3b0105b5f0b 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt index 939e34eb98b6b..325718e37e1e1 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/amd/sourceRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map index 3f2781e7135d1..1c3b0105b5f0b 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt index 939e34eb98b6b..325718e37e1e1 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputDirectory/node/sourceRootRelativePathMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map index 2e84a488006ed..d7eeef9ca4955 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/sourceRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/sourceRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt index 1d422734a9ffa..46af9b6678ba0 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/sourceRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/amd/sourceRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map index 2e84a488006ed..d7eeef9ca4955 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt index 1d422734a9ffa..46af9b6678ba0 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathMultifolderSpecifyOutputFile/node/sourceRootRelativePathMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/sourceRootRelativePathSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/sourceRootRelativePathSimpleNoOutdir.sourcemap.txt index bf10b5ed9fcf2..181dcd2d8c672 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/sourceRootRelativePathSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/sourceRootRelativePathSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/test.js.map index 1934eb39c28b7..eb9e3b663f1ac 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/sourceRootRelativePathSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/sourceRootRelativePathSimpleNoOutdir.sourcemap.txt index bf10b5ed9fcf2..181dcd2d8c672 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/sourceRootRelativePathSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/sourceRootRelativePathSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/test.js.map index 1934eb39c28b7..eb9e3b663f1ac 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 1934eb39c28b7..eb9e3b663f1ac 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt index cd059036df7b8..3a97d4540e29c 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/amd/sourceRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map index 1934eb39c28b7..eb9e3b663f1ac 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/sourceRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/sourceRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt index cd059036df7b8..3a97d4540e29c 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/sourceRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputDirectory/node/sourceRootRelativePathSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/bin/test.js.map index fb5adc76d5992..cc3b39712085f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/sourceRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/sourceRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt index 7e219ee4efd77..c85101c002636 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/sourceRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/amd/sourceRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/bin/test.js.map index fb5adc76d5992..cc3b39712085f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt index 7e219ee4efd77..c85101c002636 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSimpleSpecifyOutputFile/node/sourceRootRelativePathSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/sourceRootRelativePathSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/sourceRootRelativePathSubfolderNoOutdir.sourcemap.txt index 75655274f8a52..e3643a7e1e4da 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/sourceRootRelativePathSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/sourceRootRelativePathSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/test.js.map index a68bad790abb9..7792f8a3df67f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/sourceRootRelativePathSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/sourceRootRelativePathSubfolderNoOutdir.sourcemap.txt index 75655274f8a52..e3643a7e1e4da 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/sourceRootRelativePathSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/sourceRootRelativePathSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/test.js.map index a68bad790abb9..7792f8a3df67f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index a68bad790abb9..7792f8a3df67f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt index 91537c8852432..c76e3a2c05c7e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/amd/sourceRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index a68bad790abb9..7792f8a3df67f 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt index 91537c8852432..c76e3a2c05c7e 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputDirectory/node/sourceRootRelativePathSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/bin/test.js.map index 47e290804f28b..ef39d6c5cdbce 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/sourceRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/sourceRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt index 32bf6d56977cf..c0ad748bf2bcb 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/sourceRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/amd/sourceRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/bin/test.js.map index 47e290804f28b..ef39d6c5cdbce 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"../src/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt index 32bf6d56977cf..c0ad748bf2bcb 100644 --- a/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourceRootRelativePathSubfolderSpecifyOutputFile/node/sourceRootRelativePathSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt index f4b65c12f35f4..56dab79dacf4b 100644 --- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/amd/sourceRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt index f4b65c12f35f4..56dab79dacf4b 100644 --- a/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt +++ b/tests/baselines/reference/project/sourceRootWithNoSourceMapOption/node/sourceRootWithNoSourceMapOption.errors.txt @@ -1,7 +1,7 @@ -error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. -!!! error TS5039: Option 'sourceRoot' cannot be specified without specifying 'sourceMap' option. +!!! error TS5052: Option 'sourceRoot' cannot be specified without specifying option 'sourceMap'. ==== m1.ts (0 errors) ==== var m1_a1 = 10; class m1_c1 { diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/sourcemapMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/sourcemapMixedSubfolderNoOutdir.sourcemap.txt index a5aeda6cdd894..40be0ca660cbd 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/sourcemapMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/sourcemapMixedSubfolderNoOutdir.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/test.js.map index 9bac80ea4925a..c9a79b35d3c52 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/sourcemapMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/sourcemapMixedSubfolderNoOutdir.sourcemap.txt index 5355f2e907efa..d3eeabc27b53f 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/sourcemapMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/sourcemapMixedSubfolderNoOutdir.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/test.js.map index 9bac80ea4925a..c9a79b35d3c52 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 46ba86b781cf6..bad31ecf8d2a4 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 045f82046ce3b..4557384d5b831 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:../../test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 46ba86b781cf6..bad31ecf8d2a4 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 4424c9c08729f..7a377d04299ef 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:../../test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index d1972c6fac718..a1d591a049765 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt index f7faa24855f14..b1d3f293b7e46 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/amd/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:../test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index d1972c6fac718..a1d591a049765 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt index 9931e5b441878..676e8f264ec79 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFile/node/sourcemapMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:../test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index eb72bfc3c0299..4f87045fd2524 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index b75480da1e740..a73c3b0852a0e 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:../test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index eb72bfc3c0299..4f87045fd2524 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index 165ca8ce0229e..77ff10492be7d 100644 --- a/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcemapMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:../test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/sourcemapMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/sourcemapMultifolderNoOutdir.sourcemap.txt index 3a0747b73910e..9f8f5856ae82f 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/sourcemapMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/sourcemapMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/test.js.map index c44bc9965385a..38fe91174ea14 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/sourcemapMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/sourcemapMultifolderNoOutdir.sourcemap.txt index 3a0747b73910e..9f8f5856ae82f 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/sourcemapMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/sourcemapMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/test.js.map index c44bc9965385a..38fe91174ea14 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourcemapMultifolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map index 39003b7de59ec..4c7bad4f920d8 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/sourcemapMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/sourcemapMultifolderSpecifyOutputDirectory.sourcemap.txt index f46ef4b5d46a6..cb0659450da97 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/sourcemapMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/amd/sourcemapMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../../test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map index 39003b7de59ec..4c7bad4f920d8 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/sourcemapMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/sourcemapMultifolderSpecifyOutputDirectory.sourcemap.txt index f46ef4b5d46a6..cb0659450da97 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/sourcemapMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputDirectory/node/sourcemapMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:../../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:../../../test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/bin/test.js.map index 8df103744b531..37b77beb154fa 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/sourcemapMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/sourcemapMultifolderSpecifyOutputFile.sourcemap.txt index e5f624e893bd2..fa9ebc580e629 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/sourcemapMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/amd/sourcemapMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:../test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/bin/test.js.map index 8df103744b531..37b77beb154fa 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../../outputdir_multifolder_ref/m2.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.sourcemap.txt index e5f624e893bd2..fa9ebc580e629 100644 --- a/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapMultifolderSpecifyOutputFile/node/sourcemapMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:../test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/sourcemapSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/sourcemapSimpleNoOutdir.sourcemap.txt index 37f3a79369702..17bbd902b9603 100644 --- a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/sourcemapSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/sourcemapSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/test.js.map index 35110f566c5fd..69f4d8bbfc17c 100644 --- a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/sourcemapSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/sourcemapSimpleNoOutdir.sourcemap.txt index 37f3a79369702..17bbd902b9603 100644 --- a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/sourcemapSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/sourcemapSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/test.js.map index 35110f566c5fd..69f4d8bbfc17c 100644 --- a/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourcemapSimpleNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map index dcdfb88178553..5ec3a45d1bd61 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/sourcemapSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/sourcemapSimpleSpecifyOutputDirectory.sourcemap.txt index 1d4ac5482112e..0a6c6e15aa1c6 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/sourcemapSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/amd/sourcemapSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map index dcdfb88178553..5ec3a45d1bd61 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/sourcemapSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/sourcemapSimpleSpecifyOutputDirectory.sourcemap.txt index 1d4ac5482112e..0a6c6e15aa1c6 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/sourcemapSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputDirectory/node/sourcemapSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/bin/test.js.map index f358b98d465d7..b7b29ed1cf834 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/sourcemapSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/sourcemapSimpleSpecifyOutputFile.sourcemap.txt index bd56afebe5929..6343dcc34c6d5 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/sourcemapSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/amd/sourcemapSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/bin/test.js.map index f358b98d465d7..b7b29ed1cf834 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.sourcemap.txt index bd56afebe5929..6343dcc34c6d5 100644 --- a/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSimpleSpecifyOutputFile/node/sourcemapSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/sourcemapSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/sourcemapSubfolderNoOutdir.sourcemap.txt index d35b75a2de15b..6bdf8e8ef313b 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/sourcemapSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/sourcemapSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/test.js.map index a91cc4d9881a5..ef084bb212820 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/sourcemapSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/sourcemapSubfolderNoOutdir.sourcemap.txt index d35b75a2de15b..6bdf8e8ef313b 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/sourcemapSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/sourcemapSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/test.js.map index a91cc4d9881a5..ef084bb212820 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourcemapSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 0024c7c27472d..22a81dc63bc12 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/sourcemapSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/sourcemapSubfolderSpecifyOutputDirectory.sourcemap.txt index 079673b477956..2de709b09abb8 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/sourcemapSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/amd/sourcemapSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 0024c7c27472d..22a81dc63bc12 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../../test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/sourcemapSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/sourcemapSubfolderSpecifyOutputDirectory.sourcemap.txt index 079673b477956..2de709b09abb8 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/sourcemapSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputDirectory/node/sourcemapSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:../../test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/bin/test.js.map index 6882b70c3898a..91ea14b3da422 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/sourcemapSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/sourcemapSubfolderSpecifyOutputFile.sourcemap.txt index 9f06bde3b12c4..9ca0493ff415e 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/sourcemapSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/amd/sourcemapSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/bin/test.js.map index 6882b70c3898a..91ea14b3da422 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"","sources":["../ref/m1.ts","../test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.sourcemap.txt index 9f06bde3b12c4..9ca0493ff415e 100644 --- a/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcemapSubfolderSpecifyOutputFile/node/sourcemapSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:../test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/sourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/sourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt index ecf6b4f4fb41e..6abc36a083230 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/sourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/sourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/test.js.map index 2a21f42296010..e425f41290b8a 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/sourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/sourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt index 65a337f5eabca..49e704a99e1f8 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/sourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/sourcerootUrlMixedSubfolderNoOutdir.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/test.js.map index 2a21f42296010..e425f41290b8a 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 2a21f42296010..e425f41290b8a 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 0f0eb1aa02ae3..7e0989aabb01e 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -325,17 +325,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -347,23 +342,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 2a21f42296010..e425f41290b8a 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt index 30caf09e89005..3d19accc614eb 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -324,17 +324,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -346,23 +341,26 @@ sourceFile:test.ts 2 >Emitted(2, 34) Source(2, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map index 156e391d66926..7a70d18105c23 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index c2331c962e761..d4cac64349071 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/amd/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map index 156e391d66926..7a70d18105c23 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt index 96a83ac34b256..cb96dcbf7d703 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFile/node/sourcerootUrlMixedSubfolderSpecifyOutputFile.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map index c5ec380afae9b..53e31e30260a3 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index d21b9752018be..d54fa316273fd 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/amd/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -319,17 +319,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -341,23 +336,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map index c5ec380afae9b..53e31e30260a3 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/bin/outAndOutDirFile.js.map @@ -1 +1 @@ -{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"outAndOutDirFile.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt index a4436e03b4d32..8bd8c2ac03585 100644 --- a/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory/node/sourcerootUrlMixedSubfolderSpecifyOutputFileAndOutputDirectory.sourcemap.txt @@ -318,17 +318,12 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(3, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^-> +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>/// 1-> @@ -340,23 +335,26 @@ sourceFile:test.ts 2 >Emitted(12, 34) Source(2, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) -2 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) -3 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) -4 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) -5 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(1) +2 >Emitted(13, 5) Source(3, 5) + SourceIndex(1) +3 >Emitted(13, 7) Source(3, 7) + SourceIndex(1) +4 >Emitted(13, 10) Source(3, 10) + SourceIndex(1) +5 >Emitted(13, 12) Source(3, 12) + SourceIndex(1) +6 >Emitted(13, 13) Source(3, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/sourcerootUrlMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/sourcerootUrlMultifolderNoOutdir.sourcemap.txt index f5758392a225b..a70e80c9c1a54 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/sourcerootUrlMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/sourcerootUrlMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/test.js.map index 63113a4746807..859053b551029 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/sourcerootUrlMultifolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/sourcerootUrlMultifolderNoOutdir.sourcemap.txt index f5758392a225b..a70e80c9c1a54 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/sourcerootUrlMultifolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/sourcerootUrlMultifolderNoOutdir.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/test.js.map index 63113a4746807..859053b551029 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map index 63113a4746807..859053b551029 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/sourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/sourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt index 309061b94edc2..4f4f068056fa9 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/sourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/amd/sourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map index 63113a4746807..859053b551029 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/outdir/simple/outputdir_multifolder/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAEA,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/sourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/sourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt index 309061b94edc2..4f4f068056fa9 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/sourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputDirectory/node/sourcerootUrlMultifolderSpecifyOutputDirectory.sourcemap.txt @@ -296,17 +296,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >/// - >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>/// 1-> @@ -318,23 +313,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(2, 59) Source(2, 59) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) -2 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) -3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) -4 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) -5 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) +3 >Emitted(3, 7) Source(3, 7) + SourceIndex(0) +4 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) +5 >Emitted(3, 12) Source(3, 12) + SourceIndex(0) +6 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map index df7254bd00071..2e0ee57fe0504 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/sourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/sourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt index 2903da82815b9..823af8d1bc3ed 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/sourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/amd/sourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map index df7254bd00071..2e0ee57fe0504 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACND,AAFA,iCAAiC;AACjC,0DAA0D;IACtD,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["outputdir_multifolder/ref/m1.ts","outputdir_multifolder_ref/m2.ts","outputdir_multifolder/test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","m2_c1","m2_c1.constructor","m2_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAC;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,0DAA0D;AAC1D,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt index 2903da82815b9..823af8d1bc3ed 100644 --- a/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlMultifolderSpecifyOutputFile/node/sourcerootUrlMultifolderSpecifyOutputFile.sourcemap.txt @@ -284,17 +284,12 @@ sourceFile:outputdir_multifolder/test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1->/// - >/// - > -2 > -3 >/// -1->Emitted(21, 1) Source(3, 1) + SourceIndex(2) -2 >Emitted(21, 1) Source(1, 1) + SourceIndex(2) -3 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 >/// +1->Emitted(21, 1) Source(1, 1) + SourceIndex(2) +2 >Emitted(21, 34) Source(1, 34) + SourceIndex(2) --- >>>/// 1-> @@ -306,23 +301,26 @@ sourceFile:outputdir_multifolder/test.ts 2 >Emitted(22, 59) Source(2, 59) + SourceIndex(2) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) -2 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) -3 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) -4 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) -5 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(23, 1) Source(3, 1) + SourceIndex(2) +2 >Emitted(23, 5) Source(3, 5) + SourceIndex(2) +3 >Emitted(23, 7) Source(3, 7) + SourceIndex(2) +4 >Emitted(23, 10) Source(3, 10) + SourceIndex(2) +5 >Emitted(23, 12) Source(3, 12) + SourceIndex(2) +6 >Emitted(23, 13) Source(3, 13) + SourceIndex(2) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/sourcerootUrlSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/sourcerootUrlSimpleNoOutdir.sourcemap.txt index 6784e74b54c2c..e9ff85f6fe6c2 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/sourcerootUrlSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/sourcerootUrlSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/test.js.map index ec67c8da25b06..ad9ad3d5ce04a 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/sourcerootUrlSimpleNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/sourcerootUrlSimpleNoOutdir.sourcemap.txt index 6784e74b54c2c..e9ff85f6fe6c2 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/sourcerootUrlSimpleNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/sourcerootUrlSimpleNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/test.js.map index ec67c8da25b06..ad9ad3d5ce04a 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSimpleNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map index ec67c8da25b06..ad9ad3d5ce04a 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/sourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/sourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt index b6a9d4f87864f..411004d82a33d 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/sourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/amd/sourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map index ec67c8da25b06..ad9ad3d5ce04a 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/sourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/sourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt index b6a9d4f87864f..411004d82a33d 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/sourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputDirectory/node/sourcerootUrlSimpleSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 30) Source(1, 30) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map index a107f15c1bf1a..f1c6e3bd1b7a7 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/sourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/sourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt index a4f350382a644..10e2e3700c151 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/sourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/amd/sourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/bin/test.js.map index a107f15c1bf1a..f1c6e3bd1b7a7 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,6BAA6B;IACzB,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,6BAA6B;AAC7B,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt index a4f350382a644..10e2e3700c151 100644 --- a/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSimpleSpecifyOutputFile/node/sourcerootUrlSimpleSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 30) Source(1, 30) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/sourcerootUrlSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/sourcerootUrlSubfolderNoOutdir.sourcemap.txt index 333f432766eaf..c8b19a1227f99 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/sourcerootUrlSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/sourcerootUrlSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/test.js.map b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/test.js.map index 7a5bbb049d941..014979baf0321 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/amd/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/sourcerootUrlSubfolderNoOutdir.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/sourcerootUrlSubfolderNoOutdir.sourcemap.txt index 333f432766eaf..c8b19a1227f99 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/sourcerootUrlSubfolderNoOutdir.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/sourcerootUrlSubfolderNoOutdir.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/test.js.map b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/test.js.map index 7a5bbb049d941..014979baf0321 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderNoOutdir/node/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map index 7a5bbb049d941..014979baf0321 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/sourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/sourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt index 68dc81acc3e60..31798101a5734 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/sourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/amd/sourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map index 7a5bbb049d941..014979baf0321 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/outdir/simple/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AACA,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["test.ts"],"names":["c1","c1.constructor","f1"],"mappings":"AAAA,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAA;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/sourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/sourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt index 68dc81acc3e60..31798101a5734 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/sourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputDirectory/node/sourcerootUrlSubfolderSpecifyOutputDirectory.sourcemap.txt @@ -153,34 +153,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 >/// - > -2 > -3 >/// -1 >Emitted(1, 1) Source(2, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > +2 >/// +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 34) Source(1, 34) + SourceIndex(0) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) -3 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) -4 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) -5 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(2, 1) Source(2, 1) + SourceIndex(0) +2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) +3 >Emitted(2, 7) Source(2, 7) + SourceIndex(0) +4 >Emitted(2, 10) Source(2, 10) + SourceIndex(0) +5 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) +6 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map index 6e45ee8da7df9..e80a550275c2a 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/sourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/sourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt index 3ca3d1774f81f..791b3dbcecbf8 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/sourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/amd/sourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map index 6e45ee8da7df9..e80a550275c2a 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/bin/test.js.map @@ -1 +1 @@ -{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACPD,AADA,iCAAiC;IAC7B,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file +{"version":3,"file":"test.js","sourceRoot":"http://typescript.codeplex.com/","sources":["ref/m1.ts","test.ts"],"names":["m1_c1","m1_c1.constructor","m1_f1","c1","c1.constructor","f1"],"mappings":"AAAA,IAAI,KAAK,GAAG,EAAE,CAAC;AACf;IAAAA;IAEAC,CAACA;IAADD,YAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,YAAY,GAAG,IAAI,KAAK,EAAE,CAAC;AAC/B;IACIE,MAAMA,CAACA,YAAYA,CAACA;AACxBA,CAACA;ACRD,iCAAiC;AACjC,IAAI,EAAE,GAAG,EAAE,CAAC;AACZ;IAAAC;IAEAC,CAACA;IAADD,SAACA;AAADA,CAACA,AAFD,IAEC;AAED,IAAI,SAAS,GAAG,IAAI,EAAE,EAAE,CAAC;AACzB;IACIE,MAAMA,CAACA,SAASA,CAACA;AACrBA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt index 3ca3d1774f81f..791b3dbcecbf8 100644 --- a/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt +++ b/tests/baselines/reference/project/sourcerootUrlSubfolderSpecifyOutputFile/node/sourcerootUrlSubfolderSpecifyOutputFile.sourcemap.txt @@ -147,34 +147,33 @@ sourceFile:test.ts ------------------------------------------------------------------- >>>/// 1-> -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1->/// - > -2 > -3 >/// -1->Emitted(11, 1) Source(2, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(1, 1) + SourceIndex(1) -3 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1-> +2 >/// +1->Emitted(11, 1) Source(1, 1) + SourceIndex(1) +2 >Emitted(11, 34) Source(1, 34) + SourceIndex(1) --- >>>var a1 = 10; -1 >^^^^ -2 > ^^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^-> 1 > - >var -2 > a1 -3 > = -4 > 10 -5 > ; -1 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) -2 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) -3 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) -4 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) -5 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) +2 >^^^^ +3 > ^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^-> +1 > + > +2 >var +3 > a1 +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(2, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(2, 5) + SourceIndex(1) +3 >Emitted(12, 7) Source(2, 7) + SourceIndex(1) +4 >Emitted(12, 10) Source(2, 10) + SourceIndex(1) +5 >Emitted(12, 12) Source(2, 12) + SourceIndex(1) +6 >Emitted(12, 13) Source(2, 13) + SourceIndex(1) --- >>>var c1 = (function () { 1-> diff --git a/tests/baselines/reference/promiseVoidErrorCallback.symbols b/tests/baselines/reference/promiseVoidErrorCallback.symbols index 27e7df62ab1a0..4d595286627ff 100644 --- a/tests/baselines/reference/promiseVoidErrorCallback.symbols +++ b/tests/baselines/reference/promiseVoidErrorCallback.symbols @@ -22,13 +22,13 @@ interface T3 { function f1(): Promise { >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) >T1 : Symbol(T1, Decl(promiseVoidErrorCallback.ts, 0, 0)) return Promise.resolve({ __t1: "foo_t1" }); ->Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 4840, 39), Decl(lib.d.ts, 4847, 54)) ->Promise : Symbol(Promise, Decl(lib.d.ts, 4772, 1), Decl(lib.d.ts, 4858, 11)) ->resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 4840, 39), Decl(lib.d.ts, 4847, 54)) +>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 5142, 39), Decl(lib.d.ts, 5149, 54)) +>Promise : Symbol(Promise, Decl(lib.d.ts, 5074, 1), Decl(lib.d.ts, 5160, 11)) +>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.d.ts, 5142, 39), Decl(lib.d.ts, 5149, 54)) >__t1 : Symbol(__t1, Decl(promiseVoidErrorCallback.ts, 13, 28)) } @@ -47,12 +47,12 @@ function f2(x: T1): T2 { var x3 = f1() >x3 : Symbol(x3, Decl(promiseVoidErrorCallback.ts, 20, 3)) ->f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.d.ts, 4777, 22), Decl(lib.d.ts, 4784, 158)) ->f1() .then : Symbol(Promise.then, Decl(lib.d.ts, 4777, 22), Decl(lib.d.ts, 4784, 158)) +>f1() .then(f2, (e: Error) => { throw e;}) .then : Symbol(Promise.then, Decl(lib.d.ts, 5079, 22), Decl(lib.d.ts, 5086, 158)) +>f1() .then : Symbol(Promise.then, Decl(lib.d.ts, 5079, 22), Decl(lib.d.ts, 5086, 158)) >f1 : Symbol(f1, Decl(promiseVoidErrorCallback.ts, 10, 1)) .then(f2, (e: Error) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, 4777, 22), Decl(lib.d.ts, 4784, 158)) +>then : Symbol(Promise.then, Decl(lib.d.ts, 5079, 22), Decl(lib.d.ts, 5086, 158)) >f2 : Symbol(f2, Decl(promiseVoidErrorCallback.ts, 14, 1)) >e : Symbol(e, Decl(promiseVoidErrorCallback.ts, 21, 15)) >Error : Symbol(Error, Decl(lib.d.ts, 876, 38), Decl(lib.d.ts, 889, 11)) @@ -62,7 +62,7 @@ var x3 = f1() }) .then((x: T2) => { ->then : Symbol(Promise.then, Decl(lib.d.ts, 4777, 22), Decl(lib.d.ts, 4784, 158)) +>then : Symbol(Promise.then, Decl(lib.d.ts, 5079, 22), Decl(lib.d.ts, 5086, 158)) >x : Symbol(x, Decl(promiseVoidErrorCallback.ts, 24, 11)) >T2 : Symbol(T2, Decl(promiseVoidErrorCallback.ts, 2, 1)) diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index 734906688fde2..90ab021de5968 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,OAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC;oBAAAC;oBAQAC,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,kBAQ3BA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,YAAIA,KAAJA,YAAIA,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;gBAKCC,oBAAoBA,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,aAkBtBA,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;IAAAe;IAAuFC,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;oBACOC,eAAoBA,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,QAWjBA,CAAAA;gBAEDA;oBAA0BM,wBAAYA;oBAAtCA;wBAA0BC,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,OAQhBA,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,OAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC;oBAAAC;oBAQAC,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,kBAQ3BA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,YAAIA,KAAJA,YAAIA,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;gBAKCC,oBAAoBA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAEvBA,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,aAkBtBA,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;IAAAe;IAAuFC,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;oBACOC,eAAoBA,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,QAWjBA,CAAAA;gBAEDA;oBAA0BM,wBAAYA;oBAAtCA;wBAA0BC,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,OAQhBA,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 8f45e0ea71532..3b693f7c282fb 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -737,18 +737,14 @@ sourceFile:recursiveClassReferenceTest.ts --- >>> // scenario 1 1 >^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > constructor(private codeThing: Sample.Thing.ICodeThing) { - > // scenario 1 > -2 > -3 > // scenario 1 -1 >Emitted(40, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(40, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(40, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 > // scenario 1 +1 >Emitted(40, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(40, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> codeThing.addWidget("addWidget", this); 1->^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/reexportClassDefinition.js b/tests/baselines/reference/reexportClassDefinition.js new file mode 100644 index 0000000000000..5d534f1e3a32e --- /dev/null +++ b/tests/baselines/reference/reexportClassDefinition.js @@ -0,0 +1,45 @@ +//// [tests/cases/conformance/externalModules/reexportClassDefinition.ts] //// + +//// [foo1.ts] +class x{} +export = x; + +//// [foo2.ts] +import foo1 = require('./foo1'); + +export = { + x: foo1 +} + +//// [foo3.ts] +import foo2 = require('./foo2') +class x extends foo2.x {} + + + +//// [foo1.js] +var x = (function () { + function x() { + } + return x; +})(); +module.exports = x; +//// [foo2.js] +var foo1 = require('./foo1'); +module.exports = { + x: foo1 +}; +//// [foo3.js] +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var foo2 = require('./foo2'); +var x = (function (_super) { + __extends(x, _super); + function x() { + _super.apply(this, arguments); + } + return x; +})(foo2.x); diff --git a/tests/baselines/reference/reexportClassDefinition.symbols b/tests/baselines/reference/reexportClassDefinition.symbols new file mode 100644 index 0000000000000..521336579859f --- /dev/null +++ b/tests/baselines/reference/reexportClassDefinition.symbols @@ -0,0 +1,26 @@ +=== tests/cases/conformance/externalModules/foo3.ts === +import foo2 = require('./foo2') +>foo2 : Symbol(foo2, Decl(foo3.ts, 0, 0)) + +class x extends foo2.x {} +>x : Symbol(x, Decl(foo3.ts, 0, 31)) +>foo2 : Symbol(foo2, Decl(foo3.ts, 0, 0)) + + +=== tests/cases/conformance/externalModules/foo1.ts === +class x{} +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + +export = x; +>x : Symbol(x, Decl(foo1.ts, 0, 0)) + +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) + +export = { + x: foo1 +>x : Symbol(x, Decl(foo2.ts, 2, 10)) +>foo1 : Symbol(foo1, Decl(foo2.ts, 0, 0)) +} + diff --git a/tests/baselines/reference/reexportClassDefinition.types b/tests/baselines/reference/reexportClassDefinition.types new file mode 100644 index 0000000000000..c39bbf9c13695 --- /dev/null +++ b/tests/baselines/reference/reexportClassDefinition.types @@ -0,0 +1,30 @@ +=== tests/cases/conformance/externalModules/foo3.ts === +import foo2 = require('./foo2') +>foo2 : { x: typeof x; } + +class x extends foo2.x {} +>x : x +>foo2.x : x +>foo2 : { x: typeof x; } +>x : typeof x + + +=== tests/cases/conformance/externalModules/foo1.ts === +class x{} +>x : x + +export = x; +>x : x + +=== tests/cases/conformance/externalModules/foo2.ts === +import foo1 = require('./foo1'); +>foo1 : typeof foo1 + +export = { +>{ x: foo1} : { x: typeof foo1; } + + x: foo1 +>x : typeof foo1 +>foo1 : typeof foo1 +} + diff --git a/tests/baselines/reference/regExpWithSlashInCharClass.symbols b/tests/baselines/reference/regExpWithSlashInCharClass.symbols index 2131f47146646..68a257a966669 100644 --- a/tests/baselines/reference/regExpWithSlashInCharClass.symbols +++ b/tests/baselines/reference/regExpWithSlashInCharClass.symbols @@ -1,16 +1,16 @@ === tests/cases/compiler/regExpWithSlashInCharClass.ts === var foo1 = "a/".replace(/.[/]/, ""); >foo1 : Symbol(foo1, Decl(regExpWithSlashInCharClass.ts, 0, 3)) ->"a/".replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) ->replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) +>"a/".replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) +>replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) var foo2 = "a//".replace(/.[//]/g, ""); >foo2 : Symbol(foo2, Decl(regExpWithSlashInCharClass.ts, 1, 3)) ->"a//".replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) ->replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) +>"a//".replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) +>replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) var foo3 = "a/".replace(/.[/no sleep /till/]/, "bugfix"); >foo3 : Symbol(foo3, Decl(regExpWithSlashInCharClass.ts, 2, 3)) ->"a/".replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) ->replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 102), Decl(lib.d.ts, 350, 63)) +>"a/".replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) +>replace : Symbol(String.replace, Decl(lib.d.ts, 329, 44), Decl(lib.d.ts, 336, 63), Decl(lib.d.ts, 343, 98), Decl(lib.d.ts, 350, 63)) diff --git a/tests/baselines/reference/regExpWithSlashInCharClass.types b/tests/baselines/reference/regExpWithSlashInCharClass.types index 40eed3c109c14..fafe6e1be69b0 100644 --- a/tests/baselines/reference/regExpWithSlashInCharClass.types +++ b/tests/baselines/reference/regExpWithSlashInCharClass.types @@ -2,27 +2,27 @@ var foo1 = "a/".replace(/.[/]/, ""); >foo1 : string >"a/".replace(/.[/]/, "") : string ->"a/".replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>"a/".replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >"a/" : string ->replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >/.[/]/ : RegExp >"" : string var foo2 = "a//".replace(/.[//]/g, ""); >foo2 : string >"a//".replace(/.[//]/g, "") : string ->"a//".replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>"a//".replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >"a//" : string ->replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >/.[//]/g : RegExp >"" : string var foo3 = "a/".replace(/.[/no sleep /till/]/, "bugfix"); >foo3 : string >"a/".replace(/.[/no sleep /till/]/, "bugfix") : string ->"a/".replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>"a/".replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >"a/" : string ->replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replaceValue: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replaceValue: (substring: string, ...args: any[]) => string): string; } +>replace : { (searchValue: string, replaceValue: string): string; (searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; (searchValue: RegExp, replaceValue: string): string; (searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; } >/.[/no sleep /till/]/ : RegExp >"bugfix" : string diff --git a/tests/baselines/reference/sourceMap-Comments.js b/tests/baselines/reference/sourceMap-Comments.js new file mode 100644 index 0000000000000..12a4e5010ddb6 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments.js @@ -0,0 +1,50 @@ +//// [sourceMap-Comments.ts] +module sas.tools { + export class Test { + public doX(): void { + let f: number = 2; + switch (f) { + case 1: + break; + case 2: + //line comment 1 + //line comment 2 + break; + case 3: + //a comment + break; + } + } + } + +} + + +//// [sourceMap-Comments.js] +var sas; +(function (sas) { + var tools; + (function (tools) { + var Test = (function () { + function Test() { + } + Test.prototype.doX = function () { + var f = 2; + switch (f) { + case 1: + break; + case 2: + //line comment 1 + //line comment 2 + break; + case 3: + //a comment + break; + } + }; + return Test; + })(); + tools.Test = Test; + })(tools = sas.tools || (sas.tools = {})); +})(sas || (sas = {})); +//# sourceMappingURL=sourceMap-Comments.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-Comments.js.map b/tests/baselines/reference/sourceMap-Comments.js.map new file mode 100644 index 0000000000000..6e5e0dca07107 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments.js.map @@ -0,0 +1,2 @@ +//// [sourceMap-Comments.js.map] +{"version":3,"file":"sourceMap-Comments.js","sourceRoot":"","sources":["sourceMap-Comments.ts"],"names":["sas","sas.tools","sas.tools.Test","sas.tools.Test.constructor","sas.tools.Test.doX"],"mappings":"AAAA,IAAO,GAAG,CAkBT;AAlBD,WAAO,GAAG;IAACA,IAAAA,KAAKA,CAkBfA;IAlBUA,WAAAA,KAAKA,EAACA,CAACA;QACdC;YAAAC;YAeAC,CAACA;YAdUD,kBAAGA,GAAVA;gBACIE,IAAIA,CAACA,GAAWA,CAACA,CAACA;gBAClBA,MAAMA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;oBACRA,KAAKA,CAACA;wBACFA,KAAKA,CAACA;oBACVA,KAAKA,CAACA;wBACFA,gBAAgBA;wBAChBA,gBAAgBA;wBAChBA,KAAKA,CAACA;oBACVA,KAAKA,CAACA;wBACFA,WAAWA;wBACXA,KAAKA,CAACA;gBACdA,CAACA;YACLA,CAACA;YACLF,WAACA;QAADA,CAACA,AAfDD,IAeCA;QAfYA,UAAIA,OAehBA,CAAAA;IAELA,CAACA,EAlBUD,KAAKA,GAALA,SAAKA,KAALA,SAAKA,QAkBfA;AAADA,CAACA,EAlBM,GAAG,KAAH,GAAG,QAkBT"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-Comments.sourcemap.txt b/tests/baselines/reference/sourceMap-Comments.sourcemap.txt new file mode 100644 index 0000000000000..fe0b9276994c5 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments.sourcemap.txt @@ -0,0 +1,486 @@ +=================================================================== +JsFile: sourceMap-Comments.js +mapUrl: sourceMap-Comments.js.map +sourceRoot: +sources: sourceMap-Comments.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMap-Comments.js +sourceFile:sourceMap-Comments.ts +------------------------------------------------------------------- +>>>var sas; +1 > +2 >^^^^ +3 > ^^^ +4 > ^ +5 > ^^^^^^^^^^-> +1 > +2 >module +3 > sas +4 > .tools { + > export class Test { + > public doX(): void { + > let f: number = 2; + > switch (f) { + > case 1: + > break; + > case 2: + > //line comment 1 + > //line comment 2 + > break; + > case 3: + > //a comment + > break; + > } + > } + > } + > + > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 8) Source(1, 11) + SourceIndex(0) +4 >Emitted(1, 9) Source(19, 2) + SourceIndex(0) +--- +>>>(function (sas) { +1-> +2 >^^^^^^^^^^^ +3 > ^^^ +4 > ^-> +1-> +2 >module +3 > sas +1->Emitted(2, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(2, 12) Source(1, 8) + SourceIndex(0) +3 >Emitted(2, 15) Source(1, 11) + SourceIndex(0) +--- +>>> var tools; +1->^^^^ +2 > ^^^^ +3 > ^^^^^ +4 > ^ +5 > ^^^^^^^^^^-> +1->. +2 > +3 > tools +4 > { + > export class Test { + > public doX(): void { + > let f: number = 2; + > switch (f) { + > case 1: + > break; + > case 2: + > //line comment 1 + > //line comment 2 + > break; + > case 3: + > //a comment + > break; + > } + > } + > } + > + > } +1->Emitted(3, 5) Source(1, 12) + SourceIndex(0) name (sas) +2 >Emitted(3, 9) Source(1, 12) + SourceIndex(0) name (sas) +3 >Emitted(3, 14) Source(1, 17) + SourceIndex(0) name (sas) +4 >Emitted(3, 15) Source(19, 2) + SourceIndex(0) name (sas) +--- +>>> (function (tools) { +1->^^^^ +2 > ^^^^^^^^^^^ +3 > ^^^^^ +4 > ^^ +5 > ^ +6 > ^^^^^^^^^^^-> +1-> +2 > +3 > tools +4 > +5 > { +1->Emitted(4, 5) Source(1, 12) + SourceIndex(0) name (sas) +2 >Emitted(4, 16) Source(1, 12) + SourceIndex(0) name (sas) +3 >Emitted(4, 21) Source(1, 17) + SourceIndex(0) name (sas) +4 >Emitted(4, 23) Source(1, 18) + SourceIndex(0) name (sas) +5 >Emitted(4, 24) Source(1, 19) + SourceIndex(0) name (sas) +--- +>>> var Test = (function () { +1->^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(5, 9) Source(2, 5) + SourceIndex(0) name (sas.tools) +--- +>>> function Test() { +1->^^^^^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(6, 13) Source(2, 5) + SourceIndex(0) name (sas.tools.Test) +--- +>>> } +1->^^^^^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->export class Test { + > public doX(): void { + > let f: number = 2; + > switch (f) { + > case 1: + > break; + > case 2: + > //line comment 1 + > //line comment 2 + > break; + > case 3: + > //a comment + > break; + > } + > } + > +2 > } +1->Emitted(7, 13) Source(17, 5) + SourceIndex(0) name (sas.tools.Test.constructor) +2 >Emitted(7, 14) Source(17, 6) + SourceIndex(0) name (sas.tools.Test.constructor) +--- +>>> Test.prototype.doX = function () { +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^ +3 > ^^^ +1-> +2 > doX +3 > +1->Emitted(8, 13) Source(3, 16) + SourceIndex(0) name (sas.tools.Test) +2 >Emitted(8, 31) Source(3, 19) + SourceIndex(0) name (sas.tools.Test) +3 >Emitted(8, 34) Source(3, 9) + SourceIndex(0) name (sas.tools.Test) +--- +>>> var f = 2; +1 >^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^-> +1 >public doX(): void { + > +2 > let +3 > f +4 > : number = +5 > 2 +6 > ; +1 >Emitted(9, 17) Source(4, 13) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(9, 21) Source(4, 17) + SourceIndex(0) name (sas.tools.Test.doX) +3 >Emitted(9, 22) Source(4, 18) + SourceIndex(0) name (sas.tools.Test.doX) +4 >Emitted(9, 25) Source(4, 29) + SourceIndex(0) name (sas.tools.Test.doX) +5 >Emitted(9, 26) Source(4, 30) + SourceIndex(0) name (sas.tools.Test.doX) +6 >Emitted(9, 27) Source(4, 31) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> switch (f) { +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +1-> + > +2 > switch +3 > +4 > ( +5 > f +6 > ) +7 > +8 > { +1->Emitted(10, 17) Source(5, 13) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(10, 23) Source(5, 19) + SourceIndex(0) name (sas.tools.Test.doX) +3 >Emitted(10, 24) Source(5, 20) + SourceIndex(0) name (sas.tools.Test.doX) +4 >Emitted(10, 25) Source(5, 21) + SourceIndex(0) name (sas.tools.Test.doX) +5 >Emitted(10, 26) Source(5, 22) + SourceIndex(0) name (sas.tools.Test.doX) +6 >Emitted(10, 27) Source(5, 23) + SourceIndex(0) name (sas.tools.Test.doX) +7 >Emitted(10, 28) Source(5, 24) + SourceIndex(0) name (sas.tools.Test.doX) +8 >Emitted(10, 29) Source(5, 25) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> case 1: +1 >^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^ +4 > ^^^^^-> +1 > + > +2 > case +3 > 1 +1 >Emitted(11, 21) Source(6, 17) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(11, 26) Source(6, 22) + SourceIndex(0) name (sas.tools.Test.doX) +3 >Emitted(11, 27) Source(6, 23) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> break; +1->^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^ +1->: + > +2 > break +3 > ; +1->Emitted(12, 25) Source(7, 21) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(12, 30) Source(7, 26) + SourceIndex(0) name (sas.tools.Test.doX) +3 >Emitted(12, 31) Source(7, 27) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> case 2: +1 >^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^-> +1 > + > +2 > case +3 > 2 +1 >Emitted(13, 21) Source(8, 17) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(13, 26) Source(8, 22) + SourceIndex(0) name (sas.tools.Test.doX) +3 >Emitted(13, 27) Source(8, 23) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> //line comment 1 +1->^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^ +3 > ^-> +1->: + > +2 > //line comment 1 +1->Emitted(14, 25) Source(9, 21) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(14, 41) Source(9, 37) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> //line comment 2 +1->^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^ +1-> + > +2 > //line comment 2 +1->Emitted(15, 25) Source(10, 21) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(15, 41) Source(10, 37) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> break; +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^ +1 > + > +2 > break +3 > ; +1 >Emitted(16, 25) Source(11, 21) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(16, 30) Source(11, 26) + SourceIndex(0) name (sas.tools.Test.doX) +3 >Emitted(16, 31) Source(11, 27) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> case 3: +1 >^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^ +4 > ^^^^^^^^^^-> +1 > + > +2 > case +3 > 3 +1 >Emitted(17, 21) Source(12, 17) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(17, 26) Source(12, 22) + SourceIndex(0) name (sas.tools.Test.doX) +3 >Emitted(17, 27) Source(12, 23) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> //a comment +1->^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^ +1->: + > +2 > //a comment +1->Emitted(18, 25) Source(13, 21) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(18, 36) Source(13, 32) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> break; +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^ +3 > ^ +1 > + > +2 > break +3 > ; +1 >Emitted(19, 25) Source(14, 21) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(19, 30) Source(14, 26) + SourceIndex(0) name (sas.tools.Test.doX) +3 >Emitted(19, 31) Source(14, 27) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> } +1 >^^^^^^^^^^^^^^^^ +2 > ^ +1 > + > +2 > } +1 >Emitted(20, 17) Source(15, 13) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(20, 18) Source(15, 14) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> }; +1 >^^^^^^^^^^^^ +2 > ^ +3 > ^^^^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(21, 13) Source(16, 9) + SourceIndex(0) name (sas.tools.Test.doX) +2 >Emitted(21, 14) Source(16, 10) + SourceIndex(0) name (sas.tools.Test.doX) +--- +>>> return Test; +1->^^^^^^^^^^^^ +2 > ^^^^^^^^^^^ +1-> + > +2 > } +1->Emitted(22, 13) Source(17, 5) + SourceIndex(0) name (sas.tools.Test) +2 >Emitted(22, 24) Source(17, 6) + SourceIndex(0) name (sas.tools.Test) +--- +>>> })(); +1 >^^^^^^^^ +2 > ^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^-> +1 > +2 > } +3 > +4 > export class Test { + > public doX(): void { + > let f: number = 2; + > switch (f) { + > case 1: + > break; + > case 2: + > //line comment 1 + > //line comment 2 + > break; + > case 3: + > //a comment + > break; + > } + > } + > } +1 >Emitted(23, 9) Source(17, 5) + SourceIndex(0) name (sas.tools.Test) +2 >Emitted(23, 10) Source(17, 6) + SourceIndex(0) name (sas.tools.Test) +3 >Emitted(23, 10) Source(2, 5) + SourceIndex(0) name (sas.tools) +4 >Emitted(23, 14) Source(17, 6) + SourceIndex(0) name (sas.tools) +--- +>>> tools.Test = Test; +1->^^^^^^^^ +2 > ^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^-> +1-> +2 > Test +3 > { + > public doX(): void { + > let f: number = 2; + > switch (f) { + > case 1: + > break; + > case 2: + > //line comment 1 + > //line comment 2 + > break; + > case 3: + > //a comment + > break; + > } + > } + > } +4 > +1->Emitted(24, 9) Source(2, 18) + SourceIndex(0) name (sas.tools) +2 >Emitted(24, 19) Source(2, 22) + SourceIndex(0) name (sas.tools) +3 >Emitted(24, 26) Source(17, 6) + SourceIndex(0) name (sas.tools) +4 >Emitted(24, 27) Source(17, 6) + SourceIndex(0) name (sas.tools) +--- +>>> })(tools = sas.tools || (sas.tools = {})); +1->^^^^ +2 > ^ +3 > ^^ +4 > ^^^^^ +5 > ^^^ +6 > ^^^^^^^^^ +7 > ^^^^^ +8 > ^^^^^^^^^ +9 > ^^^^^^^^ +1-> + > + > +2 > } +3 > +4 > tools +5 > +6 > tools +7 > +8 > tools +9 > { + > export class Test { + > public doX(): void { + > let f: number = 2; + > switch (f) { + > case 1: + > break; + > case 2: + > //line comment 1 + > //line comment 2 + > break; + > case 3: + > //a comment + > break; + > } + > } + > } + > + > } +1->Emitted(25, 5) Source(19, 1) + SourceIndex(0) name (sas.tools) +2 >Emitted(25, 6) Source(19, 2) + SourceIndex(0) name (sas.tools) +3 >Emitted(25, 8) Source(1, 12) + SourceIndex(0) name (sas) +4 >Emitted(25, 13) Source(1, 17) + SourceIndex(0) name (sas) +5 >Emitted(25, 16) Source(1, 12) + SourceIndex(0) name (sas) +6 >Emitted(25, 25) Source(1, 17) + SourceIndex(0) name (sas) +7 >Emitted(25, 30) Source(1, 12) + SourceIndex(0) name (sas) +8 >Emitted(25, 39) Source(1, 17) + SourceIndex(0) name (sas) +9 >Emitted(25, 47) Source(19, 2) + SourceIndex(0) name (sas) +--- +>>>})(sas || (sas = {})); +1 > +2 >^ +3 > ^^ +4 > ^^^ +5 > ^^^^^ +6 > ^^^ +7 > ^^^^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > sas +5 > +6 > sas +7 > .tools { + > export class Test { + > public doX(): void { + > let f: number = 2; + > switch (f) { + > case 1: + > break; + > case 2: + > //line comment 1 + > //line comment 2 + > break; + > case 3: + > //a comment + > break; + > } + > } + > } + > + > } +1 >Emitted(26, 1) Source(19, 1) + SourceIndex(0) name (sas) +2 >Emitted(26, 2) Source(19, 2) + SourceIndex(0) name (sas) +3 >Emitted(26, 4) Source(1, 8) + SourceIndex(0) +4 >Emitted(26, 7) Source(1, 11) + SourceIndex(0) +5 >Emitted(26, 12) Source(1, 8) + SourceIndex(0) +6 >Emitted(26, 15) Source(1, 11) + SourceIndex(0) +7 >Emitted(26, 23) Source(19, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=sourceMap-Comments.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-Comments.symbols b/tests/baselines/reference/sourceMap-Comments.symbols new file mode 100644 index 0000000000000..d7c1adabbb0a8 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments.symbols @@ -0,0 +1,32 @@ +=== tests/cases/compiler/sourceMap-Comments.ts === +module sas.tools { +>sas : Symbol(sas, Decl(sourceMap-Comments.ts, 0, 0)) +>tools : Symbol(tools, Decl(sourceMap-Comments.ts, 0, 11)) + + export class Test { +>Test : Symbol(Test, Decl(sourceMap-Comments.ts, 0, 18)) + + public doX(): void { +>doX : Symbol(doX, Decl(sourceMap-Comments.ts, 1, 23)) + + let f: number = 2; +>f : Symbol(f, Decl(sourceMap-Comments.ts, 3, 15)) + + switch (f) { +>f : Symbol(f, Decl(sourceMap-Comments.ts, 3, 15)) + + case 1: + break; + case 2: + //line comment 1 + //line comment 2 + break; + case 3: + //a comment + break; + } + } + } + +} + diff --git a/tests/baselines/reference/sourceMap-Comments.types b/tests/baselines/reference/sourceMap-Comments.types new file mode 100644 index 0000000000000..cbb58b6799459 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments.types @@ -0,0 +1,39 @@ +=== tests/cases/compiler/sourceMap-Comments.ts === +module sas.tools { +>sas : typeof sas +>tools : typeof tools + + export class Test { +>Test : Test + + public doX(): void { +>doX : () => void + + let f: number = 2; +>f : number +>2 : number + + switch (f) { +>f : number + + case 1: +>1 : number + + break; + case 2: +>2 : number + + //line comment 1 + //line comment 2 + break; + case 3: +>3 : number + + //a comment + break; + } + } + } + +} + diff --git a/tests/baselines/reference/sourceMap-Comments2.js b/tests/baselines/reference/sourceMap-Comments2.js new file mode 100644 index 0000000000000..cf03b015aced8 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments2.js @@ -0,0 +1,39 @@ +//// [sourceMap-Comments2.ts] +function foo(str: string, num: number): void { + return; +} + +/** + * some sort of block quote + */ +function bar(str: string, num: number): void { + return; +} + +// some sort of comment +function baz(str: string, num: number): void { + return; +} + +function qat(str: string, num: number): void { + return; +} + +//// [sourceMap-Comments2.js] +function foo(str, num) { + return; +} +/** + * some sort of block quote + */ +function bar(str, num) { + return; +} +// some sort of comment +function baz(str, num) { + return; +} +function qat(str, num) { + return; +} +//# sourceMappingURL=sourceMap-Comments2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-Comments2.js.map b/tests/baselines/reference/sourceMap-Comments2.js.map new file mode 100644 index 0000000000000..be5a88d795d7e --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments2.js.map @@ -0,0 +1,2 @@ +//// [sourceMap-Comments2.js.map] +{"version":3,"file":"sourceMap-Comments2.js","sourceRoot":"","sources":["sourceMap-Comments2.ts"],"names":["foo","bar","baz","qat"],"mappings":"AAAA,aAAa,GAAW,EAAE,GAAW;IACjCA,MAAMA,CAACA;AACXA,CAACA;AAED;;GAEG;AACH,aAAa,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA;AAED,uBAAuB;AACvB,aAAa,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA;AAED,aAAa,GAAW,EAAE,GAAW;IACjCC,MAAMA,CAACA;AACXA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-Comments2.sourcemap.txt b/tests/baselines/reference/sourceMap-Comments2.sourcemap.txt new file mode 100644 index 0000000000000..d6230b83dfbc5 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments2.sourcemap.txt @@ -0,0 +1,199 @@ +=================================================================== +JsFile: sourceMap-Comments2.js +mapUrl: sourceMap-Comments2.js.map +sourceRoot: +sources: sourceMap-Comments2.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/compiler/sourceMap-Comments2.js +sourceFile:sourceMap-Comments2.ts +------------------------------------------------------------------- +>>>function foo(str, num) { +1 > +2 >^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^^^ +1 > +2 >function foo( +3 > str: string +4 > , +5 > num: number +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 14) Source(1, 14) + SourceIndex(0) +3 >Emitted(1, 17) Source(1, 25) + SourceIndex(0) +4 >Emitted(1, 19) Source(1, 27) + SourceIndex(0) +5 >Emitted(1, 22) Source(1, 38) + SourceIndex(0) +--- +>>> return; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +1 >): void { + > +2 > return +3 > ; +1 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (foo) +2 >Emitted(2, 11) Source(2, 11) + SourceIndex(0) name (foo) +3 >Emitted(2, 12) Source(2, 12) + SourceIndex(0) name (foo) +--- +>>>} +1 > +2 >^ +3 > ^^^-> +1 > + > +2 >} +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) name (foo) +2 >Emitted(3, 2) Source(3, 2) + SourceIndex(0) name (foo) +--- +>>>/** +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +1->Emitted(4, 1) Source(5, 1) + SourceIndex(0) +--- +>>> * some sort of block quote +>>> */ +1->^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^-> +1->/** + > * some sort of block quote + > */ +1->Emitted(6, 4) Source(7, 4) + SourceIndex(0) +--- +>>>function bar(str, num) { +1-> +2 >^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^^^ +1-> + > +2 >function bar( +3 > str: string +4 > , +5 > num: number +1->Emitted(7, 1) Source(8, 1) + SourceIndex(0) +2 >Emitted(7, 14) Source(8, 14) + SourceIndex(0) +3 >Emitted(7, 17) Source(8, 25) + SourceIndex(0) +4 >Emitted(7, 19) Source(8, 27) + SourceIndex(0) +5 >Emitted(7, 22) Source(8, 38) + SourceIndex(0) +--- +>>> return; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +1 >): void { + > +2 > return +3 > ; +1 >Emitted(8, 5) Source(9, 5) + SourceIndex(0) name (bar) +2 >Emitted(8, 11) Source(9, 11) + SourceIndex(0) name (bar) +3 >Emitted(8, 12) Source(9, 12) + SourceIndex(0) name (bar) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(9, 1) Source(10, 1) + SourceIndex(0) name (bar) +2 >Emitted(9, 2) Source(10, 2) + SourceIndex(0) name (bar) +--- +>>>// some sort of comment +1-> +2 >^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^-> +1-> + > + > +2 >// some sort of comment +1->Emitted(10, 1) Source(12, 1) + SourceIndex(0) +2 >Emitted(10, 24) Source(12, 24) + SourceIndex(0) +--- +>>>function baz(str, num) { +1-> +2 >^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^^^ +1-> + > +2 >function baz( +3 > str: string +4 > , +5 > num: number +1->Emitted(11, 1) Source(13, 1) + SourceIndex(0) +2 >Emitted(11, 14) Source(13, 14) + SourceIndex(0) +3 >Emitted(11, 17) Source(13, 25) + SourceIndex(0) +4 >Emitted(11, 19) Source(13, 27) + SourceIndex(0) +5 >Emitted(11, 22) Source(13, 38) + SourceIndex(0) +--- +>>> return; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +1 >): void { + > +2 > return +3 > ; +1 >Emitted(12, 5) Source(14, 5) + SourceIndex(0) name (baz) +2 >Emitted(12, 11) Source(14, 11) + SourceIndex(0) name (baz) +3 >Emitted(12, 12) Source(14, 12) + SourceIndex(0) name (baz) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(13, 1) Source(15, 1) + SourceIndex(0) name (baz) +2 >Emitted(13, 2) Source(15, 2) + SourceIndex(0) name (baz) +--- +>>>function qat(str, num) { +1-> +2 >^^^^^^^^^^^^^ +3 > ^^^ +4 > ^^ +5 > ^^^ +1-> + > + > +2 >function qat( +3 > str: string +4 > , +5 > num: number +1->Emitted(14, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(14, 14) Source(17, 14) + SourceIndex(0) +3 >Emitted(14, 17) Source(17, 25) + SourceIndex(0) +4 >Emitted(14, 19) Source(17, 27) + SourceIndex(0) +5 >Emitted(14, 22) Source(17, 38) + SourceIndex(0) +--- +>>> return; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +1 >): void { + > +2 > return +3 > ; +1 >Emitted(15, 5) Source(18, 5) + SourceIndex(0) name (qat) +2 >Emitted(15, 11) Source(18, 11) + SourceIndex(0) name (qat) +3 >Emitted(15, 12) Source(18, 12) + SourceIndex(0) name (qat) +--- +>>>} +1 > +2 >^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +2 >} +1 >Emitted(16, 1) Source(19, 1) + SourceIndex(0) name (qat) +2 >Emitted(16, 2) Source(19, 2) + SourceIndex(0) name (qat) +--- +>>>//# sourceMappingURL=sourceMap-Comments2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-Comments2.symbols b/tests/baselines/reference/sourceMap-Comments2.symbols new file mode 100644 index 0000000000000..f77772d483fc8 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments2.symbols @@ -0,0 +1,36 @@ +=== tests/cases/compiler/sourceMap-Comments2.ts === +function foo(str: string, num: number): void { +>foo : Symbol(foo, Decl(sourceMap-Comments2.ts, 0, 0)) +>str : Symbol(str, Decl(sourceMap-Comments2.ts, 0, 13)) +>num : Symbol(num, Decl(sourceMap-Comments2.ts, 0, 25)) + + return; +} + +/** + * some sort of block quote + */ +function bar(str: string, num: number): void { +>bar : Symbol(bar, Decl(sourceMap-Comments2.ts, 2, 1)) +>str : Symbol(str, Decl(sourceMap-Comments2.ts, 7, 13)) +>num : Symbol(num, Decl(sourceMap-Comments2.ts, 7, 25)) + + return; +} + +// some sort of comment +function baz(str: string, num: number): void { +>baz : Symbol(baz, Decl(sourceMap-Comments2.ts, 9, 1)) +>str : Symbol(str, Decl(sourceMap-Comments2.ts, 12, 13)) +>num : Symbol(num, Decl(sourceMap-Comments2.ts, 12, 25)) + + return; +} + +function qat(str: string, num: number): void { +>qat : Symbol(qat, Decl(sourceMap-Comments2.ts, 14, 1)) +>str : Symbol(str, Decl(sourceMap-Comments2.ts, 16, 13)) +>num : Symbol(num, Decl(sourceMap-Comments2.ts, 16, 25)) + + return; +} diff --git a/tests/baselines/reference/sourceMap-Comments2.types b/tests/baselines/reference/sourceMap-Comments2.types new file mode 100644 index 0000000000000..d8d4458123999 --- /dev/null +++ b/tests/baselines/reference/sourceMap-Comments2.types @@ -0,0 +1,36 @@ +=== tests/cases/compiler/sourceMap-Comments2.ts === +function foo(str: string, num: number): void { +>foo : (str: string, num: number) => void +>str : string +>num : number + + return; +} + +/** + * some sort of block quote + */ +function bar(str: string, num: number): void { +>bar : (str: string, num: number) => void +>str : string +>num : number + + return; +} + +// some sort of comment +function baz(str: string, num: number): void { +>baz : (str: string, num: number) => void +>str : string +>num : number + + return; +} + +function qat(str: string, num: number): void { +>qat : (str: string, num: number) => void +>str : string +>num : number + + return; +} diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index fc27b8542d086..7e38a53a90226 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;;QAEJC,cAAcA;QACdA,eAAmBA,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,QASjBA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA;IACAI,CAACA;IADeJ,UAAGA,MAClBA,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":"AAMA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAEXA,QAAQA;IACRA;QACIC,cAAcA;QACdA,eAAmBA,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,QASjBA,CAAAA;IAEDA,+BAA+BA;IAC/BA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;IAEXA;IACAI,CAACA;IADeJ,UAAGA,MAClBA,CAAAA;IAEDA;;MAEEA;IACFA,IAAIA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAED,qBAAqB;AACrB,IAAI,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 8283006042ac9..8f8fd8e84b375 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -10,22 +10,18 @@ sourceFile:sourceMap-FileWithComments.ts ------------------------------------------------------------------- >>>// Module 1 > -2 > -3 >^^^^^^^^^ -4 > ^^^-> +2 >^^^^^^^^^ +3 > ^^^-> 1 > >// Interface >interface IPoint { > getDist(): number; >} > - >// Module > -2 > -3 >// Module -1 >Emitted(1, 1) Source(8, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) -3 >Emitted(1, 10) Source(7, 10) + SourceIndex(0) +2 >// Module +1 >Emitted(1, 1) Source(7, 1) + SourceIndex(0) +2 >Emitted(1, 10) Source(7, 10) + SourceIndex(0) --- >>>var Shapes; 1-> @@ -86,26 +82,27 @@ sourceFile:sourceMap-FileWithComments.ts --- >>> // Class 1 >^^^^ -2 > -3 > ^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^-> 1 > > - > // Class > -2 > -3 > // Class -1 >Emitted(4, 5) Source(11, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(4, 5) Source(10, 5) + SourceIndex(0) name (Shapes) -3 >Emitted(4, 13) Source(10, 13) + SourceIndex(0) name (Shapes) +2 > // Class +1 >Emitted(4, 5) Source(10, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(4, 13) Source(10, 13) + SourceIndex(0) name (Shapes) --- >>> var Point = (function () { +1->^^^^ +2 > ^^^^^^^^^^^^^^^^^^^-> +1-> + > +1->Emitted(5, 5) Source(11, 5) + SourceIndex(0) name (Shapes) +--- >>> // Constructor 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^ 3 > ^^^^^^^^^-> -1-> - > export class Point implements IPoint { +1->export class Point implements IPoint { > 2 > // Constructor 1->Emitted(6, 9) Source(12, 9) + SourceIndex(0) name (Shapes.Point) @@ -380,36 +377,35 @@ sourceFile:sourceMap-FileWithComments.ts --- >>> // Variable comment after class 1->^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - > // Variable comment after class > -2 > -3 > // Variable comment after class -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) +2 > // Variable comment after class +1->Emitted(18, 5) Source(22, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(18, 36) Source(22, 36) + SourceIndex(0) name (Shapes) --- >>> var a = 10; -1 >^^^^^^^^ -2 > ^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^-> +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^-> 1 > - > var -2 > a -3 > = -4 > 10 -5 > ; -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) + > +2 > var +3 > a +4 > = +5 > 10 +6 > ; +1 >Emitted(19, 5) Source(23, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(19, 9) Source(23, 9) + SourceIndex(0) name (Shapes) +3 >Emitted(19, 10) Source(23, 10) + SourceIndex(0) name (Shapes) +4 >Emitted(19, 13) Source(23, 13) + SourceIndex(0) name (Shapes) +5 >Emitted(19, 15) Source(23, 15) + SourceIndex(0) name (Shapes) +6 >Emitted(19, 16) Source(23, 16) + SourceIndex(0) name (Shapes) --- >>> function foo() { 1->^^^^ @@ -447,17 +443,11 @@ sourceFile:sourceMap-FileWithComments.ts --- >>> /** comment after function 1->^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > - > /** comment after function - > * this is another comment - > */ > -2 > -1->Emitted(23, 5) Source(31, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(23, 5) Source(28, 5) + SourceIndex(0) name (Shapes) +1->Emitted(23, 5) Source(28, 5) + SourceIndex(0) name (Shapes) --- >>> * this is another comment >>> */ @@ -469,23 +459,26 @@ sourceFile:sourceMap-FileWithComments.ts 1->Emitted(25, 7) Source(30, 7) + SourceIndex(0) name (Shapes) --- >>> var b = 10; -1->^^^^^^^^ -2 > ^ -3 > ^^^ -4 > ^^ -5 > ^ -6 > ^^^^^^^^^^^^^^-> +1->^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^-> 1-> - > var -2 > b -3 > = -4 > 10 -5 > ; -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) + > +2 > var +3 > b +4 > = +5 > 10 +6 > ; +1->Emitted(26, 5) Source(31, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(26, 9) Source(31, 9) + SourceIndex(0) name (Shapes) +3 >Emitted(26, 10) Source(31, 10) + SourceIndex(0) name (Shapes) +4 >Emitted(26, 13) Source(31, 13) + SourceIndex(0) name (Shapes) +5 >Emitted(26, 15) Source(31, 15) + SourceIndex(0) name (Shapes) +6 >Emitted(26, 16) Source(31, 16) + SourceIndex(0) name (Shapes) --- >>>})(Shapes || (Shapes = {})); 1-> @@ -537,60 +530,59 @@ sourceFile:sourceMap-FileWithComments.ts --- >>>/** Local Variable */ 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^-> 1 > > - >/** Local Variable */ > -2 > -3 >/** Local Variable */ -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) +2 >/** Local Variable */ +1 >Emitted(28, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(28, 22) Source(34, 22) + SourceIndex(0) --- >>>var p = new Shapes.Point(3, 4); -1->^^^^ -2 > ^ -3 > ^^^ -4 > ^^^^ -5 > ^^^^^^ -6 > ^ -7 > ^^^^^ -8 > ^ -9 > ^ -10> ^^ -11> ^ -12> ^ -13> ^ +1-> +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ 1-> - >var -2 > p -3 > : IPoint = -4 > new -5 > Shapes -6 > . -7 > Point -8 > ( -9 > 3 -10> , -11> 4 -12> ) -13> ; -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) + > +2 >var +3 > p +4 > : IPoint = +5 > new +6 > Shapes +7 > . +8 > Point +9 > ( +10> 3 +11> , +12> 4 +13> ) +14> ; +1->Emitted(29, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(29, 5) Source(35, 5) + SourceIndex(0) +3 >Emitted(29, 6) Source(35, 6) + SourceIndex(0) +4 >Emitted(29, 9) Source(35, 17) + SourceIndex(0) +5 >Emitted(29, 13) Source(35, 21) + SourceIndex(0) +6 >Emitted(29, 19) Source(35, 27) + SourceIndex(0) +7 >Emitted(29, 20) Source(35, 28) + SourceIndex(0) +8 >Emitted(29, 25) Source(35, 33) + SourceIndex(0) +9 >Emitted(29, 26) Source(35, 34) + SourceIndex(0) +10>Emitted(29, 27) Source(35, 35) + SourceIndex(0) +11>Emitted(29, 29) Source(35, 37) + SourceIndex(0) +12>Emitted(29, 30) Source(35, 38) + SourceIndex(0) +13>Emitted(29, 31) Source(35, 39) + SourceIndex(0) +14>Emitted(29, 32) Source(35, 40) + SourceIndex(0) --- >>>var dist = p.getDist(); 1 > diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map index 217105d88d287..7f6604004701c 100644 --- a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map @@ -1,2 +1,2 @@ //// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map] -{"version":3,"file":"sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts"],"names":["Q","Q.P"],"mappings":"AAAA,IAAO,CAAC,CAKP;AALD,WAAO,CAAC,EAAC,CAAC;IACNA;QAEIC,AADAA,YAAYA;YACRA,CAACA,GAAGA,CAACA,CAACA;IACdA,CAACA;AACLD,CAACA,EALM,CAAC,KAAD,CAAC,QAKP"} \ No newline at end of file +{"version":3,"file":"sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts"],"names":["Q","Q.P"],"mappings":"AAAA,IAAO,CAAC,CAKP;AALD,WAAO,CAAC,EAAC,CAAC;IACNA;QACIC,YAAYA;QACZA,IAAIA,CAACA,GAAGA,CAACA,CAACA;IACdA,CAACA;AACLD,CAACA,EALM,CAAC,KAAD,CAAC,QAKP"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt index 669481b46a2a2..5413f4bbc2322 100644 --- a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt @@ -55,34 +55,33 @@ sourceFile:sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.t --- >>> // Test this 1->^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^ 1->function P() { - > // Test this > -2 > -3 > // Test this -1->Emitted(4, 9) Source(4, 9) + SourceIndex(0) name (Q.P) -2 >Emitted(4, 9) Source(3, 9) + SourceIndex(0) name (Q.P) -3 >Emitted(4, 21) Source(3, 21) + SourceIndex(0) name (Q.P) +2 > // Test this +1->Emitted(4, 9) Source(3, 9) + SourceIndex(0) name (Q.P) +2 >Emitted(4, 21) Source(3, 21) + SourceIndex(0) name (Q.P) --- >>> var a = 1; -1 >^^^^^^^^^^^^ -2 > ^ -3 > ^^^ -4 > ^ -5 > ^ +1 >^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ 1 > - > var -2 > a -3 > = -4 > 1 -5 > ; -1 >Emitted(5, 13) Source(4, 13) + SourceIndex(0) name (Q.P) -2 >Emitted(5, 14) Source(4, 14) + SourceIndex(0) name (Q.P) -3 >Emitted(5, 17) Source(4, 17) + SourceIndex(0) name (Q.P) -4 >Emitted(5, 18) Source(4, 18) + SourceIndex(0) name (Q.P) -5 >Emitted(5, 19) Source(4, 19) + SourceIndex(0) name (Q.P) + > +2 > var +3 > a +4 > = +5 > 1 +6 > ; +1 >Emitted(5, 9) Source(4, 9) + SourceIndex(0) name (Q.P) +2 >Emitted(5, 13) Source(4, 13) + SourceIndex(0) name (Q.P) +3 >Emitted(5, 14) Source(4, 14) + SourceIndex(0) name (Q.P) +4 >Emitted(5, 17) Source(4, 17) + SourceIndex(0) name (Q.P) +5 >Emitted(5, 18) Source(4, 18) + SourceIndex(0) name (Q.P) +6 >Emitted(5, 19) Source(4, 19) + SourceIndex(0) name (Q.P) --- >>> } 1 >^^^^ diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map index 7a84caf3879bf..bdfba243ab673 100644 --- a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map @@ -1,2 +1,2 @@ //// [sourceMapForFunctionWithCommentPrecedingStatement01.js.map] -{"version":3,"file":"sourceMapForFunctionWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionWithCommentPrecedingStatement01.ts"],"names":["P"],"mappings":"AAAA;IAEIA,AADAA,YAAYA;QACRA,CAACA,GAAGA,CAACA,CAACA;AACdA,CAACA"} \ No newline at end of file +{"version":3,"file":"sourceMapForFunctionWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionWithCommentPrecedingStatement01.ts"],"names":["P"],"mappings":"AAAA;IACIA,YAAYA;IACZA,IAAIA,CAACA,GAAGA,CAACA,CAACA;AACdA,CAACA"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt index cbeed192d3115..65037c694374c 100644 --- a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt @@ -16,34 +16,33 @@ sourceFile:sourceMapForFunctionWithCommentPrecedingStatement01.ts --- >>> // Test this 1->^^^^ -2 > -3 > ^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^ 1->function P() { - > // Test this > -2 > -3 > // Test this -1->Emitted(2, 5) Source(3, 5) + SourceIndex(0) name (P) -2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (P) -3 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) name (P) +2 > // Test this +1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (P) +2 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) name (P) --- >>> var a = 1; -1 >^^^^^^^^ -2 > ^ -3 > ^^^ -4 > ^ -5 > ^ +1 >^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ 1 > - > var -2 > a -3 > = -4 > 1 -5 > ; -1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (P) -2 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) name (P) -3 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) name (P) -4 >Emitted(3, 14) Source(3, 14) + SourceIndex(0) name (P) -5 >Emitted(3, 15) Source(3, 15) + SourceIndex(0) name (P) + > +2 > var +3 > a +4 > = +5 > 1 +6 > ; +1 >Emitted(3, 5) Source(3, 5) + SourceIndex(0) name (P) +2 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (P) +3 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) name (P) +4 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) name (P) +5 >Emitted(3, 14) Source(3, 14) + SourceIndex(0) name (P) +6 >Emitted(3, 15) Source(3, 15) + SourceIndex(0) name (P) --- >>>} 1 > diff --git a/tests/baselines/reference/sourceMapValidationClasses.js.map b/tests/baselines/reference/sourceMapValidationClasses.js.map index e3ffe2de45468..fcba248ef1a00 100644 --- a/tests/baselines/reference/sourceMapValidationClasses.js.map +++ b/tests/baselines/reference/sourceMapValidationClasses.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationClasses.js.map] -{"version":3,"file":"sourceMapValidationClasses.js","sourceRoot":"","sources":["sourceMapValidationClasses.ts"],"names":["Foo","Foo.Bar","Foo.Bar.Greeter","Foo.Bar.Greeter.constructor","Foo.Bar.Greeter.greet","Foo.Bar.foo","Foo.Bar.foo2"],"mappings":"AAAA,IAAO,GAAG,CAmCT;AAnCD,WAAO,GAAG;IAACA,IAAAA,GAAGA,CAmCbA;IAnCUA,WAAAA,GAAGA,EAACA,CAACA;QACZC,YAAYA,CAACA;QAEbA;YACIC,iBAAmBA,QAAgBA;gBAAhBC,aAAQA,GAARA,QAAQA,CAAQA;YACnCA,CAACA;YAEDD,uBAAKA,GAALA;gBACIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;YAC5CA,CAACA;YACLF,cAACA;QAADA,CAACA,AAPDD,IAOCA;QAGDA,aAAaA,QAAgBA;YACzBI,MAAMA,CAACA,IAAIA,OAAOA,CAACA,QAAQA,CAACA,CAACA;QACjCA,CAACA;QAEDJ,IAAIA,OAAOA,GAAGA,IAAIA,OAAOA,CAACA,eAAeA,CAACA,CAACA;QAC3CA,IAAIA,GAAGA,GAAGA,OAAOA,CAACA,KAAKA,EAAEA,CAACA;QAE1BA,cAAcA,QAAgBA;YAAEK,kBAAiBA,mBAAmBA,MAAUA;iBAA9CA,WAA8CA,CAA9CA,sBAA8CA,CAA9CA,IAA8CA;gBAA9CA,cAAiBA,mBAAmBA,yBAAUA;;YAC1EA,IAAIA,QAAQA,GAAcA,EAAEA,EAAEA,0BAA0BA,AAA3BA;YAC7BA,QAAQA,CAACA,CAACA,CAACA,GAAGA,IAAIA,OAAOA,CAACA,QAAQA,CAACA,CAACA;YACpCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,aAAaA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;gBAC5CA,QAAQA,CAACA,IAAIA,CAACA,IAAIA,OAAOA,CAACA,aAAaA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;YACjDA,CAACA;YAEDA,MAAMA,CAACA,QAAQA,CAACA;QACpBA,CAACA;QAEDL,IAAIA,CAACA,GAAGA,IAAIA,CAACA,OAAOA,EAAEA,OAAOA,EAAEA,GAAGA,CAACA,CAACA;QAEpCA,AADAA,qCAAqCA;QACrCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,CAACA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;YAChCA,CAACA,CAACA,CAACA,CAACA,CAACA,KAAKA,EAAEA,CAACA;QACjBA,CAACA;IACLA,CAACA,EAnCUD,GAAGA,GAAHA,OAAGA,KAAHA,OAAGA,QAmCbA;AAADA,CAACA,EAnCM,GAAG,KAAH,GAAG,QAmCT"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationClasses.js","sourceRoot":"","sources":["sourceMapValidationClasses.ts"],"names":["Foo","Foo.Bar","Foo.Bar.Greeter","Foo.Bar.Greeter.constructor","Foo.Bar.Greeter.greet","Foo.Bar.foo","Foo.Bar.foo2"],"mappings":"AAAA,IAAO,GAAG,CAmCT;AAnCD,WAAO,GAAG;IAACA,IAAAA,GAAGA,CAmCbA;IAnCUA,WAAAA,GAAGA,EAACA,CAACA;QACZC,YAAYA,CAACA;QAEbA;YACIC,iBAAmBA,QAAgBA;gBAAhBC,aAAQA,GAARA,QAAQA,CAAQA;YACnCA,CAACA;YAEDD,uBAAKA,GAALA;gBACIE,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,QAAQA,GAAGA,OAAOA,CAACA;YAC5CA,CAACA;YACLF,cAACA;QAADA,CAACA,AAPDD,IAOCA;QAGDA,aAAaA,QAAgBA;YACzBI,MAAMA,CAACA,IAAIA,OAAOA,CAACA,QAAQA,CAACA,CAACA;QACjCA,CAACA;QAEDJ,IAAIA,OAAOA,GAAGA,IAAIA,OAAOA,CAACA,eAAeA,CAACA,CAACA;QAC3CA,IAAIA,GAAGA,GAAGA,OAAOA,CAACA,KAAKA,EAAEA,CAACA;QAE1BA,cAAcA,QAAgBA;YAAEK,kBAAiBA,mBAAmBA,MAAUA;iBAA9CA,WAA8CA,CAA9CA,sBAA8CA,CAA9CA,IAA8CA;gBAA9CA,cAAiBA,mBAAmBA,yBAAUA;;YAC1EA,IAAIA,QAAQA,GAAcA,EAAEA,CAACA,CAACA,0BAA0BA;YACxDA,QAAQA,CAACA,CAACA,CAACA,GAAGA,IAAIA,OAAOA,CAACA,QAAQA,CAACA,CAACA;YACpCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,aAAaA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;gBAC5CA,QAAQA,CAACA,IAAIA,CAACA,IAAIA,OAAOA,CAACA,aAAaA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;YACjDA,CAACA;YAEDA,MAAMA,CAACA,QAAQA,CAACA;QACpBA,CAACA;QAEDL,IAAIA,CAACA,GAAGA,IAAIA,CAACA,OAAOA,EAAEA,OAAOA,EAAEA,GAAGA,CAACA,CAACA;QACpCA,qCAAqCA;QACrCA,GAAGA,CAACA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,CAACA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;YAChCA,CAACA,CAACA,CAACA,CAACA,CAACA,KAAKA,EAAEA,CAACA;QACjBA,CAACA;IACLA,CAACA,EAnCUD,GAAGA,GAAHA,OAAGA,KAAHA,OAAGA,QAmCbA;AAADA,CAACA,EAnCM,GAAG,KAAH,GAAG,QAmCT"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt index 6d937785cc804..4eb5e300422b5 100644 --- a/tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClasses.sourcemap.txt @@ -479,26 +479,26 @@ sourceFile:sourceMapValidationClasses.ts 3 > ^^^^^^^^ 4 > ^^^ 5 > ^^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ -8 > +6 > ^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 >) { > 2 > var 3 > greeters 4 > : Greeter[] = 5 > [] -6 > ; -7 > /* inline block comment */ -8 > +6 > ; +7 > +8 > /* inline block comment */ 1 >Emitted(25, 13) Source(22, 9) + SourceIndex(0) name (Foo.Bar.foo2) 2 >Emitted(25, 17) Source(22, 13) + SourceIndex(0) name (Foo.Bar.foo2) 3 >Emitted(25, 25) Source(22, 21) + SourceIndex(0) name (Foo.Bar.foo2) 4 >Emitted(25, 28) Source(22, 35) + SourceIndex(0) name (Foo.Bar.foo2) 5 >Emitted(25, 30) Source(22, 37) + SourceIndex(0) name (Foo.Bar.foo2) -6 >Emitted(25, 32) Source(22, 39) + SourceIndex(0) name (Foo.Bar.foo2) -7 >Emitted(25, 58) Source(22, 65) + SourceIndex(0) name (Foo.Bar.foo2) -8 >Emitted(25, 58) Source(22, 38) + SourceIndex(0) name (Foo.Bar.foo2) +6 >Emitted(25, 31) Source(22, 38) + SourceIndex(0) name (Foo.Bar.foo2) +7 >Emitted(25, 32) Source(22, 39) + SourceIndex(0) name (Foo.Bar.foo2) +8 >Emitted(25, 58) Source(22, 65) + SourceIndex(0) name (Foo.Bar.foo2) --- >>> greeters[0] = new Greeter(greeting); 1 >^^^^^^^^^^^^ @@ -514,7 +514,7 @@ sourceFile:sourceMapValidationClasses.ts 11> ^ 12> ^ 13> ^^^^^^^^^^^^^-> -1 > /* inline block comment */ +1 > > 2 > greeters 3 > [ @@ -737,16 +737,12 @@ sourceFile:sourceMapValidationClasses.ts --- >>> // This is simple signle line comment 1->^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> - > // This is simple signle line comment > -2 > -3 > // This is simple signle line comment -1->Emitted(33, 9) Source(33, 5) + SourceIndex(0) name (Foo.Bar) -2 >Emitted(33, 9) Source(32, 5) + SourceIndex(0) name (Foo.Bar) -3 >Emitted(33, 46) Source(32, 42) + SourceIndex(0) name (Foo.Bar) +2 > // This is simple signle line comment +1->Emitted(33, 9) Source(32, 5) + SourceIndex(0) name (Foo.Bar) +2 >Emitted(33, 46) Source(32, 42) + SourceIndex(0) name (Foo.Bar) --- >>> for (var j = 0; j < b.length; j++) { 1 >^^^^^^^^ diff --git a/tests/baselines/reference/sourceMapValidationExportAssignment.js.map b/tests/baselines/reference/sourceMapValidationExportAssignment.js.map index 2846bc70e06e4..9ec681ced5284 100644 --- a/tests/baselines/reference/sourceMapValidationExportAssignment.js.map +++ b/tests/baselines/reference/sourceMapValidationExportAssignment.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationExportAssignment.js.map] -{"version":3,"file":"sourceMapValidationExportAssignment.js","sourceRoot":"","sources":["sourceMapValidationExportAssignment.ts"],"names":["a","a.constructor"],"mappings":";IAAA;QAAAA;QAEAC,CAACA;QAADD,QAACA;IAADA,CAACA,AAFD,IAEC;IACU,AAAX,OAAS,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationExportAssignment.js","sourceRoot":"","sources":["sourceMapValidationExportAssignment.ts"],"names":["a","a.constructor"],"mappings":";IAAA;QAAAA;QAEAC,CAACA;QAADD,QAACA;IAADA,CAACA,AAFD,IAEC;IACD,OAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationExportAssignment.sourcemap.txt b/tests/baselines/reference/sourceMapValidationExportAssignment.sourcemap.txt index 58810df106b4b..cf4adb6d5eaf3 100644 --- a/tests/baselines/reference/sourceMapValidationExportAssignment.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationExportAssignment.sourcemap.txt @@ -59,21 +59,18 @@ sourceFile:sourceMapValidationExportAssignment.ts --- >>> return a; 1->^^^^ -2 > -3 > ^^^^^^^ -4 > ^ -5 > ^ +2 > ^^^^^^^ +3 > ^ +4 > ^ 1-> - >export = a; -2 > -3 > export = -4 > a -5 > ; -1->Emitted(7, 5) Source(4, 12) + SourceIndex(0) -2 >Emitted(7, 5) Source(4, 1) + SourceIndex(0) -3 >Emitted(7, 12) Source(4, 10) + SourceIndex(0) -4 >Emitted(7, 13) Source(4, 11) + SourceIndex(0) -5 >Emitted(7, 14) Source(4, 12) + SourceIndex(0) + > +2 > export = +3 > a +4 > ; +1->Emitted(7, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(7, 12) Source(4, 10) + SourceIndex(0) +3 >Emitted(7, 13) Source(4, 11) + SourceIndex(0) +4 >Emitted(7, 14) Source(4, 12) + SourceIndex(0) --- >>>}); >>>//# sourceMappingURL=sourceMapValidationExportAssignment.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.js.map b/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.js.map index f3d29aaebf869..6da5d0f075ea1 100644 --- a/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.js.map +++ b/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationExportAssignmentCommonjs.js.map] -{"version":3,"file":"sourceMapValidationExportAssignmentCommonjs.js","sourceRoot":"","sources":["sourceMapValidationExportAssignmentCommonjs.ts"],"names":["a","a.constructor"],"mappings":"AAAA;IAAAA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC;AACU,AAAX,iBAAS,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationExportAssignmentCommonjs.js","sourceRoot":"","sources":["sourceMapValidationExportAssignmentCommonjs.ts"],"names":["a","a.constructor"],"mappings":"AAAA;IAAAA;IAEAC,CAACA;IAADD,QAACA;AAADA,CAACA,AAFD,IAEC;AACD,iBAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.sourcemap.txt b/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.sourcemap.txt index a78364591f96d..fc7862c8ad439 100644 --- a/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationExportAssignmentCommonjs.sourcemap.txt @@ -58,21 +58,18 @@ sourceFile:sourceMapValidationExportAssignmentCommonjs.ts --- >>>module.exports = a; 1-> -2 > -3 >^^^^^^^^^^^^^^^^^ -4 > ^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +2 >^^^^^^^^^^^^^^^^^ +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> - >export = a; -2 > -3 >export = -4 > a -5 > ; -1->Emitted(6, 1) Source(4, 12) + SourceIndex(0) -2 >Emitted(6, 1) Source(4, 1) + SourceIndex(0) -3 >Emitted(6, 18) Source(4, 10) + SourceIndex(0) -4 >Emitted(6, 19) Source(4, 11) + SourceIndex(0) -5 >Emitted(6, 20) Source(4, 12) + SourceIndex(0) + > +2 >export = +3 > a +4 > ; +1->Emitted(6, 1) Source(4, 1) + SourceIndex(0) +2 >Emitted(6, 18) Source(4, 10) + SourceIndex(0) +3 >Emitted(6, 19) Source(4, 11) + SourceIndex(0) +4 >Emitted(6, 20) Source(4, 12) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMapValidationExportAssignmentCommonjs.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationWithComments.js.map b/tests/baselines/reference/sourceMapValidationWithComments.js.map index fe250495802dd..59c8ee5748e68 100644 --- a/tests/baselines/reference/sourceMapValidationWithComments.js.map +++ b/tests/baselines/reference/sourceMapValidationWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMapValidationWithComments.js.map] -{"version":3,"file":"sourceMapValidationWithComments.js","sourceRoot":"","sources":["sourceMapValidationWithComments.ts"],"names":["DebugClass","DebugClass.constructor","DebugClass.debugFunc"],"mappings":"AAAA;IAAAA;IAoBAC,CAACA;IAlBiBD,oBAASA,GAAvBA;QAGIE,AADAA,2BAA2BA;YACvBA,CAACA,GAAGA,CAACA,CAACA;QACVA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QAIJA,AAHAA,yBAAyBA;QAGzBA,MAAMA,CAACA,IAAIA,CAACA;IAChBA,CAACA;IACLF,iBAACA;AAADA,CAACA,AApBD,IAoBC"} \ No newline at end of file +{"version":3,"file":"sourceMapValidationWithComments.js","sourceRoot":"","sources":["sourceMapValidationWithComments.ts"],"names":["DebugClass","DebugClass.constructor","DebugClass.debugFunc"],"mappings":"AAAA;IAAAA;IAoBAC,CAACA;IAlBiBD,oBAASA,GAAvBA;QAEIE,2BAA2BA;QAC3BA,IAAIA,CAACA,GAAGA,CAACA,CAACA;QACVA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,CAACA,EAAEA,CAACA;QACJA,yBAAyBA;QAGzBA,MAAMA,CAACA,IAAIA,CAACA;IAChBA,CAACA;IACLF,iBAACA;AAADA,CAACA,AApBD,IAoBC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapValidationWithComments.sourcemap.txt b/tests/baselines/reference/sourceMapValidationWithComments.sourcemap.txt index 5d2716cd1274e..239a418183fc6 100644 --- a/tests/baselines/reference/sourceMapValidationWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationWithComments.sourcemap.txt @@ -63,35 +63,34 @@ sourceFile:sourceMapValidationWithComments.ts --- >>> // Start Debugger Test Code 1->^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1->public static debugFunc() { > - > // Start Debugger Test Code > -2 > -3 > // Start Debugger Test Code -1->Emitted(5, 9) Source(6, 9) + SourceIndex(0) name (DebugClass.debugFunc) -2 >Emitted(5, 9) Source(5, 9) + SourceIndex(0) name (DebugClass.debugFunc) -3 >Emitted(5, 36) Source(5, 36) + SourceIndex(0) name (DebugClass.debugFunc) +2 > // Start Debugger Test Code +1->Emitted(5, 9) Source(5, 9) + SourceIndex(0) name (DebugClass.debugFunc) +2 >Emitted(5, 36) Source(5, 36) + SourceIndex(0) name (DebugClass.debugFunc) --- >>> var i = 0; -1 >^^^^^^^^^^^^ -2 > ^ -3 > ^^^ -4 > ^ -5 > ^ +1 >^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ 1 > - > var -2 > i -3 > = -4 > 0 -5 > ; -1 >Emitted(6, 13) Source(6, 13) + SourceIndex(0) name (DebugClass.debugFunc) -2 >Emitted(6, 14) Source(6, 14) + SourceIndex(0) name (DebugClass.debugFunc) -3 >Emitted(6, 17) Source(6, 17) + SourceIndex(0) name (DebugClass.debugFunc) -4 >Emitted(6, 18) Source(6, 18) + SourceIndex(0) name (DebugClass.debugFunc) -5 >Emitted(6, 19) Source(6, 19) + SourceIndex(0) name (DebugClass.debugFunc) + > +2 > var +3 > i +4 > = +5 > 0 +6 > ; +1 >Emitted(6, 9) Source(6, 9) + SourceIndex(0) name (DebugClass.debugFunc) +2 >Emitted(6, 13) Source(6, 13) + SourceIndex(0) name (DebugClass.debugFunc) +3 >Emitted(6, 14) Source(6, 14) + SourceIndex(0) name (DebugClass.debugFunc) +4 >Emitted(6, 17) Source(6, 17) + SourceIndex(0) name (DebugClass.debugFunc) +5 >Emitted(6, 18) Source(6, 18) + SourceIndex(0) name (DebugClass.debugFunc) +6 >Emitted(6, 19) Source(6, 19) + SourceIndex(0) name (DebugClass.debugFunc) --- >>> i++; 1 >^^^^^^^^ @@ -239,18 +238,12 @@ sourceFile:sourceMapValidationWithComments.ts --- >>> // End Debugger Test Code 1->^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> - > // End Debugger Test Code - > - > > -2 > -3 > // End Debugger Test Code -1->Emitted(16, 9) Source(19, 9) + SourceIndex(0) name (DebugClass.debugFunc) -2 >Emitted(16, 9) Source(16, 9) + SourceIndex(0) name (DebugClass.debugFunc) -3 >Emitted(16, 34) Source(16, 34) + SourceIndex(0) name (DebugClass.debugFunc) +2 > // End Debugger Test Code +1->Emitted(16, 9) Source(16, 9) + SourceIndex(0) name (DebugClass.debugFunc) +2 >Emitted(16, 34) Source(16, 34) + SourceIndex(0) name (DebugClass.debugFunc) --- >>> return true; 1 >^^^^^^^^ diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js.map b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js.map index cc528f82334c5..d10b3f8f28160 100644 --- a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js.map +++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.js.map @@ -1,2 +1,2 @@ //// [fooResult.js.map] -{"version":3,"file":"fooResult.js","sourceRoot":"","sources":["../testFiles/app.ts","../testFiles/app2.ts"],"names":["c","c.constructor","d","d.constructor"],"mappings":"AAEA,AAFA,gFAAgF;AAChF,wIAAwI;;IACxIA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC;ACHD;IAAAE;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file +{"version":3,"file":"fooResult.js","sourceRoot":"","sources":["../testFiles/app.ts","../testFiles/app2.ts"],"names":["c","c.constructor","d","d.constructor"],"mappings":"AAAA,gFAAgF;AAChF,wIAAwI;AACxI;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC;ACHD;IAAAE;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.sourcemap.txt b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.sourcemap.txt index b26b7c71db643..fdc67bf563d8c 100644 --- a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.sourcemap.txt +++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNames.sourcemap.txt @@ -10,17 +10,12 @@ sourceFile:../testFiles/app.ts ------------------------------------------------------------------- >>>// Note in the out result we are using same folder name only different in casing 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >// Note in the out result we are using same folder name only different in casing - >// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts - > -2 > -3 >// Note in the out result we are using same folder name only different in casing -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 81) Source(1, 81) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >// Note in the out result we are using same folder name only different in casing +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 81) Source(1, 81) + SourceIndex(0) --- >>>// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts 1-> @@ -32,12 +27,17 @@ sourceFile:../testFiles/app.ts 2 >Emitted(2, 137) Source(2, 137) + SourceIndex(0) --- >>>var c = (function () { ->>> function c() { -1 >^^^^ -2 > ^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c) +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +--- +>>> function c() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c) --- >>> } 1->^^^^ diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map index b27ad076cc8c3..5317cf7c306df 100644 --- a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map +++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map @@ -1,3 +1,3 @@ //// [app.js.map] -{"version":3,"file":"app.js","sourceRoot":"","sources":["../testFiles/app.ts"],"names":["c","c.constructor"],"mappings":"AAEA,AAFA,gFAAgF;AAChF,wIAAwI;;IACxIA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}//// [app2.js.map] +{"version":3,"file":"app.js","sourceRoot":"","sources":["../testFiles/app.ts"],"names":["c","c.constructor"],"mappings":"AAAA,gFAAgF;AAChF,wIAAwI;AACxI;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}//// [app2.js.map] {"version":3,"file":"app2.js","sourceRoot":"","sources":["../testFiles/app2.ts"],"names":["d","d.constructor"],"mappings":"AAAA;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.sourcemap.txt b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.sourcemap.txt index 6064ee003df42..44dd1b4104852 100644 --- a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.sourcemap.txt +++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.sourcemap.txt @@ -10,17 +10,12 @@ sourceFile:../testFiles/app.ts ------------------------------------------------------------------- >>>// Note in the out result we are using same folder name only different in casing 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >// Note in the out result we are using same folder name only different in casing - >// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts - > -2 > -3 >// Note in the out result we are using same folder name only different in casing -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 81) Source(1, 81) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >// Note in the out result we are using same folder name only different in casing +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 81) Source(1, 81) + SourceIndex(0) --- >>>// Since this is case sensitive, the folders are different and hence the relative paths in sourcemap shouldn't be just app.ts or app2.ts 1-> @@ -32,12 +27,17 @@ sourceFile:../testFiles/app.ts 2 >Emitted(2, 137) Source(2, 137) + SourceIndex(0) --- >>>var c = (function () { ->>> function c() { -1 >^^^^ -2 > ^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c) +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +--- +>>> function c() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c) --- >>> } 1->^^^^ diff --git a/tests/baselines/reference/sourceMapWithMultipleFilesWithCopyright.js.map b/tests/baselines/reference/sourceMapWithMultipleFilesWithCopyright.js.map index 59e28d92f9096..5d866e941db81 100644 --- a/tests/baselines/reference/sourceMapWithMultipleFilesWithCopyright.js.map +++ b/tests/baselines/reference/sourceMapWithMultipleFilesWithCopyright.js.map @@ -1,2 +1,2 @@ //// [a.js.map] -{"version":3,"file":"a.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":"AAAA;;6EAE6E;AAE7E,IAAI,CAAC,GAAG;IACJ,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;CACR,CAAC;ACPF;;6EAE6E;AAG7E,AADA,2BAA2B;IACvB,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"a.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/b.ts"],"names":[],"mappings":"AAAA;;6EAE6E;AAE7E,IAAI,CAAC,GAAG;IACJ,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;CACR,CAAC;ACPF;;6EAE6E;AAE7E,2BAA2B;AAC3B,IAAI,CAAC,GAAG,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithMultipleFilesWithCopyright.sourcemap.txt b/tests/baselines/reference/sourceMapWithMultipleFilesWithCopyright.sourcemap.txt index 5a87f6c04e8fb..f3f3dffd9dce1 100644 --- a/tests/baselines/reference/sourceMapWithMultipleFilesWithCopyright.sourcemap.txt +++ b/tests/baselines/reference/sourceMapWithMultipleFilesWithCopyright.sourcemap.txt @@ -100,35 +100,34 @@ sourceFile:tests/cases/compiler/b.ts --- >>>/// 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > > - >/// > -2 > -3 >/// -1 >Emitted(11, 1) Source(6, 1) + SourceIndex(1) -2 >Emitted(11, 1) Source(5, 1) + SourceIndex(1) -3 >Emitted(11, 28) Source(5, 28) + SourceIndex(1) +2 >/// +1 >Emitted(11, 1) Source(5, 1) + SourceIndex(1) +2 >Emitted(11, 28) Source(5, 28) + SourceIndex(1) --- >>>var y = x; -1 >^^^^ -2 > ^ -3 > ^^^ -4 > ^ -5 > ^ -6 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^-> 1 > - >var -2 > y -3 > = -4 > x -5 > ; -1 >Emitted(12, 5) Source(6, 5) + SourceIndex(1) -2 >Emitted(12, 6) Source(6, 6) + SourceIndex(1) -3 >Emitted(12, 9) Source(6, 9) + SourceIndex(1) -4 >Emitted(12, 10) Source(6, 10) + SourceIndex(1) -5 >Emitted(12, 11) Source(6, 11) + SourceIndex(1) + > +2 >var +3 > y +4 > = +5 > x +6 > ; +1 >Emitted(12, 1) Source(6, 1) + SourceIndex(1) +2 >Emitted(12, 5) Source(6, 5) + SourceIndex(1) +3 >Emitted(12, 6) Source(6, 6) + SourceIndex(1) +4 >Emitted(12, 9) Source(6, 9) + SourceIndex(1) +5 >Emitted(12, 10) Source(6, 10) + SourceIndex(1) +6 >Emitted(12, 11) Source(6, 11) + SourceIndex(1) --- >>>//# sourceMappingURL=a.js.map \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js.map b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js.map index e3262d8c68614..200edeccc5b23 100644 --- a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js.map +++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.js.map @@ -1,2 +1,2 @@ //// [fooResult.js.map] -{"version":3,"file":"fooResult.js","sourceRoot":"","sources":["app.ts","app2.ts"],"names":["c","c.constructor","d","d.constructor"],"mappings":"AAEA,AAFA,gFAAgF;AAChF,0GAA0G;;IAC1GA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC;ACHD;IAAAE;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file +{"version":3,"file":"fooResult.js","sourceRoot":"","sources":["app.ts","app2.ts"],"names":["c","c.constructor","d","d.constructor"],"mappings":"AAAA,gFAAgF;AAChF,0GAA0G;AAC1G;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC;ACHD;IAAAE;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.sourcemap.txt b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.sourcemap.txt index 560fd29616d31..790d64c7963a1 100644 --- a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.sourcemap.txt +++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNames.sourcemap.txt @@ -10,17 +10,12 @@ sourceFile:app.ts ------------------------------------------------------------------- >>>// Note in the out result we are using same folder name only different in casing 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >// Note in the out result we are using same folder name only different in casing - >// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap - > -2 > -3 >// Note in the out result we are using same folder name only different in casing -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 81) Source(1, 81) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >// Note in the out result we are using same folder name only different in casing +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 81) Source(1, 81) + SourceIndex(0) --- >>>// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap 1-> @@ -32,12 +27,17 @@ sourceFile:app.ts 2 >Emitted(2, 107) Source(2, 107) + SourceIndex(0) --- >>>var c = (function () { ->>> function c() { -1 >^^^^ -2 > ^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c) +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +--- +>>> function c() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c) --- >>> } 1->^^^^ diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map index 9fff2ee3f66a4..97826d80eb896 100644 --- a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map +++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map @@ -1,3 +1,3 @@ //// [app.js.map] -{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":["c","c.constructor"],"mappings":"AAEA,AAFA,gFAAgF;AAChF,0GAA0G;;IAC1GA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}//// [app2.js.map] +{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":["c","c.constructor"],"mappings":"AAAA,gFAAgF;AAChF,0GAA0G;AAC1G;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"}//// [app2.js.map] {"version":3,"file":"app2.js","sourceRoot":"","sources":["app2.ts"],"names":["d","d.constructor"],"mappings":"AAAA;IAAAA;IACAC,CAACA;IAADD,QAACA;AAADA,CAACA,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.sourcemap.txt b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.sourcemap.txt index f91aaea6ab926..6987b7bbd2134 100644 --- a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.sourcemap.txt +++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.sourcemap.txt @@ -10,17 +10,12 @@ sourceFile:app.ts ------------------------------------------------------------------- >>>// Note in the out result we are using same folder name only different in casing 1 > -2 > -3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >// Note in the out result we are using same folder name only different in casing - >// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap - > -2 > -3 >// Note in the out result we are using same folder name only different in casing -1 >Emitted(1, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) -3 >Emitted(1, 81) Source(1, 81) + SourceIndex(0) +2 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >// Note in the out result we are using same folder name only different in casing +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 81) Source(1, 81) + SourceIndex(0) --- >>>// Since this is non case sensitive, the relative paths should be just app.ts and app2.ts in the sourcemap 1-> @@ -32,12 +27,17 @@ sourceFile:app.ts 2 >Emitted(2, 107) Source(2, 107) + SourceIndex(0) --- >>>var c = (function () { ->>> function c() { -1 >^^^^ -2 > ^^-> +1 > +2 >^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c) +1 >Emitted(3, 1) Source(3, 1) + SourceIndex(0) +--- +>>> function c() { +1->^^^^ +2 > ^^-> +1-> +1->Emitted(4, 5) Source(3, 1) + SourceIndex(0) name (c) --- >>> } 1->^^^^ diff --git a/tests/baselines/reference/stringIncludes.symbols b/tests/baselines/reference/stringIncludes.symbols index d0fa641c857e0..0f4c800faa2ca 100644 --- a/tests/baselines/reference/stringIncludes.symbols +++ b/tests/baselines/reference/stringIncludes.symbols @@ -5,11 +5,11 @@ var includes: boolean; includes = "abcde".includes("cd"); >includes : Symbol(includes, Decl(stringIncludes.ts, 1, 3)) ->"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, 1569, 37)) ->includes : Symbol(String.includes, Decl(lib.d.ts, 1569, 37)) +>"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, 4255, 37)) +>includes : Symbol(String.includes, Decl(lib.d.ts, 4255, 37)) includes = "abcde".includes("cd", 2); >includes : Symbol(includes, Decl(stringIncludes.ts, 1, 3)) ->"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, 1569, 37)) ->includes : Symbol(String.includes, Decl(lib.d.ts, 1569, 37)) +>"abcde".includes : Symbol(String.includes, Decl(lib.d.ts, 4255, 37)) +>includes : Symbol(String.includes, Decl(lib.d.ts, 4255, 37)) diff --git a/tests/baselines/reference/superSymbolIndexedAccess1.symbols b/tests/baselines/reference/superSymbolIndexedAccess1.symbols index 818d0ac52afb2..03abbf778ed53 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess1.symbols +++ b/tests/baselines/reference/superSymbolIndexedAccess1.symbols @@ -1,9 +1,9 @@ === tests/cases/conformance/expressions/superPropertyAccess/superSymbolIndexedAccess1.ts === var symbol = Symbol.for('myThing'); >symbol : Symbol(symbol, Decl(superSymbolIndexedAccess1.ts, 0, 3)) ->Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 1221, 42)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 1221, 42)) +>Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 3895, 42)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 3895, 42)) class Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess1.ts, 0, 35)) diff --git a/tests/baselines/reference/superSymbolIndexedAccess2.symbols b/tests/baselines/reference/superSymbolIndexedAccess2.symbols index 3865b920647cb..d0a130b0e72c0 100644 --- a/tests/baselines/reference/superSymbolIndexedAccess2.symbols +++ b/tests/baselines/reference/superSymbolIndexedAccess2.symbols @@ -4,9 +4,9 @@ class Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) [Symbol.isConcatSpreadable]() { ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) return 0; } @@ -17,14 +17,14 @@ class Bar extends Foo { >Foo : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) [Symbol.isConcatSpreadable]() { ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) return super[Symbol.isConcatSpreadable](); >super : Symbol(Foo, Decl(superSymbolIndexedAccess2.ts, 0, 0)) ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) } } diff --git a/tests/baselines/reference/symbolDeclarationEmit1.symbols b/tests/baselines/reference/symbolDeclarationEmit1.symbols index 9fae9d57c4f6d..ee0c2e0e67d74 100644 --- a/tests/baselines/reference/symbolDeclarationEmit1.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit1.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit1.ts, 0, 0)) [Symbol.toPrimitive]: number; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit10.symbols b/tests/baselines/reference/symbolDeclarationEmit10.symbols index 5dba2268d2641..86abfa703bb56 100644 --- a/tests/baselines/reference/symbolDeclarationEmit10.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit10.symbols @@ -3,13 +3,13 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit10.ts, 0, 3)) get [Symbol.isConcatSpreadable]() { return '' }, ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) set [Symbol.isConcatSpreadable](x) { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) >x : Symbol(x, Decl(symbolDeclarationEmit10.ts, 2, 36)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit11.symbols b/tests/baselines/reference/symbolDeclarationEmit11.symbols index a6019a364e47b..c5449c4f3eadb 100644 --- a/tests/baselines/reference/symbolDeclarationEmit11.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit11.symbols @@ -3,23 +3,23 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit11.ts, 0, 0)) static [Symbol.iterator] = 0; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) static [Symbol.isConcatSpreadable]() { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) static get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) static set [Symbol.toPrimitive](x) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit11.ts, 4, 36)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit13.symbols b/tests/baselines/reference/symbolDeclarationEmit13.symbols index e16ec7384893e..45fe98121d04f 100644 --- a/tests/baselines/reference/symbolDeclarationEmit13.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit13.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit13.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) set [Symbol.toStringTag](x) { } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) >x : Symbol(x, Decl(symbolDeclarationEmit13.ts, 2, 29)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit14.symbols b/tests/baselines/reference/symbolDeclarationEmit14.symbols index b2f520351f2c0..e6c9392d2becf 100644 --- a/tests/baselines/reference/symbolDeclarationEmit14.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit14.symbols @@ -3,12 +3,12 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit14.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) get [Symbol.toStringTag]() { return ""; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit2.symbols b/tests/baselines/reference/symbolDeclarationEmit2.symbols index 7e9d06cd332e6..84ada74498e90 100644 --- a/tests/baselines/reference/symbolDeclarationEmit2.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit2.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit2.ts, 0, 0)) [Symbol.toPrimitive] = ""; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit3.symbols b/tests/baselines/reference/symbolDeclarationEmit3.symbols index 177180b5bcae9..11b8d5d786d47 100644 --- a/tests/baselines/reference/symbolDeclarationEmit3.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit3.symbols @@ -3,20 +3,20 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit3.ts, 0, 0)) [Symbol.toPrimitive](x: number); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 1, 25)) [Symbol.toPrimitive](x: string); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 2, 25)) [Symbol.toPrimitive](x: any) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 3, 25)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit4.symbols b/tests/baselines/reference/symbolDeclarationEmit4.symbols index 98cb277ad474a..c6f9b0ecc8173 100644 --- a/tests/baselines/reference/symbolDeclarationEmit4.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit4.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit4.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) set [Symbol.toPrimitive](x) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit4.ts, 2, 29)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit5.symbols b/tests/baselines/reference/symbolDeclarationEmit5.symbols index 17bda345253bc..78ef4901982c6 100644 --- a/tests/baselines/reference/symbolDeclarationEmit5.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit5.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(symbolDeclarationEmit5.ts, 0, 0)) [Symbol.isConcatSpreadable](): string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit6.symbols b/tests/baselines/reference/symbolDeclarationEmit6.symbols index c4b046cc14607..aa6605ad1e1f8 100644 --- a/tests/baselines/reference/symbolDeclarationEmit6.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit6.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(symbolDeclarationEmit6.ts, 0, 0)) [Symbol.isConcatSpreadable]: string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit7.symbols b/tests/baselines/reference/symbolDeclarationEmit7.symbols index 58a661412da23..8ae5168ba9760 100644 --- a/tests/baselines/reference/symbolDeclarationEmit7.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit7.symbols @@ -3,7 +3,7 @@ var obj: { >obj : Symbol(obj, Decl(symbolDeclarationEmit7.ts, 0, 3)) [Symbol.isConcatSpreadable]: string; ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit8.symbols b/tests/baselines/reference/symbolDeclarationEmit8.symbols index 7879d28b02f52..185bfb4749aaa 100644 --- a/tests/baselines/reference/symbolDeclarationEmit8.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit8.symbols @@ -3,7 +3,7 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit8.ts, 0, 3)) [Symbol.isConcatSpreadable]: 0 ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit9.symbols b/tests/baselines/reference/symbolDeclarationEmit9.symbols index 17901fb713aac..241c12c0ce10c 100644 --- a/tests/baselines/reference/symbolDeclarationEmit9.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit9.symbols @@ -3,7 +3,7 @@ var obj = { >obj : Symbol(obj, Decl(symbolDeclarationEmit9.ts, 0, 3)) [Symbol.isConcatSpreadable]() { } ->Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1243, 24)) +>Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 3917, 24)) } diff --git a/tests/baselines/reference/symbolProperty11.symbols b/tests/baselines/reference/symbolProperty11.symbols index 4028da455a6eb..489bd0647d11e 100644 --- a/tests/baselines/reference/symbolProperty11.symbols +++ b/tests/baselines/reference/symbolProperty11.symbols @@ -6,9 +6,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty11.ts, 0, 11)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty11.ts, 2, 25)) } diff --git a/tests/baselines/reference/symbolProperty13.symbols b/tests/baselines/reference/symbolProperty13.symbols index 07e9b6bae2698..aef66165db638 100644 --- a/tests/baselines/reference/symbolProperty13.symbols +++ b/tests/baselines/reference/symbolProperty13.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(symbolProperty13.ts, 0, 0)) [Symbol.iterator]: { x; y }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty13.ts, 1, 24)) >y : Symbol(y, Decl(symbolProperty13.ts, 1, 27)) } @@ -13,9 +13,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty13.ts, 2, 1)) [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty13.ts, 4, 24)) } diff --git a/tests/baselines/reference/symbolProperty14.symbols b/tests/baselines/reference/symbolProperty14.symbols index d4e79a064a961..a74238412a527 100644 --- a/tests/baselines/reference/symbolProperty14.symbols +++ b/tests/baselines/reference/symbolProperty14.symbols @@ -3,9 +3,9 @@ class C { >C : Symbol(C, Decl(symbolProperty14.ts, 0, 0)) [Symbol.iterator]: { x; y }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty14.ts, 1, 24)) >y : Symbol(y, Decl(symbolProperty14.ts, 1, 27)) } @@ -13,9 +13,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty14.ts, 2, 1)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty14.ts, 4, 25)) } diff --git a/tests/baselines/reference/symbolProperty15.symbols b/tests/baselines/reference/symbolProperty15.symbols index 2a83145da03b6..d1315523f988a 100644 --- a/tests/baselines/reference/symbolProperty15.symbols +++ b/tests/baselines/reference/symbolProperty15.symbols @@ -6,9 +6,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty15.ts, 0, 11)) [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty15.ts, 2, 25)) } diff --git a/tests/baselines/reference/symbolProperty16.symbols b/tests/baselines/reference/symbolProperty16.symbols index 1b4b23e951175..bf931e5a6e5bb 100644 --- a/tests/baselines/reference/symbolProperty16.symbols +++ b/tests/baselines/reference/symbolProperty16.symbols @@ -3,18 +3,18 @@ class C { >C : Symbol(C, Decl(symbolProperty16.ts, 0, 0)) private [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty16.ts, 1, 32)) } interface I { >I : Symbol(I, Decl(symbolProperty16.ts, 2, 1)) [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty16.ts, 4, 24)) } diff --git a/tests/baselines/reference/symbolProperty18.symbols b/tests/baselines/reference/symbolProperty18.symbols index 89df72d65430d..ef0a9b12be1f7 100644 --- a/tests/baselines/reference/symbolProperty18.symbols +++ b/tests/baselines/reference/symbolProperty18.symbols @@ -3,39 +3,39 @@ var i = { >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) [Symbol.iterator]: 0, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) [Symbol.toStringTag]() { return "" }, ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) set [Symbol.toPrimitive](p: boolean) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) >p : Symbol(p, Decl(symbolProperty18.ts, 3, 29)) } var it = i[Symbol.iterator]; >it : Symbol(it, Decl(symbolProperty18.ts, 6, 3)) >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) var str = i[Symbol.toStringTag](); >str : Symbol(str, Decl(symbolProperty18.ts, 7, 3)) >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) i[Symbol.toPrimitive] = false; >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) diff --git a/tests/baselines/reference/symbolProperty19.symbols b/tests/baselines/reference/symbolProperty19.symbols index 3ee9ed595c2ad..5c47df8a7c281 100644 --- a/tests/baselines/reference/symbolProperty19.symbols +++ b/tests/baselines/reference/symbolProperty19.symbols @@ -3,15 +3,15 @@ var i = { >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) [Symbol.iterator]: { p: null }, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >p : Symbol(p, Decl(symbolProperty19.ts, 1, 24)) [Symbol.toStringTag]() { return { p: undefined }; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) >p : Symbol(p, Decl(symbolProperty19.ts, 2, 37)) >undefined : Symbol(undefined) } @@ -19,14 +19,14 @@ var i = { var it = i[Symbol.iterator]; >it : Symbol(it, Decl(symbolProperty19.ts, 5, 3)) >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) var str = i[Symbol.toStringTag](); >str : Symbol(str, Decl(symbolProperty19.ts, 6, 3)) >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) diff --git a/tests/baselines/reference/symbolProperty2.symbols b/tests/baselines/reference/symbolProperty2.symbols index b52c4087d7143..c692381d548dd 100644 --- a/tests/baselines/reference/symbolProperty2.symbols +++ b/tests/baselines/reference/symbolProperty2.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolProperty2.ts === var s = Symbol(); >s : Symbol(s, Decl(symbolProperty2.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) var x = { >x : Symbol(x, Decl(symbolProperty2.ts, 1, 3)) diff --git a/tests/baselines/reference/symbolProperty20.symbols b/tests/baselines/reference/symbolProperty20.symbols index ad4f0c7952351..312df71d65144 100644 --- a/tests/baselines/reference/symbolProperty20.symbols +++ b/tests/baselines/reference/symbolProperty20.symbols @@ -3,15 +3,15 @@ interface I { >I : Symbol(I, Decl(symbolProperty20.ts, 0, 0)) [Symbol.iterator]: (s: string) => string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >s : Symbol(s, Decl(symbolProperty20.ts, 1, 24)) [Symbol.toStringTag](s: number): number; ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) >s : Symbol(s, Decl(symbolProperty20.ts, 2, 25)) } @@ -20,16 +20,16 @@ var i: I = { >I : Symbol(I, Decl(symbolProperty20.ts, 0, 0)) [Symbol.iterator]: s => s, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >s : Symbol(s, Decl(symbolProperty20.ts, 6, 22)) >s : Symbol(s, Decl(symbolProperty20.ts, 6, 22)) [Symbol.toStringTag](n) { return n; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) >n : Symbol(n, Decl(symbolProperty20.ts, 7, 25)) >n : Symbol(n, Decl(symbolProperty20.ts, 7, 25)) } diff --git a/tests/baselines/reference/symbolProperty22.symbols b/tests/baselines/reference/symbolProperty22.symbols index b62037e32a507..0a03d95235f36 100644 --- a/tests/baselines/reference/symbolProperty22.symbols +++ b/tests/baselines/reference/symbolProperty22.symbols @@ -5,9 +5,9 @@ interface I { >U : Symbol(U, Decl(symbolProperty22.ts, 0, 14)) [Symbol.unscopables](x: T): U; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) >x : Symbol(x, Decl(symbolProperty22.ts, 1, 25)) >T : Symbol(T, Decl(symbolProperty22.ts, 0, 12)) >U : Symbol(U, Decl(symbolProperty22.ts, 0, 14)) @@ -27,9 +27,9 @@ declare function foo(p1: T, p2: I): U; foo("", { [Symbol.unscopables]: s => s.length }); >foo : Symbol(foo, Decl(symbolProperty22.ts, 2, 1)) ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) >s : Symbol(s, Decl(symbolProperty22.ts, 6, 31)) >s.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) >s : Symbol(s, Decl(symbolProperty22.ts, 6, 31)) diff --git a/tests/baselines/reference/symbolProperty23.symbols b/tests/baselines/reference/symbolProperty23.symbols index da9d07ffeed89..aa4e5a1db1431 100644 --- a/tests/baselines/reference/symbolProperty23.symbols +++ b/tests/baselines/reference/symbolProperty23.symbols @@ -3,9 +3,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty23.ts, 0, 0)) [Symbol.toPrimitive]: () => boolean; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) } class C implements I { @@ -13,9 +13,9 @@ class C implements I { >I : Symbol(I, Decl(symbolProperty23.ts, 0, 0)) [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) return true; } diff --git a/tests/baselines/reference/symbolProperty26.symbols b/tests/baselines/reference/symbolProperty26.symbols index 46babb69a87c0..36a0cc69262f0 100644 --- a/tests/baselines/reference/symbolProperty26.symbols +++ b/tests/baselines/reference/symbolProperty26.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty26.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) return ""; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(symbolProperty26.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) return ""; } diff --git a/tests/baselines/reference/symbolProperty27.symbols b/tests/baselines/reference/symbolProperty27.symbols index 69fe473e17c3f..7fe8b6229ef29 100644 --- a/tests/baselines/reference/symbolProperty27.symbols +++ b/tests/baselines/reference/symbolProperty27.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty27.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) return {}; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(symbolProperty27.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) return ""; } diff --git a/tests/baselines/reference/symbolProperty28.symbols b/tests/baselines/reference/symbolProperty28.symbols index cf6ab1f5edba1..ed0eca51a7532 100644 --- a/tests/baselines/reference/symbolProperty28.symbols +++ b/tests/baselines/reference/symbolProperty28.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty28.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) return { x: "" }; >x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) @@ -24,8 +24,8 @@ var obj = c[Symbol.toStringTag]().x; >obj : Symbol(obj, Decl(symbolProperty28.ts, 9, 3)) >c[Symbol.toStringTag]().x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) >c : Symbol(c, Decl(symbolProperty28.ts, 8, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) >x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) diff --git a/tests/baselines/reference/symbolProperty4.symbols b/tests/baselines/reference/symbolProperty4.symbols index 4e17e561bce0e..babceada22ebd 100644 --- a/tests/baselines/reference/symbolProperty4.symbols +++ b/tests/baselines/reference/symbolProperty4.symbols @@ -3,13 +3,13 @@ var x = { >x : Symbol(x, Decl(symbolProperty4.ts, 0, 3)) [Symbol()]: 0, ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) [Symbol()]() { }, ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) get [Symbol()]() { ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) return 0; } diff --git a/tests/baselines/reference/symbolProperty40.symbols b/tests/baselines/reference/symbolProperty40.symbols index e3e469764a866..def2bbba28a1f 100644 --- a/tests/baselines/reference/symbolProperty40.symbols +++ b/tests/baselines/reference/symbolProperty40.symbols @@ -3,21 +3,21 @@ class C { >C : Symbol(C, Decl(symbolProperty40.ts, 0, 0)) [Symbol.iterator](x: string): string; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty40.ts, 1, 22)) [Symbol.iterator](x: number): number; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty40.ts, 2, 22)) [Symbol.iterator](x: any) { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty40.ts, 3, 22)) return undefined; @@ -31,13 +31,13 @@ var c = new C; c[Symbol.iterator](""); >c : Symbol(c, Decl(symbolProperty40.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) c[Symbol.iterator](0); >c : Symbol(c, Decl(symbolProperty40.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) diff --git a/tests/baselines/reference/symbolProperty41.symbols b/tests/baselines/reference/symbolProperty41.symbols index 622d1b693e87f..31cdaf886eb1d 100644 --- a/tests/baselines/reference/symbolProperty41.symbols +++ b/tests/baselines/reference/symbolProperty41.symbols @@ -3,24 +3,24 @@ class C { >C : Symbol(C, Decl(symbolProperty41.ts, 0, 0)) [Symbol.iterator](x: string): { x: string }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty41.ts, 1, 22)) >x : Symbol(x, Decl(symbolProperty41.ts, 1, 35)) [Symbol.iterator](x: "hello"): { x: string; hello: string }; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty41.ts, 2, 22)) >x : Symbol(x, Decl(symbolProperty41.ts, 2, 36)) >hello : Symbol(hello, Decl(symbolProperty41.ts, 2, 47)) [Symbol.iterator](x: any) { ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >x : Symbol(x, Decl(symbolProperty41.ts, 3, 22)) return undefined; @@ -34,13 +34,13 @@ var c = new C; c[Symbol.iterator](""); >c : Symbol(c, Decl(symbolProperty41.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) c[Symbol.iterator]("hello"); >c : Symbol(c, Decl(symbolProperty41.ts, 8, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) diff --git a/tests/baselines/reference/symbolProperty45.symbols b/tests/baselines/reference/symbolProperty45.symbols index 5aba3b8c104e8..232864f299db9 100644 --- a/tests/baselines/reference/symbolProperty45.symbols +++ b/tests/baselines/reference/symbolProperty45.symbols @@ -3,16 +3,16 @@ class C { >C : Symbol(C, Decl(symbolProperty45.ts, 0, 0)) get [Symbol.hasInstance]() { ->Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, 1235, 32)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, 1235, 32)) +>Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, 3909, 32)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, 3909, 32)) return ""; } get [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) return ""; } diff --git a/tests/baselines/reference/symbolProperty5.symbols b/tests/baselines/reference/symbolProperty5.symbols index 7b57003e607a0..87a8527518a69 100644 --- a/tests/baselines/reference/symbolProperty5.symbols +++ b/tests/baselines/reference/symbolProperty5.symbols @@ -3,19 +3,19 @@ var x = { >x : Symbol(x, Decl(symbolProperty5.ts, 0, 3)) [Symbol.iterator]: 0, ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) [Symbol.toPrimitive]() { }, ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) return 0; } diff --git a/tests/baselines/reference/symbolProperty50.symbols b/tests/baselines/reference/symbolProperty50.symbols index 4beb1f6d9e2b9..dacd55626bd7b 100644 --- a/tests/baselines/reference/symbolProperty50.symbols +++ b/tests/baselines/reference/symbolProperty50.symbols @@ -9,8 +9,8 @@ module M { >C : Symbol(C, Decl(symbolProperty50.ts, 1, 24)) [Symbol.iterator]() { } ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) } } diff --git a/tests/baselines/reference/symbolProperty51.symbols b/tests/baselines/reference/symbolProperty51.symbols index 32240efd98610..834089a2313ef 100644 --- a/tests/baselines/reference/symbolProperty51.symbols +++ b/tests/baselines/reference/symbolProperty51.symbols @@ -9,8 +9,8 @@ module M { >C : Symbol(C, Decl(symbolProperty51.ts, 1, 21)) [Symbol.iterator]() { } ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) } } diff --git a/tests/baselines/reference/symbolProperty55.symbols b/tests/baselines/reference/symbolProperty55.symbols index 05eeace3b869e..1e42acc4c1648 100644 --- a/tests/baselines/reference/symbolProperty55.symbols +++ b/tests/baselines/reference/symbolProperty55.symbols @@ -3,9 +3,9 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty55.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) }; @@ -14,13 +14,13 @@ module M { var Symbol: SymbolConstructor; >Symbol : Symbol(Symbol, Decl(symbolProperty55.ts, 5, 7)) ->SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.d.ts, 1209, 1)) +>SymbolConstructor : Symbol(SymbolConstructor, Decl(lib.d.ts, 3883, 1)) // 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(obj, Decl(symbolProperty55.ts, 0, 3)) ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) >Symbol : Symbol(Symbol, Decl(symbolProperty55.ts, 5, 7)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) } diff --git a/tests/baselines/reference/symbolProperty56.symbols b/tests/baselines/reference/symbolProperty56.symbols index a4e335cc7d7c3..5b629a9f7d827 100644 --- a/tests/baselines/reference/symbolProperty56.symbols +++ b/tests/baselines/reference/symbolProperty56.symbols @@ -3,9 +3,9 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty56.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) }; diff --git a/tests/baselines/reference/symbolProperty57.symbols b/tests/baselines/reference/symbolProperty57.symbols index 249545872b1d0..4f0c9c3957eac 100644 --- a/tests/baselines/reference/symbolProperty57.symbols +++ b/tests/baselines/reference/symbolProperty57.symbols @@ -3,14 +3,14 @@ var obj = { >obj : Symbol(obj, Decl(symbolProperty57.ts, 0, 3)) [Symbol.iterator]: 0 ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) }; // Should give type 'any'. obj[Symbol["nonsense"]]; >obj : Symbol(obj, Decl(symbolProperty57.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) diff --git a/tests/baselines/reference/symbolProperty6.symbols b/tests/baselines/reference/symbolProperty6.symbols index 78be14d086222..81a9c7506aee3 100644 --- a/tests/baselines/reference/symbolProperty6.symbols +++ b/tests/baselines/reference/symbolProperty6.symbols @@ -3,24 +3,24 @@ class C { >C : Symbol(C, Decl(symbolProperty6.ts, 0, 0)) [Symbol.iterator] = 0; ->Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1249, 31)) +>Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 3923, 31)) [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) [Symbol.toPrimitive]() { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1291, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 3965, 24)) return 0; } diff --git a/tests/baselines/reference/symbolProperty8.symbols b/tests/baselines/reference/symbolProperty8.symbols index 64452f49c9c19..508407071de43 100644 --- a/tests/baselines/reference/symbolProperty8.symbols +++ b/tests/baselines/reference/symbolProperty8.symbols @@ -3,12 +3,12 @@ interface I { >I : Symbol(I, Decl(symbolProperty8.ts, 0, 0)) [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1297, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 3971, 24)) [Symbol.toPrimitive](); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1285, 18)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 3959, 18)) } diff --git a/tests/baselines/reference/symbolType11.symbols b/tests/baselines/reference/symbolType11.symbols index d40e0e7272474..2a2c5571ebbdc 100644 --- a/tests/baselines/reference/symbolType11.symbols +++ b/tests/baselines/reference/symbolType11.symbols @@ -1,9 +1,9 @@ === tests/cases/conformance/es6/Symbols/symbolType11.ts === var s = Symbol.for("logical"); >s : Symbol(s, Decl(symbolType11.ts, 0, 3)) ->Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 1221, 42)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11)) ->for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 1221, 42)) +>Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 3895, 42)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11)) +>for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 3895, 42)) s && s; >s : Symbol(s, Decl(symbolType11.ts, 0, 3)) diff --git a/tests/baselines/reference/symbolType16.symbols b/tests/baselines/reference/symbolType16.symbols index 4b61749b89873..93824ea002fb7 100644 --- a/tests/baselines/reference/symbolType16.symbols +++ b/tests/baselines/reference/symbolType16.symbols @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/Symbols/symbolType16.ts === interface Symbol { ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1199, 52), Decl(lib.d.ts, 1305, 11), Decl(symbolType16.ts, 0, 0)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 3873, 52), Decl(lib.d.ts, 3979, 11), Decl(symbolType16.ts, 0, 0)) newSymbolProp: number; >newSymbolProp : Symbol(newSymbolProp, Decl(symbolType16.ts, 0, 18)) diff --git a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols index baa4613d26b46..8da8897f0038e 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedNewOperatorES6.ts === var x = `abc${ new String("Hi") }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedNewOperatorES6.ts, 0, 3)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1556, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 4242, 1)) diff --git a/tests/baselines/reference/tsxElementResolution13.types b/tests/baselines/reference/tsxElementResolution13.types index cd6265de0911a..613835f32113e 100644 --- a/tests/baselines/reference/tsxElementResolution13.types +++ b/tests/baselines/reference/tsxElementResolution13.types @@ -25,4 +25,5 @@ var obj1: Obj1; > : JSX.Element >obj1 : Obj1 >x : any +>10 : number diff --git a/tests/baselines/reference/tsxElementResolution14.types b/tests/baselines/reference/tsxElementResolution14.types index ef03187d28ecb..80f9555030fc2 100644 --- a/tests/baselines/reference/tsxElementResolution14.types +++ b/tests/baselines/reference/tsxElementResolution14.types @@ -20,4 +20,5 @@ var obj1: Obj1; > : JSX.Element >obj1 : Obj1 >x : any +>10 : number diff --git a/tests/baselines/reference/tsxElementResolution9.types b/tests/baselines/reference/tsxElementResolution9.types index 525e4600b2ee8..6725bd216bd33 100644 --- a/tests/baselines/reference/tsxElementResolution9.types +++ b/tests/baselines/reference/tsxElementResolution9.types @@ -67,4 +67,5 @@ var Obj3: Obj3; > : JSX.Element >Obj3 : Obj3 >x : any +>42 : number diff --git a/tests/baselines/reference/tsxEmit1.symbols b/tests/baselines/reference/tsxEmit1.symbols index b7c8cde024ab2..aaca98ae9dbf3 100644 --- a/tests/baselines/reference/tsxEmit1.symbols +++ b/tests/baselines/reference/tsxEmit1.symbols @@ -52,6 +52,7 @@ var selfClosed7 =
; >selfClosed7 : Symbol(selfClosed7, Decl(tsxEmit1.tsx, 14, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22)) >x : Symbol(unknown) +>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3)) >y : Symbol(unknown) var openClosed1 =
; @@ -69,6 +70,7 @@ var openClosed3 =
{p}
; >openClosed3 : Symbol(openClosed3, Decl(tsxEmit1.tsx, 18, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22)) >n : Symbol(unknown) +>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22)) var openClosed4 =
{p < p}
; @@ -146,6 +148,7 @@ var whitespace1 =
; var whitespace2 =
{p}
; >whitespace2 : Symbol(whitespace2, Decl(tsxEmit1.tsx, 35, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22)) +>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22)) var whitespace3 =
@@ -153,6 +156,8 @@ var whitespace3 =
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22)) {p} +>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3)) +
; >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22)) diff --git a/tests/baselines/reference/tsxEmit1.types b/tests/baselines/reference/tsxEmit1.types index 667ec11333770..a427270354ea8 100644 --- a/tests/baselines/reference/tsxEmit1.types +++ b/tests/baselines/reference/tsxEmit1.types @@ -45,6 +45,7 @@ var selfClosed5 =
; >
: JSX.Element >div : any >x : any +>0 : number >y : any var selfClosed6 =
; @@ -52,6 +53,7 @@ var selfClosed6 =
; >
: JSX.Element >div : any >x : any +>"1" : string >y : any var selfClosed7 =
; diff --git a/tests/baselines/reference/tsxEmit2.symbols b/tests/baselines/reference/tsxEmit2.symbols index fd5689534939d..5eefc31710d88 100644 --- a/tests/baselines/reference/tsxEmit2.symbols +++ b/tests/baselines/reference/tsxEmit2.symbols @@ -21,29 +21,38 @@ var p1, p2, p3; var spreads1 =
{p2}
; >spreads1 : Symbol(spreads1, Decl(tsxEmit2.tsx, 8, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) +>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) var spreads2 =
{p2}
; >spreads2 : Symbol(spreads2, Decl(tsxEmit2.tsx, 9, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) +>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) var spreads3 =
{p2}
; >spreads3 : Symbol(spreads3, Decl(tsxEmit2.tsx, 10, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) >x : Symbol(unknown) +>p3 : Symbol(p3, Decl(tsxEmit2.tsx, 7, 11)) +>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) var spreads4 =
{p2}
; >spreads4 : Symbol(spreads4, Decl(tsxEmit2.tsx, 11, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) >x : Symbol(unknown) +>p3 : Symbol(p3, Decl(tsxEmit2.tsx, 7, 11)) +>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) var spreads5 =
{p2}
; >spreads5 : Symbol(spreads5, Decl(tsxEmit2.tsx, 12, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) >x : Symbol(unknown) +>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7)) >y : Symbol(unknown) +>p3 : Symbol(p3, Decl(tsxEmit2.tsx, 7, 11)) +>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22)) diff --git a/tests/baselines/reference/tsxEmit3.js.map b/tests/baselines/reference/tsxEmit3.js.map index 895a8283ba5ea..1f1ba0926a063 100644 --- a/tests/baselines/reference/tsxEmit3.js.map +++ b/tests/baselines/reference/tsxEmit3.js.map @@ -1,2 +1,2 @@ //// [tsxEmit3.jsx.map] -{"version":3,"file":"tsxEmit3.jsx","sourceRoot":"","sources":["tsxEmit3.tsx"],"names":["M","M.Foo","M.Foo.constructor","M.S","M.S.Bar","M.S.Bar.constructor"],"mappings":"AAMA,IAAO,CAAC,CAQP;AARD,WAAO,CAAC,EAAC,CAAC;IACTA;QAAmBC;QAAgBC,CAACA;QAACD,UAACA;IAADA,CAACA,AAAtCD,IAAsCA;IAAzBA,KAAGA,MAAsBA,CAAAA;IACtCA,IAAcA,CAACA,CAKdA;IALDA,WAAcA,CAACA,EAACA,CAACA;QAChBG;YAAAC;YAAmBC,CAACA;YAADD,UAACA;QAADA,CAACA,AAApBD,IAAoBA;QAAPA,KAAGA,MAAIA,CAAAA;IAIrBA,CAACA,EALaH,CAACA,GAADA,GAACA,KAADA,GAACA,QAKdA;AACFA,CAACA,EARM,CAAC,KAAD,CAAC,QAQP;AAED,IAAO,CAAC,CAYP;AAZD,WAAO,CAAC,EAAC,CAAC;IAETA,AADAA,aAAaA;IACbA,KAAGA,EAAEA,CAACA,KAAGA,GAAGA,CAACA;IAEbA,IAAcA,CAACA,CAMdA;IANDA,WAAcA,CAACA,EAACA,CAACA;QAEhBG,AADAA,aAAaA;QACbA,KAAGA,EAAEA,CAACA,KAAGA,GAAGA,CAACA;QAGbA,AADAA,aAAaA;QACbA,KAAGA,EAAEA,CAACA,KAAGA,GAAGA,CAACA;IACdA,CAACA,EANaH,CAACA,GAADA,GAACA,KAADA,GAACA,QAMdA;AAEFA,CAACA,EAZM,CAAC,KAAD,CAAC,QAYP;AAED,IAAO,CAAC,CAGP;AAHD,WAAO,CAAC,EAAC,CAAC;IAETA,AADAA,eAAeA;IACfA,GAACA,CAACA,GAAGA,EAAEA,CAACA,GAACA,CAACA,GAAGA,GAAGA,CAACA;AAClBA,CAACA,EAHM,CAAC,KAAD,CAAC,QAGP;AAED,IAAO,CAAC,CAIP;AAJD,WAAO,GAAC,EAAC,CAAC;IACTA,IAAIA,CAACA,GAAGA,GAAGA,CAACA;IAEZA,AADAA,eAAeA;IACfA,OAAGA,EAAEA,CAACA,OAAGA,GAAGA,CAACA;AACdA,CAACA,EAJM,CAAC,KAAD,CAAC,QAIP"} \ No newline at end of file +{"version":3,"file":"tsxEmit3.jsx","sourceRoot":"","sources":["tsxEmit3.tsx"],"names":["M","M.Foo","M.Foo.constructor","M.S","M.S.Bar","M.S.Bar.constructor"],"mappings":"AAMA,IAAO,CAAC,CAQP;AARD,WAAO,CAAC,EAAC,CAAC;IACTA;QAAmBC;QAAgBC,CAACA;QAACD,UAACA;IAADA,CAACA,AAAtCD,IAAsCA;IAAzBA,KAAGA,MAAsBA,CAAAA;IACtCA,IAAcA,CAACA,CAKdA;IALDA,WAAcA,CAACA,EAACA,CAACA;QAChBG;YAAAC;YAAmBC,CAACA;YAADD,UAACA;QAADA,CAACA,AAApBD,IAAoBA;QAAPA,KAAGA,MAAIA,CAAAA;IAIrBA,CAACA,EALaH,CAACA,GAADA,GAACA,KAADA,GAACA,QAKdA;AACFA,CAACA,EARM,CAAC,KAAD,CAAC,QAQP;AAED,IAAO,CAAC,CAYP;AAZD,WAAO,CAAC,EAAC,CAAC;IACTA,aAAaA;IACbA,KAAGA,EAAEA,CAACA,KAAGA,GAAGA,CAACA;IAEbA,IAAcA,CAACA,CAMdA;IANDA,WAAcA,CAACA,EAACA,CAACA;QAChBG,aAAaA;QACbA,KAAGA,EAAEA,CAACA,KAAGA,GAAGA,CAACA;QAEbA,aAAaA;QACbA,KAAGA,EAAEA,CAACA,KAAGA,GAAGA,CAACA;IACdA,CAACA,EANaH,CAACA,GAADA,GAACA,KAADA,GAACA,QAMdA;AAEFA,CAACA,EAZM,CAAC,KAAD,CAAC,QAYP;AAED,IAAO,CAAC,CAGP;AAHD,WAAO,CAAC,EAAC,CAAC;IACTA,eAAeA;IACfA,GAACA,CAACA,GAAGA,EAAEA,CAACA,GAACA,CAACA,GAAGA,GAAGA,CAACA;AAClBA,CAACA,EAHM,CAAC,KAAD,CAAC,QAGP;AAED,IAAO,CAAC,CAIP;AAJD,WAAO,GAAC,EAAC,CAAC;IACTA,IAAIA,CAACA,GAAGA,GAAGA,CAACA;IACZA,eAAeA;IACfA,OAAGA,EAAEA,CAACA,OAAGA,GAAGA,CAACA;AACdA,CAACA,EAJM,CAAC,KAAD,CAAC,QAIP"} \ No newline at end of file diff --git a/tests/baselines/reference/tsxEmit3.sourcemap.txt b/tests/baselines/reference/tsxEmit3.sourcemap.txt index 293e6480fb82a..514be1e532d18 100644 --- a/tests/baselines/reference/tsxEmit3.sourcemap.txt +++ b/tests/baselines/reference/tsxEmit3.sourcemap.txt @@ -332,17 +332,13 @@ sourceFile:tsxEmit3.tsx --- >>> // Emit M.Foo 1->^^^^ -2 > -3 > ^^^^^^^^^^^^^ -4 > ^^^^^-> +2 > ^^^^^^^^^^^^^ +3 > ^^^^^-> 1-> - > // Emit M.Foo > -2 > -3 > // Emit M.Foo -1->Emitted(21, 5) Source(19, 2) + SourceIndex(0) name (M) -2 >Emitted(21, 5) Source(18, 2) + SourceIndex(0) name (M) -3 >Emitted(21, 18) Source(18, 15) + SourceIndex(0) name (M) +2 > // Emit M.Foo +1->Emitted(21, 5) Source(18, 2) + SourceIndex(0) name (M) +2 >Emitted(21, 18) Source(18, 15) + SourceIndex(0) name (M) --- >>> M.Foo, ; 1->^^^^ @@ -411,17 +407,13 @@ sourceFile:tsxEmit3.tsx --- >>> // Emit M.Foo 1->^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^ -4 > ^^^^^-> +2 > ^^^^^^^^^^^^^ +3 > ^^^^^-> 1-> - > // Emit M.Foo > -2 > -3 > // Emit M.Foo -1->Emitted(25, 9) Source(23, 3) + SourceIndex(0) name (M.S) -2 >Emitted(25, 9) Source(22, 3) + SourceIndex(0) name (M.S) -3 >Emitted(25, 22) Source(22, 16) + SourceIndex(0) name (M.S) +2 > // Emit M.Foo +1->Emitted(25, 9) Source(22, 3) + SourceIndex(0) name (M.S) +2 >Emitted(25, 22) Source(22, 16) + SourceIndex(0) name (M.S) --- >>> M.Foo, ; 1->^^^^^^^^ @@ -449,18 +441,14 @@ sourceFile:tsxEmit3.tsx --- >>> // Emit S.Bar 1 >^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^ -4 > ^^^^^-> +2 > ^^^^^^^^^^^^^ +3 > ^^^^^-> 1 > > - > // Emit S.Bar > -2 > -3 > // Emit S.Bar -1 >Emitted(27, 9) Source(26, 3) + SourceIndex(0) name (M.S) -2 >Emitted(27, 9) Source(25, 3) + SourceIndex(0) name (M.S) -3 >Emitted(27, 22) Source(25, 16) + SourceIndex(0) name (M.S) +2 > // Emit S.Bar +1 >Emitted(27, 9) Source(25, 3) + SourceIndex(0) name (M.S) +2 >Emitted(27, 22) Source(25, 16) + SourceIndex(0) name (M.S) --- >>> S.Bar, ; 1->^^^^^^^^ @@ -600,17 +588,13 @@ sourceFile:tsxEmit3.tsx --- >>> // Emit M.S.Bar 1->^^^^ -2 > -3 > ^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> +2 > ^^^^^^^^^^^^^^^ +3 > ^^^^^^^-> 1-> - > // Emit M.S.Bar > -2 > -3 > // Emit M.S.Bar -1->Emitted(33, 5) Source(33, 2) + SourceIndex(0) name (M) -2 >Emitted(33, 5) Source(32, 2) + SourceIndex(0) name (M) -3 >Emitted(33, 20) Source(32, 17) + SourceIndex(0) name (M) +2 > // Emit M.S.Bar +1->Emitted(33, 5) Source(32, 2) + SourceIndex(0) name (M) +2 >Emitted(33, 20) Source(32, 17) + SourceIndex(0) name (M) --- >>> M.S.Bar, ; 1->^^^^ @@ -737,17 +721,13 @@ sourceFile:tsxEmit3.tsx --- >>> // Emit M_1.Foo 1->^^^^ -2 > -3 > ^^^^^^^^^^^^^^^ -4 > ^^^^^^^-> +2 > ^^^^^^^^^^^^^^^ +3 > ^^^^^^^-> 1-> - > // Emit M_1.Foo > -2 > -3 > // Emit M_1.Foo -1->Emitted(39, 5) Source(39, 2) + SourceIndex(0) name (M) -2 >Emitted(39, 5) Source(38, 2) + SourceIndex(0) name (M) -3 >Emitted(39, 20) Source(38, 17) + SourceIndex(0) name (M) +2 > // Emit M_1.Foo +1->Emitted(39, 5) Source(38, 2) + SourceIndex(0) name (M) +2 >Emitted(39, 20) Source(38, 17) + SourceIndex(0) name (M) --- >>> M_1.Foo, ; 1->^^^^ diff --git a/tests/baselines/reference/tsxExternalModuleEmit2.symbols b/tests/baselines/reference/tsxExternalModuleEmit2.symbols index 137e9befa56aa..6f8d3d76cd236 100644 --- a/tests/baselines/reference/tsxExternalModuleEmit2.symbols +++ b/tests/baselines/reference/tsxExternalModuleEmit2.symbols @@ -20,6 +20,7 @@ declare var Foo, React; ; >Foo : Symbol(Foo, Decl(app.tsx, 1, 11)) >handler : Symbol(unknown) +>Main : Symbol(Main, Decl(app.tsx, 0, 6)) >Foo : Symbol(Foo, Decl(app.tsx, 1, 11)) // Should see mod_1['default'] in emit here diff --git a/tests/baselines/reference/tsxReactEmit1.js b/tests/baselines/reference/tsxReactEmit1.js index f1799e5bb77f9..260bd9cd22804 100644 --- a/tests/baselines/reference/tsxReactEmit1.js +++ b/tests/baselines/reference/tsxReactEmit1.js @@ -69,6 +69,6 @@ var SomeClass = (function () { }; return SomeClass; })(); -var whitespace1 = React.createElement("div", null); -var whitespace2 = React.createElement("div", null, p); +var whitespace1 = React.createElement("div", null, " "); +var whitespace2 = React.createElement("div", null, " ", p, " "); var whitespace3 = React.createElement("div", null, p); diff --git a/tests/baselines/reference/tsxReactEmit1.symbols b/tests/baselines/reference/tsxReactEmit1.symbols index 665c6a0271ff7..4149142dd8205 100644 --- a/tests/baselines/reference/tsxReactEmit1.symbols +++ b/tests/baselines/reference/tsxReactEmit1.symbols @@ -54,6 +54,7 @@ var selfClosed7 =
; >selfClosed7 : Symbol(selfClosed7, Decl(tsxReactEmit1.tsx, 15, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22)) >x : Symbol(unknown) +>p : Symbol(p, Decl(tsxReactEmit1.tsx, 8, 3)) >y : Symbol(unknown) >b : Symbol(unknown) @@ -72,6 +73,7 @@ var openClosed3 =
{p}
; >openClosed3 : Symbol(openClosed3, Decl(tsxReactEmit1.tsx, 19, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22)) >n : Symbol(unknown) +>p : Symbol(p, Decl(tsxReactEmit1.tsx, 8, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22)) var openClosed4 =
{p < p}
; @@ -150,6 +152,7 @@ var whitespace1 =
; var whitespace2 =
{p}
; >whitespace2 : Symbol(whitespace2, Decl(tsxReactEmit1.tsx, 36, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22)) +>p : Symbol(p, Decl(tsxReactEmit1.tsx, 8, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22)) var whitespace3 =
@@ -157,6 +160,8 @@ var whitespace3 =
>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22)) {p} +>p : Symbol(p, Decl(tsxReactEmit1.tsx, 8, 3)) +
; >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit1.tsx, 1, 22)) diff --git a/tests/baselines/reference/tsxReactEmit1.types b/tests/baselines/reference/tsxReactEmit1.types index 0b6e03c57428e..e180d2b6b7065 100644 --- a/tests/baselines/reference/tsxReactEmit1.types +++ b/tests/baselines/reference/tsxReactEmit1.types @@ -47,6 +47,7 @@ var selfClosed5 =
; >
: JSX.Element >div : any >x : any +>0 : number >y : any var selfClosed6 =
; @@ -54,6 +55,7 @@ var selfClosed6 =
; >
: JSX.Element >div : any >x : any +>"1" : string >y : any var selfClosed7 =
; diff --git a/tests/baselines/reference/tsxReactEmit2.symbols b/tests/baselines/reference/tsxReactEmit2.symbols index 7805a16363e99..049fdb1819b6f 100644 --- a/tests/baselines/reference/tsxReactEmit2.symbols +++ b/tests/baselines/reference/tsxReactEmit2.symbols @@ -23,29 +23,38 @@ var p1, p2, p3; var spreads1 =
{p2}
; >spreads1 : Symbol(spreads1, Decl(tsxReactEmit2.tsx, 9, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) +>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) var spreads2 =
{p2}
; >spreads2 : Symbol(spreads2, Decl(tsxReactEmit2.tsx, 10, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) +>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) var spreads3 =
{p2}
; >spreads3 : Symbol(spreads3, Decl(tsxReactEmit2.tsx, 11, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) >x : Symbol(unknown) +>p3 : Symbol(p3, Decl(tsxReactEmit2.tsx, 8, 11)) +>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) var spreads4 =
{p2}
; >spreads4 : Symbol(spreads4, Decl(tsxReactEmit2.tsx, 12, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) >x : Symbol(unknown) +>p3 : Symbol(p3, Decl(tsxReactEmit2.tsx, 8, 11)) +>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) var spreads5 =
{p2}
; >spreads5 : Symbol(spreads5, Decl(tsxReactEmit2.tsx, 13, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) >x : Symbol(unknown) +>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7)) >y : Symbol(unknown) +>p3 : Symbol(p3, Decl(tsxReactEmit2.tsx, 8, 11)) +>p2 : Symbol(p2, Decl(tsxReactEmit2.tsx, 8, 7)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmit2.tsx, 1, 22)) diff --git a/tests/baselines/reference/tsxReactEmit3.js b/tests/baselines/reference/tsxReactEmit3.js index 1a6ba03723041..239105485342e 100644 --- a/tests/baselines/reference/tsxReactEmit3.js +++ b/tests/baselines/reference/tsxReactEmit3.js @@ -8,4 +8,4 @@ declare var Foo, Bar, baz; q s ; //// [tsxReactEmit3.js] -React.createElement(Foo, null, React.createElement(Bar, null, "q "), React.createElement(Bar, null), "s ", React.createElement(Bar, null), React.createElement(Bar, null)); +React.createElement(Foo, null, " ", React.createElement(Bar, null, " q "), " ", React.createElement(Bar, null), " s ", React.createElement(Bar, null), React.createElement(Bar, null)); diff --git a/tests/baselines/reference/tsxReactEmitEntities.js b/tests/baselines/reference/tsxReactEmitEntities.js new file mode 100644 index 0000000000000..7517c85fc7370 --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitEntities.js @@ -0,0 +1,14 @@ +//// [tsxReactEmitEntities.tsx] +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +
Dot goes here: · ¬AnEntity;
; + + +//// [tsxReactEmitEntities.js] +React.createElement("div", null, "Dot goes here: · ¬AnEntity; "); diff --git a/tests/baselines/reference/tsxReactEmitEntities.symbols b/tests/baselines/reference/tsxReactEmitEntities.symbols new file mode 100644 index 0000000000000..7de35241a3a13 --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitEntities.symbols @@ -0,0 +1,21 @@ +=== tests/cases/conformance/jsx/tsxReactEmitEntities.tsx === +declare module JSX { +>JSX : Symbol(JSX, Decl(tsxReactEmitEntities.tsx, 0, 0)) + + interface Element { } +>Element : Symbol(Element, Decl(tsxReactEmitEntities.tsx, 0, 20)) + + interface IntrinsicElements { +>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxReactEmitEntities.tsx, 1, 22)) + + [s: string]: any; +>s : Symbol(s, Decl(tsxReactEmitEntities.tsx, 3, 3)) + } +} +declare var React: any; +>React : Symbol(React, Decl(tsxReactEmitEntities.tsx, 6, 11)) + +
Dot goes here: · ¬AnEntity;
; +>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitEntities.tsx, 1, 22)) +>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitEntities.tsx, 1, 22)) + diff --git a/tests/baselines/reference/tsxReactEmitEntities.types b/tests/baselines/reference/tsxReactEmitEntities.types new file mode 100644 index 0000000000000..e1c9cb6e6bfbf --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitEntities.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/jsx/tsxReactEmitEntities.tsx === +declare module JSX { +>JSX : any + + interface Element { } +>Element : Element + + interface IntrinsicElements { +>IntrinsicElements : IntrinsicElements + + [s: string]: any; +>s : string + } +} +declare var React: any; +>React : any + +
Dot goes here: · ¬AnEntity;
; +>
Dot goes here: · ¬AnEntity;
: JSX.Element +>div : any +>div : any + diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.js b/tests/baselines/reference/tsxReactEmitWhitespace.js index a124ce73312fb..a1b5894106fc9 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.js +++ b/tests/baselines/reference/tsxReactEmitWhitespace.js @@ -57,17 +57,17 @@ var p = 0; // WHITESPACE, DO NOT RUN 'FORMAT DOCUMENT' ON IT var p = 0; // Emit " " -React.createElement("div", null); +React.createElement("div", null, " "); // Emit " ", p, " " -React.createElement("div", null, p); +React.createElement("div", null, " ", p, " "); // Emit only p React.createElement("div", null, p); // Emit only p React.createElement("div", null, p); // Emit " 3" -React.createElement("div", null, "3"); +React.createElement("div", null, " 3"); // Emit " 3 " -React.createElement("div", null, "3 "); +React.createElement("div", null, " 3 "); // Emit "3" React.createElement("div", null, "3"); // Emit no args diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.symbols b/tests/baselines/reference/tsxReactEmitWhitespace.symbols index 96b902372b712..3aa3f0d0f8adb 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.symbols +++ b/tests/baselines/reference/tsxReactEmitWhitespace.symbols @@ -29,6 +29,7 @@ var p = 0; // Emit " ", p, " "
{p}
; >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22)) +>p : Symbol(p, Decl(tsxReactEmitWhitespace.tsx, 11, 3)) >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22)) // Emit only p @@ -36,6 +37,8 @@ var p = 0; >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22)) {p} +>p : Symbol(p, Decl(tsxReactEmitWhitespace.tsx, 11, 3)) +
; >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22)) @@ -44,6 +47,8 @@ var p = 0; >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22)) {p} +>p : Symbol(p, Decl(tsxReactEmitWhitespace.tsx, 11, 3)) +
; >div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace.tsx, 1, 22)) diff --git a/tests/baselines/reference/tsxReactEmitWhitespace.types b/tests/baselines/reference/tsxReactEmitWhitespace.types index 603dc4ca6c10f..4622aef19917e 100644 --- a/tests/baselines/reference/tsxReactEmitWhitespace.types +++ b/tests/baselines/reference/tsxReactEmitWhitespace.types @@ -32,7 +32,7 @@ var p = 0;
{p}
; >
{p}
: JSX.Element >div : any ->p : any +>p : number >div : any // Emit only p @@ -41,7 +41,7 @@ var p = 0; >div : any {p} ->p : any +>p : number
; >div : any @@ -52,7 +52,7 @@ var p = 0; >div : any {p} ->p : any +>p : number
; >div : any diff --git a/tests/baselines/reference/tsxReactEmitWhitespace2.js b/tests/baselines/reference/tsxReactEmitWhitespace2.js new file mode 100644 index 0000000000000..091a193cdc5c1 --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitWhitespace2.js @@ -0,0 +1,25 @@ +//// [tsxReactEmitWhitespace2.tsx] +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +// Emit ' word' in the last string +
word code word
; +// Same here +
code word
; +// And here +
word
; + + + +//// [tsxReactEmitWhitespace2.js] +// Emit ' word' in the last string +React.createElement("div", null, "word ", React.createElement("code", null, "code"), " word"); +// Same here +React.createElement("div", null, React.createElement("code", null, "code"), " word"); +// And here +React.createElement("div", null, React.createElement("code", null), " word"); diff --git a/tests/baselines/reference/tsxReactEmitWhitespace2.symbols b/tests/baselines/reference/tsxReactEmitWhitespace2.symbols new file mode 100644 index 0000000000000..44ff4cba292e5 --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitWhitespace2.symbols @@ -0,0 +1,38 @@ +=== tests/cases/conformance/jsx/tsxReactEmitWhitespace2.tsx === +declare module JSX { +>JSX : Symbol(JSX, Decl(tsxReactEmitWhitespace2.tsx, 0, 0)) + + interface Element { } +>Element : Symbol(Element, Decl(tsxReactEmitWhitespace2.tsx, 0, 20)) + + interface IntrinsicElements { +>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) + + [s: string]: any; +>s : Symbol(s, Decl(tsxReactEmitWhitespace2.tsx, 3, 3)) + } +} +declare var React: any; +>React : Symbol(React, Decl(tsxReactEmitWhitespace2.tsx, 6, 11)) + +// Emit ' word' in the last string +
word code word
; +>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) +>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) +>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) +>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) + +// Same here +
code word
; +>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) +>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) +>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) +>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) + +// And here +
word
; +>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) +>code : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) +>div : Symbol(JSX.IntrinsicElements, Decl(tsxReactEmitWhitespace2.tsx, 1, 22)) + + diff --git a/tests/baselines/reference/tsxReactEmitWhitespace2.types b/tests/baselines/reference/tsxReactEmitWhitespace2.types new file mode 100644 index 0000000000000..7287e59b9b15f --- /dev/null +++ b/tests/baselines/reference/tsxReactEmitWhitespace2.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/jsx/tsxReactEmitWhitespace2.tsx === +declare module JSX { +>JSX : any + + interface Element { } +>Element : Element + + interface IntrinsicElements { +>IntrinsicElements : IntrinsicElements + + [s: string]: any; +>s : string + } +} +declare var React: any; +>React : any + +// Emit ' word' in the last string +
word code word
; +>
word code word
: JSX.Element +>div : any +>code : JSX.Element +>code : any +>code : any +>div : any + +// Same here +
code word
; +>
code word
: JSX.Element +>div : any +>code : JSX.Element +>code : any +>code : any +>div : any + +// And here +
word
; +>
word
: JSX.Element +>div : any +> : JSX.Element +>code : any +>div : any + + diff --git a/tests/baselines/reference/tsxTypeErrors.symbols b/tests/baselines/reference/tsxTypeErrors.symbols index bfe0c5686403e..94399b95d1fba 100644 --- a/tests/baselines/reference/tsxTypeErrors.symbols +++ b/tests/baselines/reference/tsxTypeErrors.symbols @@ -18,6 +18,7 @@ var thing = { oops: 100 }; var a3 =
>a3 : Symbol(a3, Decl(tsxTypeErrors.tsx, 9, 3)) >id : Symbol(unknown) +>thing : Symbol(thing, Decl(tsxTypeErrors.tsx, 8, 3)) // Mistyped html name (error) var e1 = diff --git a/tests/baselines/reference/tsxTypeErrors.types b/tests/baselines/reference/tsxTypeErrors.types index 92c7148b3147f..303c7695dbfc3 100644 --- a/tests/baselines/reference/tsxTypeErrors.types +++ b/tests/baselines/reference/tsxTypeErrors.types @@ -26,7 +26,7 @@ var a3 =
>
: any >div : any >id : any ->thing : any +>thing : { oops: number; } // Mistyped html name (error) var e1 = diff --git a/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols b/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols index abcb8fdfc6849..2c0152e8bb96d 100644 --- a/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols +++ b/tests/baselines/reference/typeArgumentInferenceApparentType1.symbols @@ -3,7 +3,7 @@ function method(iterable: Iterable): T { >method : Symbol(method, Decl(typeArgumentInferenceApparentType1.ts, 0, 0)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) >iterable : Symbol(iterable, Decl(typeArgumentInferenceApparentType1.ts, 0, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType1.ts, 0, 16)) diff --git a/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols b/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols index 86cf8e7cdcda9..b93d47f28be38 100644 --- a/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols +++ b/tests/baselines/reference/typeArgumentInferenceApparentType2.symbols @@ -3,14 +3,14 @@ function method(iterable: Iterable): T { >method : Symbol(method, Decl(typeArgumentInferenceApparentType2.ts, 0, 0)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) >iterable : Symbol(iterable, Decl(typeArgumentInferenceApparentType2.ts, 0, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) function inner>() { >inner : Symbol(inner, Decl(typeArgumentInferenceApparentType2.ts, 0, 46)) >U : Symbol(U, Decl(typeArgumentInferenceApparentType2.ts, 1, 19)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1681, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 4402, 1)) >T : Symbol(T, Decl(typeArgumentInferenceApparentType2.ts, 0, 16)) var u: U; diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.errors.txt b/tests/baselines/reference/typeGuardsInConditionalExpression.errors.txt deleted file mode 100644 index 37a662e007c0e..0000000000000 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.errors.txt +++ /dev/null @@ -1,103 +0,0 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts(93,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. - - -==== tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts (1 errors) ==== - // In the true expression of a conditional expression, - // the type of a variable or parameter is narrowed by any type guard in the condition when true, - // provided the true expression contains no assignments to the variable or parameter. - // In the false expression of a conditional expression, - // the type of a variable or parameter is narrowed by any type guard in the condition when false, - // provided the false expression contains no assignments to the variable or parameter. - - function foo(x: number | string) { - return typeof x === "string" - ? x.length // string - : x++; // number - } - function foo2(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed - return typeof x === "string" - ? (x = 10 && x)// string | number - : x; // string | number - } - function foo3(x: number | string) { - // x is assigned in the if false branch, the type is not narrowed - // even though assigned using same type as narrowed expression - return typeof x === "string" - ? (x = "Hello" && x) // string | number - : x; // string | number - } - function foo4(x: number | string) { - // false branch updates the variable - so here it is not number - // even though assigned using same type as narrowed expression - return typeof x === "string" - ? x // string | number - : (x = 10 && x); // string | number - } - function foo5(x: number | string) { - // false branch updates the variable - so here it is not number - return typeof x === "string" - ? x // string | number - : (x = "hello" && x); // string | number - } - function foo6(x: number | string) { - // Modify in both branches - return typeof x === "string" - ? (x = 10 && x) // string | number - : (x = "hello" && x); // string | number - } - function foo7(x: number | string | boolean) { - return typeof x === "string" - ? x === "hello" // string - : typeof x === "boolean" - ? x // boolean - : x == 10; // number - } - function foo8(x: number | string | boolean) { - var b: number | boolean; - return typeof x === "string" - ? x === "hello" - : ((b = x) && // number | boolean - (typeof x === "boolean" - ? x // boolean - : x == 10)); // number - } - function foo9(x: number | string) { - var y = 10; - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - return typeof x === "string" - ? ((y = x.length) && x === "hello") // string - : x === 10; // number - } - function foo10(x: number | string | boolean) { - // Mixing typeguards - var b: boolean | number; - return typeof x === "string" - ? x // string - : ((b = x) // x is number | boolean - && typeof x === "number" - && x.toString()); // x is number - } - function foo11(x: number | string | boolean) { - // Mixing typeguards - // Assigning value to x deep inside another guard stops narrowing of type too - var b: number | boolean | string; - return typeof x === "string" - ? x // number | boolean | string - changed in the false branch - : ((b = x) // x is number | boolean | string - because the assignment changed it - && typeof x === "number" - && (x = 10) // assignment to x - && x); // x is number | boolean | string - } - function foo12(x: number | string | boolean) { - // Mixing typeguards - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - var b: number | boolean | string; - return typeof x === "string" - ? (x = 10 && x.toString().length) // number | boolean | string - changed here - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - : ((b = x) // x is number | boolean | string - changed in true branch - && typeof x === "number" - && x); // x is number - } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.symbols b/tests/baselines/reference/typeGuardsInConditionalExpression.symbols new file mode 100644 index 0000000000000..ac35c1f18b9c8 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.symbols @@ -0,0 +1,251 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts === +// In the true expression of a conditional expression, +// the type of a variable or parameter is narrowed by any type guard in the condition when true, +// provided the true expression contains no assignments to the variable or parameter. +// In the false expression of a conditional expression, +// the type of a variable or parameter is narrowed by any type guard in the condition when false, +// provided the false expression contains no assignments to the variable or parameter. + +function foo(x: number | string) { +>foo : Symbol(foo, Decl(typeGuardsInConditionalExpression.ts, 0, 0)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 7, 13)) + + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 7, 13)) + + ? x.length // string +>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 7, 13)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) + + : x++; // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 7, 13)) +} +function foo2(x: number | string) { +>foo2 : Symbol(foo2, Decl(typeGuardsInConditionalExpression.ts, 11, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) + + // x is assigned in the if true branch, the type is not narrowed + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) + + ? (x = 10 && x)// string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) + + : x; // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 12, 14)) +} +function foo3(x: number | string) { +>foo3 : Symbol(foo3, Decl(typeGuardsInConditionalExpression.ts, 17, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) + + // x is assigned in the if false branch, the type is not narrowed + // even though assigned using same type as narrowed expression + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) + + ? (x = "Hello" && x) // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) + + : x; // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 18, 14)) +} +function foo4(x: number | string) { +>foo4 : Symbol(foo4, Decl(typeGuardsInConditionalExpression.ts, 24, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) + + // false branch updates the variable - so here it is not number + // even though assigned using same type as narrowed expression + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) + + ? x // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) + + : (x = 10 && x); // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 25, 14)) +} +function foo5(x: number | string) { +>foo5 : Symbol(foo5, Decl(typeGuardsInConditionalExpression.ts, 31, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) + + // false branch updates the variable - so here it is not number + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) + + ? x // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) + + : (x = "hello" && x); // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 32, 14)) +} +function foo6(x: number | string) { +>foo6 : Symbol(foo6, Decl(typeGuardsInConditionalExpression.ts, 37, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) + + // Modify in both branches + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) + + ? (x = 10 && x) // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) + + : (x = "hello" && x); // string | number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 38, 14)) +} +function foo7(x: number | string | boolean) { +>foo7 : Symbol(foo7, Decl(typeGuardsInConditionalExpression.ts, 43, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) + + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) + + ? x === "hello" // string +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) + + : typeof x === "boolean" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) + + ? x // boolean +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) + + : x == 10; // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 44, 14)) +} +function foo8(x: number | string | boolean) { +>foo8 : Symbol(foo8, Decl(typeGuardsInConditionalExpression.ts, 50, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) + + var b: number | boolean; +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 52, 7)) + + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) + + ? x === "hello" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) + + : ((b = x) && // number | boolean +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 52, 7)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) + + (typeof x === "boolean" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) + + ? x // boolean +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) + + : x == 10)); // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 51, 14)) +} +function foo9(x: number | string) { +>foo9 : Symbol(foo9, Decl(typeGuardsInConditionalExpression.ts, 59, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) + + var y = 10; +>y : Symbol(y, Decl(typeGuardsInConditionalExpression.ts, 61, 7)) + + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) + + ? ((y = x.length) && x === "hello") // string +>y : Symbol(y, Decl(typeGuardsInConditionalExpression.ts, 61, 7)) +>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) + + : x === 10; // number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 60, 14)) +} +function foo10(x: number | string | boolean) { +>foo10 : Symbol(foo10, Decl(typeGuardsInConditionalExpression.ts, 66, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) + + // Mixing typeguards + var b: boolean | number; +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 69, 7)) + + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) + + ? x // string +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) + + : ((b = x) // x is number | boolean +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 69, 7)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) + + && typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) + + && x.toString()); // x is number +>x.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 67, 15)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) +} +function foo11(x: number | string | boolean) { +>foo11 : Symbol(foo11, Decl(typeGuardsInConditionalExpression.ts, 75, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) + + // Mixing typeguards + // Assigning value to x deep inside another guard stops narrowing of type too + var b: number | boolean | string; +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 79, 7)) + + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) + + ? x // number | boolean | string - changed in the false branch +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) + + : ((b = x) // x is number | boolean | string - because the assignment changed it +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 79, 7)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) + + && typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) + + && (x = 10) // assignment to x +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) + + && x); // x is number | boolean | string +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 76, 15)) +} +function foo12(x: number | string | boolean) { +>foo12 : Symbol(foo12, Decl(typeGuardsInConditionalExpression.ts, 86, 1)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) + + // Mixing typeguards + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + var b: number | boolean | string; +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 90, 7)) + + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) + + ? (x = 10 && x.toString().length) // number | boolean | string - changed here +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) +>x.toString().length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x.toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) +>toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) + + : ((b = x) // x is number | boolean | string - changed in true branch +>b : Symbol(b, Decl(typeGuardsInConditionalExpression.ts, 90, 7)) +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) + + && typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) + + && x); // x is number +>x : Symbol(x, Decl(typeGuardsInConditionalExpression.ts, 87, 15)) +} diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.types b/tests/baselines/reference/typeGuardsInConditionalExpression.types new file mode 100644 index 0000000000000..ef048fb85624d --- /dev/null +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.types @@ -0,0 +1,388 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInConditionalExpression.ts === +// In the true expression of a conditional expression, +// the type of a variable or parameter is narrowed by any type guard in the condition when true, +// provided the true expression contains no assignments to the variable or parameter. +// In the false expression of a conditional expression, +// the type of a variable or parameter is narrowed by any type guard in the condition when false, +// provided the false expression contains no assignments to the variable or parameter. + +function foo(x: number | string) { +>foo : (x: number | string) => number +>x : number | string + + return typeof x === "string" +>typeof x === "string" ? x.length // string : x++ : number +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + ? x.length // string +>x.length : number +>x : string +>length : number + + : x++; // number +>x++ : number +>x : number +} +function foo2(x: number | string) { +>foo2 : (x: number | string) => number | string +>x : number | string + + // x is assigned in the if true branch, the type is not narrowed + return typeof x === "string" +>typeof x === "string" ? (x = 10 && x)// string | number : x : number | string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + ? (x = 10 && x)// string | number +>(x = 10 && x) : number | string +>x = 10 && x : number | string +>x : number | string +>10 && x : number | string +>10 : number +>x : number | string + + : x; // string | number +>x : number | string +} +function foo3(x: number | string) { +>foo3 : (x: number | string) => number | string +>x : number | string + + // x is assigned in the if false branch, the type is not narrowed + // even though assigned using same type as narrowed expression + return typeof x === "string" +>typeof x === "string" ? (x = "Hello" && x) // string | number : x : number | string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + ? (x = "Hello" && x) // string | number +>(x = "Hello" && x) : number | string +>x = "Hello" && x : number | string +>x : number | string +>"Hello" && x : number | string +>"Hello" : string +>x : number | string + + : x; // string | number +>x : number | string +} +function foo4(x: number | string) { +>foo4 : (x: number | string) => number | string +>x : number | string + + // false branch updates the variable - so here it is not number + // even though assigned using same type as narrowed expression + return typeof x === "string" +>typeof x === "string" ? x // string | number : (x = 10 && x) : number | string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + ? x // string | number +>x : number | string + + : (x = 10 && x); // string | number +>(x = 10 && x) : number | string +>x = 10 && x : number | string +>x : number | string +>10 && x : number | string +>10 : number +>x : number | string +} +function foo5(x: number | string) { +>foo5 : (x: number | string) => number | string +>x : number | string + + // false branch updates the variable - so here it is not number + return typeof x === "string" +>typeof x === "string" ? x // string | number : (x = "hello" && x) : number | string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + ? x // string | number +>x : number | string + + : (x = "hello" && x); // string | number +>(x = "hello" && x) : number | string +>x = "hello" && x : number | string +>x : number | string +>"hello" && x : number | string +>"hello" : string +>x : number | string +} +function foo6(x: number | string) { +>foo6 : (x: number | string) => number | string +>x : number | string + + // Modify in both branches + return typeof x === "string" +>typeof x === "string" ? (x = 10 && x) // string | number : (x = "hello" && x) : number | string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + ? (x = 10 && x) // string | number +>(x = 10 && x) : number | string +>x = 10 && x : number | string +>x : number | string +>10 && x : number | string +>10 : number +>x : number | string + + : (x = "hello" && x); // string | number +>(x = "hello" && x) : number | string +>x = "hello" && x : number | string +>x : number | string +>"hello" && x : number | string +>"hello" : string +>x : number | string +} +function foo7(x: number | string | boolean) { +>foo7 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + return typeof x === "string" +>typeof x === "string" ? x === "hello" // string : typeof x === "boolean" ? x // boolean : x == 10 : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + ? x === "hello" // string +>x === "hello" : boolean +>x : string +>"hello" : string + + : typeof x === "boolean" +>typeof x === "boolean" ? x // boolean : x == 10 : boolean +>typeof x === "boolean" : boolean +>typeof x : string +>x : number | boolean +>"boolean" : string + + ? x // boolean +>x : boolean + + : x == 10; // number +>x == 10 : boolean +>x : number +>10 : number +} +function foo8(x: number | string | boolean) { +>foo8 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + var b: number | boolean; +>b : number | boolean + + return typeof x === "string" +>typeof x === "string" ? x === "hello" : ((b = x) && // number | boolean (typeof x === "boolean" ? x // boolean : x == 10)) : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + ? x === "hello" +>x === "hello" : boolean +>x : string +>"hello" : string + + : ((b = x) && // number | boolean +>((b = x) && // number | boolean (typeof x === "boolean" ? x // boolean : x == 10)) : boolean +>(b = x) && // number | boolean (typeof x === "boolean" ? x // boolean : x == 10) : boolean +>(b = x) : number | boolean +>b = x : number | boolean +>b : number | boolean +>x : number | boolean + + (typeof x === "boolean" +>(typeof x === "boolean" ? x // boolean : x == 10) : boolean +>typeof x === "boolean" ? x // boolean : x == 10 : boolean +>typeof x === "boolean" : boolean +>typeof x : string +>x : number | boolean +>"boolean" : string + + ? x // boolean +>x : boolean + + : x == 10)); // number +>x == 10 : boolean +>x : number +>10 : number +} +function foo9(x: number | string) { +>foo9 : (x: number | string) => boolean +>x : number | string + + var y = 10; +>y : number +>10 : number + + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + return typeof x === "string" +>typeof x === "string" ? ((y = x.length) && x === "hello") // string : x === 10 : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + ? ((y = x.length) && x === "hello") // string +>((y = x.length) && x === "hello") : boolean +>(y = x.length) && x === "hello" : boolean +>(y = x.length) : number +>y = x.length : number +>y : number +>x.length : number +>x : string +>length : number +>x === "hello" : boolean +>x : string +>"hello" : string + + : x === 10; // number +>x === 10 : boolean +>x : number +>10 : number +} +function foo10(x: number | string | boolean) { +>foo10 : (x: number | string | boolean) => string +>x : number | string | boolean + + // Mixing typeguards + var b: boolean | number; +>b : boolean | number + + return typeof x === "string" +>typeof x === "string" ? x // string : ((b = x) // x is number | boolean && typeof x === "number" && x.toString()) : string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + ? x // string +>x : string + + : ((b = x) // x is number | boolean +>((b = x) // x is number | boolean && typeof x === "number" && x.toString()) : string +>(b = x) // x is number | boolean && typeof x === "number" && x.toString() : string +>(b = x) // x is number | boolean && typeof x === "number" : boolean +>(b = x) : number | boolean +>b = x : number | boolean +>b : boolean | number +>x : number | boolean + + && typeof x === "number" +>typeof x === "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + && x.toString()); // x is number +>x.toString() : string +>x.toString : (radix?: number) => string +>x : number +>toString : (radix?: number) => string +} +function foo11(x: number | string | boolean) { +>foo11 : (x: number | string | boolean) => number | string | boolean +>x : number | string | boolean + + // Mixing typeguards + // Assigning value to x deep inside another guard stops narrowing of type too + var b: number | boolean | string; +>b : number | boolean | string + + return typeof x === "string" +>typeof x === "string" ? x // number | boolean | string - changed in the false branch : ((b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x) : number | string | boolean +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + ? x // number | boolean | string - changed in the false branch +>x : number | string | boolean + + : ((b = x) // x is number | boolean | string - because the assignment changed it +>((b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x) : number | string | boolean +>(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) // assignment to x && x : number | string | boolean +>(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" && (x = 10) : number +>(b = x) // x is number | boolean | string - because the assignment changed it && typeof x === "number" : boolean +>(b = x) : number | string | boolean +>b = x : number | string | boolean +>b : number | boolean | string +>x : number | string | boolean + + && typeof x === "number" +>typeof x === "number" : boolean +>typeof x : string +>x : number | string | boolean +>"number" : string + + && (x = 10) // assignment to x +>(x = 10) : number +>x = 10 : number +>x : number | string | boolean +>10 : number + + && x); // x is number | boolean | string +>x : number | string | boolean +} +function foo12(x: number | string | boolean) { +>foo12 : (x: number | string | boolean) => number +>x : number | string | boolean + + // Mixing typeguards + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + var b: number | boolean | string; +>b : number | boolean | string + + return typeof x === "string" +>typeof x === "string" ? (x = 10 && x.toString().length) // number | boolean | string - changed here : ((b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x) : number +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + ? (x = 10 && x.toString().length) // number | boolean | string - changed here +>(x = 10 && x.toString().length) : number +>x = 10 && x.toString().length : number +>x : number | string | boolean +>10 && x.toString().length : number +>10 : number +>x.toString().length : number +>x.toString() : string +>x.toString : ((radix?: number) => string) | (() => string) +>x : number | string | boolean +>toString : ((radix?: number) => string) | (() => string) +>length : number + + : ((b = x) // x is number | boolean | string - changed in true branch +>((b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x) : number +>(b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" && x : number +>(b = x) // x is number | boolean | string - changed in true branch && typeof x === "number" : boolean +>(b = x) : number | string | boolean +>b = x : number | string | boolean +>b : number | boolean | string +>x : number | string | boolean + + && typeof x === "number" +>typeof x === "number" : boolean +>typeof x : string +>x : number | string | boolean +>"number" : string + + && x); // x is number +>x : number +} diff --git a/tests/baselines/reference/typeGuardsInIfStatement.errors.txt b/tests/baselines/reference/typeGuardsInIfStatement.errors.txt deleted file mode 100644 index e675daffd6e6c..0000000000000 --- a/tests/baselines/reference/typeGuardsInIfStatement.errors.txt +++ /dev/null @@ -1,160 +0,0 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(127,23): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(131,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts(139,16): error TS2349: Cannot invoke an expression whose type lacks a call signature. - - -==== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts (3 errors) ==== - // In the true branch statement of an �if� statement, - // the type of a variable or parameter is narrowed by any type guard in the �if� condition when true, - // provided the true branch statement contains no assignments to the variable or parameter. - // In the false branch statement of an �if� statement, - // the type of a variable or parameter is narrowed by any type guard in the �if� condition when false, - // provided the false branch statement contains no assignments to the variable or parameter - function foo(x: number | string) { - if (typeof x === "string") { - return x.length; // string - } - else { - return x++; // number - } - } - function foo2(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { - x = 10; - return x; // string | number - } - else { - return x; // string | number - } - } - function foo3(x: number | string) { - // x is assigned in the if true branch, the type is not narrowed - if (typeof x === "string") { - x = "Hello"; // even though assigned using same type as narrowed expression - return x; // string | number - } - else { - return x; // string | number - } - } - function foo4(x: number | string) { - // false branch updates the variable - so here it is not number - if (typeof x === "string") { - return x; // string | number - } - else { - x = 10; // even though assigned number - this should result in x to be string | number - return x; // string | number - } - } - function foo5(x: number | string) { - // false branch updates the variable - so here it is not number - if (typeof x === "string") { - return x; // string | number - } - else { - x = "hello"; - return x; // string | number - } - } - function foo6(x: number | string) { - // Modify in both branches - if (typeof x === "string") { - x = 10; - return x; // string | number - } - else { - x = "hello"; - return x; // string | number - } - } - function foo7(x: number | string | boolean) { - if (typeof x === "string") { - return x === "hello"; // string - } - else if (typeof x === "boolean") { - return x; // boolean - } - else { - return x == 10; // number - } - } - function foo8(x: number | string | boolean) { - if (typeof x === "string") { - return x === "hello"; // string - } - else { - var b: number | boolean = x; // number | boolean - if (typeof x === "boolean") { - return x; // boolean - } - else { - return x == 10; // number - } - } - } - function foo9(x: number | string) { - var y = 10; - if (typeof x === "string") { - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - y = x.length; - return x === "hello"; // string - } - else { - return x == 10; // number - } - } - function foo10(x: number | string | boolean) { - // Mixing typeguard narrowing in if statement with conditional expression typeguard - if (typeof x === "string") { - return x === "hello"; // string - } - else { - var y: boolean | string; - var b = x; // number | boolean - return typeof x === "number" - ? x === 10 // number - : x; // x should be boolean - } - } - function foo11(x: number | string | boolean) { - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x deep inside another guard stops narrowing of type too - if (typeof x === "string") { - return x; // string | number | boolean - x changed in else branch - } - else { - var y: number| boolean | string; - var b = x; // number | boolean | string - because below we are changing value of x in if statement - return typeof x === "number" - ? ( - // change value of x - x = 10 && x.toString() // number | boolean | string - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - ) - : ( - // do not change value - y = x && x.toString() // number | boolean | string - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - ); - } - } - function foo12(x: number | string | boolean) { - // Mixing typeguard narrowing in if statement with conditional expression typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - if (typeof x === "string") { - return x.toString(); // string | number | boolean - x changed in else branch - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - } - else { - x = 10; - var b = x; // number | boolean | string - return typeof x === "number" - ? x.toString() // number - : x.toString(); // boolean | string - } - } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInIfStatement.js b/tests/baselines/reference/typeGuardsInIfStatement.js index 820d205bc656b..de05a7bf82af3 100644 --- a/tests/baselines/reference/typeGuardsInIfStatement.js +++ b/tests/baselines/reference/typeGuardsInIfStatement.js @@ -1,9 +1,9 @@ //// [typeGuardsInIfStatement.ts] -// In the true branch statement of an �if� statement, -// the type of a variable or parameter is narrowed by any type guard in the �if� condition when true, +// In the true branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, // provided the true branch statement contains no assignments to the variable or parameter. -// In the false branch statement of an �if� statement, -// the type of a variable or parameter is narrowed by any type guard in the �if� condition when false, +// In the false branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, // provided the false branch statement contains no assignments to the variable or parameter function foo(x: number | string) { if (typeof x === "string") { @@ -149,11 +149,11 @@ function foo12(x: number | string | boolean) { } //// [typeGuardsInIfStatement.js] -// In the true branch statement of an �if� statement, -// the type of a variable or parameter is narrowed by any type guard in the �if� condition when true, +// In the true branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, // provided the true branch statement contains no assignments to the variable or parameter. -// In the false branch statement of an �if� statement, -// the type of a variable or parameter is narrowed by any type guard in the �if� condition when false, +// In the false branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, // provided the false branch statement contains no assignments to the variable or parameter function foo(x) { if (typeof x === "string") { diff --git a/tests/baselines/reference/typeGuardsInIfStatement.symbols b/tests/baselines/reference/typeGuardsInIfStatement.symbols new file mode 100644 index 0000000000000..798fe18cf5ade --- /dev/null +++ b/tests/baselines/reference/typeGuardsInIfStatement.symbols @@ -0,0 +1,304 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts === +// In the true branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, +// provided the true branch statement contains no assignments to the variable or parameter. +// In the false branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, +// provided the false branch statement contains no assignments to the variable or parameter +function foo(x: number | string) { +>foo : Symbol(foo, Decl(typeGuardsInIfStatement.ts, 0, 0)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) + + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) + + return x.length; // string +>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) + } + else { + return x++; // number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 6, 13)) + } +} +function foo2(x: number | string) { +>foo2 : Symbol(foo2, Decl(typeGuardsInIfStatement.ts, 13, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) + + // x is assigned in the if true branch, the type is not narrowed + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) + + x = 10; +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) + + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) + } + else { + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 14, 14)) + } +} +function foo3(x: number | string) { +>foo3 : Symbol(foo3, Decl(typeGuardsInIfStatement.ts, 23, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) + + // x is assigned in the if true branch, the type is not narrowed + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) + + x = "Hello"; // even though assigned using same type as narrowed expression +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) + + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) + } + else { + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 24, 14)) + } +} +function foo4(x: number | string) { +>foo4 : Symbol(foo4, Decl(typeGuardsInIfStatement.ts, 33, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) + + // false branch updates the variable - so here it is not number + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) + + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) + } + else { + x = 10; // even though assigned number - this should result in x to be string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) + + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 34, 14)) + } +} +function foo5(x: number | string) { +>foo5 : Symbol(foo5, Decl(typeGuardsInIfStatement.ts, 43, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) + + // false branch updates the variable - so here it is not number + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) + + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) + } + else { + x = "hello"; +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) + + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 44, 14)) + } +} +function foo6(x: number | string) { +>foo6 : Symbol(foo6, Decl(typeGuardsInIfStatement.ts, 53, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) + + // Modify in both branches + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) + + x = 10; +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) + + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) + } + else { + x = "hello"; +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) + + return x; // string | number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 54, 14)) + } +} +function foo7(x: number | string | boolean) { +>foo7 : Symbol(foo7, Decl(typeGuardsInIfStatement.ts, 64, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) + + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) + + return x === "hello"; // string +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) + } + else if (typeof x === "boolean") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) + + return x; // boolean +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) + } + else { + return x == 10; // number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 65, 14)) + } +} +function foo8(x: number | string | boolean) { +>foo8 : Symbol(foo8, Decl(typeGuardsInIfStatement.ts, 75, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) + + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) + + return x === "hello"; // string +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) + } + else { + var b: number | boolean = x; // number | boolean +>b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 81, 11)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) + + if (typeof x === "boolean") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) + + return x; // boolean +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) + } + else { + return x == 10; // number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 76, 14)) + } + } +} +function foo9(x: number | string) { +>foo9 : Symbol(foo9, Decl(typeGuardsInIfStatement.ts, 89, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) + + var y = 10; +>y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 91, 7)) + + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) + + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + y = x.length; +>y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 91, 7)) +>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) + + return x === "hello"; // string +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) + } + else { + return x == 10; // number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 90, 14)) + } +} +function foo10(x: number | string | boolean) { +>foo10 : Symbol(foo10, Decl(typeGuardsInIfStatement.ts, 100, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) + + // Mixing typeguard narrowing in if statement with conditional expression typeguard + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) + + return x === "hello"; // string +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) + } + else { + var y: boolean | string; +>y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 107, 11)) + + var b = x; // number | boolean +>b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 108, 11)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) + + return typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) + + ? x === 10 // number +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) + + : x; // x should be boolean +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 101, 15)) + } +} +function foo11(x: number | string | boolean) { +>foo11 : Symbol(foo11, Decl(typeGuardsInIfStatement.ts, 113, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) + + // Mixing typeguard narrowing in if statement with conditional expression typeguard + // Assigning value to x deep inside another guard stops narrowing of type too + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) + + return x; // string | number | boolean - x changed in else branch +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) + } + else { + var y: number| boolean | string; +>y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 121, 11)) + + var b = x; // number | boolean | string - because below we are changing value of x in if statement +>b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 122, 11)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) + + return typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) + + ? ( + // change value of x + x = 10 && x.toString() // number | boolean | string +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) +>x.toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) +>toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) + + ) + : ( + // do not change value + y = x && x.toString() // number | boolean | string +>y : Symbol(y, Decl(typeGuardsInIfStatement.ts, 121, 11)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) +>x.toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 114, 15)) +>toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) + + ); + } +} +function foo12(x: number | string | boolean) { +>foo12 : Symbol(foo12, Decl(typeGuardsInIfStatement.ts, 133, 1)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) + + // Mixing typeguard narrowing in if statement with conditional expression typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + if (typeof x === "string") { +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) + + return x.toString(); // string | number | boolean - x changed in else branch +>x.toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) +>toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) + } + else { + x = 10; +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) + + var b = x; // number | boolean | string +>b : Symbol(b, Decl(typeGuardsInIfStatement.ts, 142, 11)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) + + return typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) + + ? x.toString() // number +>x.toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) +>toString : Symbol(Number.toString, Decl(lib.d.ts, 458, 18)) + + : x.toString(); // boolean | string +>x.toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInIfStatement.ts, 134, 15)) +>toString : Symbol(toString, Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) + } +} diff --git a/tests/baselines/reference/typeGuardsInIfStatement.types b/tests/baselines/reference/typeGuardsInIfStatement.types new file mode 100644 index 0000000000000..8e22d4ba3e0fe --- /dev/null +++ b/tests/baselines/reference/typeGuardsInIfStatement.types @@ -0,0 +1,405 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts === +// In the true branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, +// provided the true branch statement contains no assignments to the variable or parameter. +// In the false branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, +// provided the false branch statement contains no assignments to the variable or parameter +function foo(x: number | string) { +>foo : (x: number | string) => number +>x : number | string + + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + return x.length; // string +>x.length : number +>x : string +>length : number + } + else { + return x++; // number +>x++ : number +>x : number + } +} +function foo2(x: number | string) { +>foo2 : (x: number | string) => number | string +>x : number | string + + // x is assigned in the if true branch, the type is not narrowed + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + x = 10; +>x = 10 : number +>x : number | string +>10 : number + + return x; // string | number +>x : number | string + } + else { + return x; // string | number +>x : number | string + } +} +function foo3(x: number | string) { +>foo3 : (x: number | string) => number | string +>x : number | string + + // x is assigned in the if true branch, the type is not narrowed + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + x = "Hello"; // even though assigned using same type as narrowed expression +>x = "Hello" : string +>x : number | string +>"Hello" : string + + return x; // string | number +>x : number | string + } + else { + return x; // string | number +>x : number | string + } +} +function foo4(x: number | string) { +>foo4 : (x: number | string) => number | string +>x : number | string + + // false branch updates the variable - so here it is not number + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + return x; // string | number +>x : number | string + } + else { + x = 10; // even though assigned number - this should result in x to be string | number +>x = 10 : number +>x : number | string +>10 : number + + return x; // string | number +>x : number | string + } +} +function foo5(x: number | string) { +>foo5 : (x: number | string) => number | string +>x : number | string + + // false branch updates the variable - so here it is not number + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + return x; // string | number +>x : number | string + } + else { + x = "hello"; +>x = "hello" : string +>x : number | string +>"hello" : string + + return x; // string | number +>x : number | string + } +} +function foo6(x: number | string) { +>foo6 : (x: number | string) => number | string +>x : number | string + + // Modify in both branches + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + x = 10; +>x = 10 : number +>x : number | string +>10 : number + + return x; // string | number +>x : number | string + } + else { + x = "hello"; +>x = "hello" : string +>x : number | string +>"hello" : string + + return x; // string | number +>x : number | string + } +} +function foo7(x: number | string | boolean) { +>foo7 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + return x === "hello"; // string +>x === "hello" : boolean +>x : string +>"hello" : string + } + else if (typeof x === "boolean") { +>typeof x === "boolean" : boolean +>typeof x : string +>x : number | boolean +>"boolean" : string + + return x; // boolean +>x : boolean + } + else { + return x == 10; // number +>x == 10 : boolean +>x : number +>10 : number + } +} +function foo8(x: number | string | boolean) { +>foo8 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + return x === "hello"; // string +>x === "hello" : boolean +>x : string +>"hello" : string + } + else { + var b: number | boolean = x; // number | boolean +>b : number | boolean +>x : number | boolean + + if (typeof x === "boolean") { +>typeof x === "boolean" : boolean +>typeof x : string +>x : number | boolean +>"boolean" : string + + return x; // boolean +>x : boolean + } + else { + return x == 10; // number +>x == 10 : boolean +>x : number +>10 : number + } + } +} +function foo9(x: number | string) { +>foo9 : (x: number | string) => boolean +>x : number | string + + var y = 10; +>y : number +>10 : number + + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + y = x.length; +>y = x.length : number +>y : number +>x.length : number +>x : string +>length : number + + return x === "hello"; // string +>x === "hello" : boolean +>x : string +>"hello" : string + } + else { + return x == 10; // number +>x == 10 : boolean +>x : number +>10 : number + } +} +function foo10(x: number | string | boolean) { +>foo10 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + // Mixing typeguard narrowing in if statement with conditional expression typeguard + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + return x === "hello"; // string +>x === "hello" : boolean +>x : string +>"hello" : string + } + else { + var y: boolean | string; +>y : boolean | string + + var b = x; // number | boolean +>b : number | boolean +>x : number | boolean + + return typeof x === "number" +>typeof x === "number" ? x === 10 // number : x : boolean +>typeof x === "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + ? x === 10 // number +>x === 10 : boolean +>x : number +>10 : number + + : x; // x should be boolean +>x : boolean + } +} +function foo11(x: number | string | boolean) { +>foo11 : (x: number | string | boolean) => number | string | boolean +>x : number | string | boolean + + // Mixing typeguard narrowing in if statement with conditional expression typeguard + // Assigning value to x deep inside another guard stops narrowing of type too + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + return x; // string | number | boolean - x changed in else branch +>x : number | string | boolean + } + else { + var y: number| boolean | string; +>y : number | boolean | string + + var b = x; // number | boolean | string - because below we are changing value of x in if statement +>b : number | string | boolean +>x : number | string | boolean + + return typeof x === "number" +>typeof x === "number" ? ( // change value of x x = 10 && x.toString() // number | boolean | string ) : ( // do not change value y = x && x.toString() // number | boolean | string ) : string +>typeof x === "number" : boolean +>typeof x : string +>x : number | string | boolean +>"number" : string + + ? ( +>( // change value of x x = 10 && x.toString() // number | boolean | string ) : string + + // change value of x + x = 10 && x.toString() // number | boolean | string +>x = 10 && x.toString() : string +>x : number | string | boolean +>10 && x.toString() : string +>10 : number +>x.toString() : string +>x.toString : ((radix?: number) => string) | (() => string) +>x : number | string | boolean +>toString : ((radix?: number) => string) | (() => string) + + ) + : ( +>( // do not change value y = x && x.toString() // number | boolean | string ) : string + + // do not change value + y = x && x.toString() // number | boolean | string +>y = x && x.toString() : string +>y : number | boolean | string +>x && x.toString() : string +>x : number | string | boolean +>x.toString() : string +>x.toString : ((radix?: number) => string) | (() => string) +>x : number | string | boolean +>toString : ((radix?: number) => string) | (() => string) + + ); + } +} +function foo12(x: number | string | boolean) { +>foo12 : (x: number | string | boolean) => string +>x : number | string | boolean + + // Mixing typeguard narrowing in if statement with conditional expression typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + if (typeof x === "string") { +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + return x.toString(); // string | number | boolean - x changed in else branch +>x.toString() : string +>x.toString : ((radix?: number) => string) | (() => string) +>x : number | string | boolean +>toString : ((radix?: number) => string) | (() => string) + } + else { + x = 10; +>x = 10 : number +>x : number | string | boolean +>10 : number + + var b = x; // number | boolean | string +>b : number | string | boolean +>x : number | string | boolean + + return typeof x === "number" +>typeof x === "number" ? x.toString() // number : x.toString() : string +>typeof x === "number" : boolean +>typeof x : string +>x : number | string | boolean +>"number" : string + + ? x.toString() // number +>x.toString() : string +>x.toString : (radix?: number) => string +>x : number +>toString : (radix?: number) => string + + : x.toString(); // boolean | string +>x.toString() : string +>x.toString : () => string +>x : string | boolean +>toString : () => string + } +} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.errors.txt b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.errors.txt deleted file mode 100644 index f44e433a2c899..0000000000000 --- a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.errors.txt +++ /dev/null @@ -1,64 +0,0 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts(43,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts(45,21): error TS2349: Cannot invoke an expression whose type lacks a call signature. - - -==== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts (2 errors) ==== - // In the right operand of a && operation, - // the type of a variable or parameter is narrowed by any type guard in the left operand when true, - // provided the right operand contains no assignments to the variable or parameter. - function foo(x: number | string) { - return typeof x === "string" && x.length === 10; // string - } - function foo2(x: number | string) { - // modify x in right hand operand - return typeof x === "string" && ((x = 10) && x); // string | number - } - function foo3(x: number | string) { - // modify x in right hand operand with string type itself - return typeof x === "string" && ((x = "hello") && x); // string | number - } - function foo4(x: number | string | boolean) { - return typeof x !== "string" // string | number | boolean - && typeof x !== "number" // number | boolean - && x; // boolean - } - function foo5(x: number | string | boolean) { - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - var b: number | boolean; - return typeof x !== "string" // string | number | boolean - && ((b = x) && (typeof x !== "number" // number | boolean - && x)); // boolean - } - function foo6(x: number | string | boolean) { - // Mixing typeguard narrowing in if statement with conditional expression typeguard - return typeof x !== "string" // string | number | boolean - && (typeof x !== "number" // number | boolean - ? x // boolean - : x === 10) // number - } - function foo7(x: number | string | boolean) { - var y: number| boolean | string; - var z: number| boolean | string; - // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too - return typeof x !== "string" - && ((z = x) // string | number | boolean - x changed deeper in conditional expression - && (typeof x === "number" - // change value of x - ? (x = 10 && x.toString()) // number | boolean | string - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - // do not change value - : (y = x && x.toString()))); // number | boolean | string - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - } - function foo8(x: number | string) { - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x !== "string" - && (x = 10) // change x - number| string - && (typeof x === "number" - ? x // number - : x.length); // string - } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols new file mode 100644 index 0000000000000..59f51d21e71e0 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.symbols @@ -0,0 +1,143 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts === +// In the right operand of a && operation, +// the type of a variable or parameter is narrowed by any type guard in the left operand when true, +// provided the right operand contains no assignments to the variable or parameter. +function foo(x: number | string) { +>foo : Symbol(foo, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 0, 0)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) + + return typeof x === "string" && x.length === 10; // string +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) +>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 3, 13)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +} +function foo2(x: number | string) { +>foo2 : Symbol(foo2, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 5, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) + + // modify x in right hand operand + return typeof x === "string" && ((x = 10) && x); // string | number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 6, 14)) +} +function foo3(x: number | string) { +>foo3 : Symbol(foo3, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 9, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) + + // modify x in right hand operand with string type itself + return typeof x === "string" && ((x = "hello") && x); // string | number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 10, 14)) +} +function foo4(x: number | string | boolean) { +>foo4 : Symbol(foo4, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 13, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) + + return typeof x !== "string" // string | number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) + + && typeof x !== "number" // number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) + + && x; // boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 14, 14)) +} +function foo5(x: number | string | boolean) { +>foo5 : Symbol(foo5, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 18, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) + + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + var b: number | boolean; +>b : Symbol(b, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 21, 7)) + + return typeof x !== "string" // string | number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) + + && ((b = x) && (typeof x !== "number" // number | boolean +>b : Symbol(b, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 21, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) + + && x)); // boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 19, 14)) +} +function foo6(x: number | string | boolean) { +>foo6 : Symbol(foo6, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 25, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) + + // Mixing typeguard narrowing in if statement with conditional expression typeguard + return typeof x !== "string" // string | number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) + + && (typeof x !== "number" // number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) + + ? x // boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) + + : x === 10) // number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 26, 14)) +} +function foo7(x: number | string | boolean) { +>foo7 : Symbol(foo7, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 32, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) + + var y: number| boolean | string; +>y : Symbol(y, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 34, 7)) + + var z: number| boolean | string; +>z : Symbol(z, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 35, 7)) + + // Mixing typeguard narrowing + // Assigning value to x deep inside another guard stops narrowing of type too + return typeof x !== "string" +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) + + && ((z = x) // string | number | boolean - x changed deeper in conditional expression +>z : Symbol(z, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 35, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) + + && (typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) + + // change value of x + ? (x = 10 && x.toString()) // number | boolean | string +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) +>x.toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) +>toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) + + // do not change value + : (y = x && x.toString()))); // number | boolean | string +>y : Symbol(y, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 34, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) +>x.toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 33, 14)) +>toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +} +function foo8(x: number | string) { +>foo8 : Symbol(foo8, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 45, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) + + // Mixing typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + return typeof x !== "string" +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) + + && (x = 10) // change x - number| string +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) + + && (typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) + + ? x // number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) + + : x.length); // string +>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfAndAndOperator.ts, 46, 14)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types new file mode 100644 index 0000000000000..b69c80ff55ae7 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInRightOperandOfAndAndOperator.types @@ -0,0 +1,234 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfAndAndOperator.ts === +// In the right operand of a && operation, +// the type of a variable or parameter is narrowed by any type guard in the left operand when true, +// provided the right operand contains no assignments to the variable or parameter. +function foo(x: number | string) { +>foo : (x: number | string) => boolean +>x : number | string + + return typeof x === "string" && x.length === 10; // string +>typeof x === "string" && x.length === 10 : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string +>x.length === 10 : boolean +>x.length : number +>x : string +>length : number +>10 : number +} +function foo2(x: number | string) { +>foo2 : (x: number | string) => number | string +>x : number | string + + // modify x in right hand operand + return typeof x === "string" && ((x = 10) && x); // string | number +>typeof x === "string" && ((x = 10) && x) : number | string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string +>((x = 10) && x) : number | string +>(x = 10) && x : number | string +>(x = 10) : number +>x = 10 : number +>x : number | string +>10 : number +>x : number | string +} +function foo3(x: number | string) { +>foo3 : (x: number | string) => number | string +>x : number | string + + // modify x in right hand operand with string type itself + return typeof x === "string" && ((x = "hello") && x); // string | number +>typeof x === "string" && ((x = "hello") && x) : number | string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string +>((x = "hello") && x) : number | string +>(x = "hello") && x : number | string +>(x = "hello") : string +>x = "hello" : string +>x : number | string +>"hello" : string +>x : number | string +} +function foo4(x: number | string | boolean) { +>foo4 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + return typeof x !== "string" // string | number | boolean +>typeof x !== "string" // string | number | boolean && typeof x !== "number" // number | boolean && x : boolean +>typeof x !== "string" // string | number | boolean && typeof x !== "number" : boolean +>typeof x !== "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + && typeof x !== "number" // number | boolean +>typeof x !== "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + && x; // boolean +>x : boolean +} +function foo5(x: number | string | boolean) { +>foo5 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + var b: number | boolean; +>b : number | boolean + + return typeof x !== "string" // string | number | boolean +>typeof x !== "string" // string | number | boolean && ((b = x) && (typeof x !== "number" // number | boolean && x)) : boolean +>typeof x !== "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + && ((b = x) && (typeof x !== "number" // number | boolean +>((b = x) && (typeof x !== "number" // number | boolean && x)) : boolean +>(b = x) && (typeof x !== "number" // number | boolean && x) : boolean +>(b = x) : number | boolean +>b = x : number | boolean +>b : number | boolean +>x : number | boolean +>(typeof x !== "number" // number | boolean && x) : boolean +>typeof x !== "number" // number | boolean && x : boolean +>typeof x !== "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + && x)); // boolean +>x : boolean +} +function foo6(x: number | string | boolean) { +>foo6 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + // Mixing typeguard narrowing in if statement with conditional expression typeguard + return typeof x !== "string" // string | number | boolean +>typeof x !== "string" // string | number | boolean && (typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean +>typeof x !== "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + && (typeof x !== "number" // number | boolean +>(typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean +>typeof x !== "number" // number | boolean ? x // boolean : x === 10 : boolean +>typeof x !== "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + ? x // boolean +>x : boolean + + : x === 10) // number +>x === 10 : boolean +>x : number +>10 : number +} +function foo7(x: number | string | boolean) { +>foo7 : (x: number | string | boolean) => string +>x : number | string | boolean + + var y: number| boolean | string; +>y : number | boolean | string + + var z: number| boolean | string; +>z : number | boolean | string + + // Mixing typeguard narrowing + // Assigning value to x deep inside another guard stops narrowing of type too + return typeof x !== "string" +>typeof x !== "string" && ((z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : string +>typeof x !== "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + && ((z = x) // string | number | boolean - x changed deeper in conditional expression +>((z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : string +>(z = x) // string | number | boolean - x changed deeper in conditional expression && (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string +>(z = x) : number | string | boolean +>z = x : number | string | boolean +>z : number | boolean | string +>x : number | string | boolean + + && (typeof x === "number" +>(typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string +>typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()) : string +>typeof x === "number" : boolean +>typeof x : string +>x : number | string | boolean +>"number" : string + + // change value of x + ? (x = 10 && x.toString()) // number | boolean | string +>(x = 10 && x.toString()) : string +>x = 10 && x.toString() : string +>x : number | string | boolean +>10 && x.toString() : string +>10 : number +>x.toString() : string +>x.toString : ((radix?: number) => string) | (() => string) +>x : number | string | boolean +>toString : ((radix?: number) => string) | (() => string) + + // do not change value + : (y = x && x.toString()))); // number | boolean | string +>(y = x && x.toString()) : string +>y = x && x.toString() : string +>y : number | boolean | string +>x && x.toString() : string +>x : number | string | boolean +>x.toString() : string +>x.toString : ((radix?: number) => string) | (() => string) +>x : number | string | boolean +>toString : ((radix?: number) => string) | (() => string) +} +function foo8(x: number | string) { +>foo8 : (x: number | string) => number +>x : number | string + + // Mixing typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + return typeof x !== "string" +>typeof x !== "string" && (x = 10) // change x - number| string && (typeof x === "number" ? x // number : x.length) : number +>typeof x !== "string" && (x = 10) : number +>typeof x !== "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + && (x = 10) // change x - number| string +>(x = 10) : number +>x = 10 : number +>x : number | string +>10 : number + + && (typeof x === "number" +>(typeof x === "number" ? x // number : x.length) : number +>typeof x === "number" ? x // number : x.length : number +>typeof x === "number" : boolean +>typeof x : string +>x : number | string +>"number" : string + + ? x // number +>x : number + + : x.length); // string +>x.length : number +>x : string +>length : number +} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.errors.txt b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.errors.txt deleted file mode 100644 index f34d035fa4063..0000000000000 --- a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.errors.txt +++ /dev/null @@ -1,64 +0,0 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts(43,22): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts(45,21): error TS2349: Cannot invoke an expression whose type lacks a call signature. - - -==== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts (2 errors) ==== - // In the right operand of a || operation, - // the type of a variable or parameter is narrowed by any type guard in the left operand when false, - // provided the right operand contains no assignments to the variable or parameter. - function foo(x: number | string) { - return typeof x !== "string" || x.length === 10; // string - } - function foo2(x: number | string) { - // modify x in right hand operand - return typeof x !== "string" || ((x = 10) || x); // string | number - } - function foo3(x: number | string) { - // modify x in right hand operand with string type itself - return typeof x !== "string" || ((x = "hello") || x); // string | number - } - function foo4(x: number | string | boolean) { - return typeof x === "string" // string | number | boolean - || typeof x === "number" // number | boolean - || x; // boolean - } - function foo5(x: number | string | boolean) { - // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop - var b: number | boolean; - return typeof x === "string" // string | number | boolean - || ((b = x) || (typeof x === "number" // number | boolean - || x)); // boolean - } - function foo6(x: number | string | boolean) { - // Mixing typeguard - return typeof x === "string" // string | number | boolean - || (typeof x !== "number" // number | boolean - ? x // boolean - : x === 10) // number - } - function foo7(x: number | string | boolean) { - var y: number| boolean | string; - var z: number| boolean | string; - // Mixing typeguard narrowing - // Assigning value to x deep inside another guard stops narrowing of type too - return typeof x === "string" - || ((z = x) // string | number | boolean - x changed deeper in conditional expression - || (typeof x === "number" - // change value of x - ? (x = 10 && x.toString()) // number | boolean | string - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - // do not change value - : (y = x && x.toString()))); // number | boolean | string - ~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - } - function foo8(x: number | string) { - // Mixing typeguard - // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression - return typeof x === "string" - || (x = 10) // change x - number| string - || (typeof x === "number" - ? x // number - : x.length); // string - } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols new file mode 100644 index 0000000000000..d33f0b6877b7b --- /dev/null +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.symbols @@ -0,0 +1,143 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts === +// In the right operand of a || operation, +// the type of a variable or parameter is narrowed by any type guard in the left operand when false, +// provided the right operand contains no assignments to the variable or parameter. +function foo(x: number | string) { +>foo : Symbol(foo, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 0, 0)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 3, 13)) + + return typeof x !== "string" || x.length === 10; // string +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 3, 13)) +>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 3, 13)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +} +function foo2(x: number | string) { +>foo2 : Symbol(foo2, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 5, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 6, 14)) + + // modify x in right hand operand + return typeof x !== "string" || ((x = 10) || x); // string | number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 6, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 6, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 6, 14)) +} +function foo3(x: number | string) { +>foo3 : Symbol(foo3, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 9, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 10, 14)) + + // modify x in right hand operand with string type itself + return typeof x !== "string" || ((x = "hello") || x); // string | number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 10, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 10, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 10, 14)) +} +function foo4(x: number | string | boolean) { +>foo4 : Symbol(foo4, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 13, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 14, 14)) + + return typeof x === "string" // string | number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 14, 14)) + + || typeof x === "number" // number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 14, 14)) + + || x; // boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 14, 14)) +} +function foo5(x: number | string | boolean) { +>foo5 : Symbol(foo5, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 18, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) + + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + var b: number | boolean; +>b : Symbol(b, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 21, 7)) + + return typeof x === "string" // string | number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) + + || ((b = x) || (typeof x === "number" // number | boolean +>b : Symbol(b, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 21, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) + + || x)); // boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 19, 14)) +} +function foo6(x: number | string | boolean) { +>foo6 : Symbol(foo6, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 25, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) + + // Mixing typeguard + return typeof x === "string" // string | number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) + + || (typeof x !== "number" // number | boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) + + ? x // boolean +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) + + : x === 10) // number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 26, 14)) +} +function foo7(x: number | string | boolean) { +>foo7 : Symbol(foo7, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 32, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) + + var y: number| boolean | string; +>y : Symbol(y, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 34, 7)) + + var z: number| boolean | string; +>z : Symbol(z, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 35, 7)) + + // Mixing typeguard narrowing + // Assigning value to x deep inside another guard stops narrowing of type too + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) + + || ((z = x) // string | number | boolean - x changed deeper in conditional expression +>z : Symbol(z, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 35, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) + + || (typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) + + // change value of x + ? (x = 10 && x.toString()) // number | boolean | string +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) +>x.toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) +>toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) + + // do not change value + : (y = x && x.toString()))); // number | boolean | string +>y : Symbol(y, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 34, 7)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) +>x.toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 33, 14)) +>toString : Symbol(toString, Decl(lib.d.ts, 458, 18), Decl(lib.d.ts, 277, 18), Decl(lib.d.ts, 96, 26)) +} +function foo8(x: number | string) { +>foo8 : Symbol(foo8, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 45, 1)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) + + // Mixing typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + return typeof x === "string" +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) + + || (x = 10) // change x - number| string +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) + + || (typeof x === "number" +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) + + ? x // number +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) + + : x.length); // string +>x.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +>x : Symbol(x, Decl(typeGuardsInRightOperandOfOrOrOperator.ts, 46, 14)) +>length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) +} diff --git a/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types new file mode 100644 index 0000000000000..b2f5401e84359 --- /dev/null +++ b/tests/baselines/reference/typeGuardsInRightOperandOfOrOrOperator.types @@ -0,0 +1,234 @@ +=== tests/cases/conformance/expressions/typeGuards/typeGuardsInRightOperandOfOrOrOperator.ts === +// In the right operand of a || operation, +// the type of a variable or parameter is narrowed by any type guard in the left operand when false, +// provided the right operand contains no assignments to the variable or parameter. +function foo(x: number | string) { +>foo : (x: number | string) => boolean +>x : number | string + + return typeof x !== "string" || x.length === 10; // string +>typeof x !== "string" || x.length === 10 : boolean +>typeof x !== "string" : boolean +>typeof x : string +>x : number | string +>"string" : string +>x.length === 10 : boolean +>x.length : number +>x : string +>length : number +>10 : number +} +function foo2(x: number | string) { +>foo2 : (x: number | string) => boolean | number | string +>x : number | string + + // modify x in right hand operand + return typeof x !== "string" || ((x = 10) || x); // string | number +>typeof x !== "string" || ((x = 10) || x) : boolean | number | string +>typeof x !== "string" : boolean +>typeof x : string +>x : number | string +>"string" : string +>((x = 10) || x) : number | string +>(x = 10) || x : number | string +>(x = 10) : number +>x = 10 : number +>x : number | string +>10 : number +>x : number | string +} +function foo3(x: number | string) { +>foo3 : (x: number | string) => boolean | string | number +>x : number | string + + // modify x in right hand operand with string type itself + return typeof x !== "string" || ((x = "hello") || x); // string | number +>typeof x !== "string" || ((x = "hello") || x) : boolean | string | number +>typeof x !== "string" : boolean +>typeof x : string +>x : number | string +>"string" : string +>((x = "hello") || x) : string | number +>(x = "hello") || x : string | number +>(x = "hello") : string +>x = "hello" : string +>x : number | string +>"hello" : string +>x : number | string +} +function foo4(x: number | string | boolean) { +>foo4 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + return typeof x === "string" // string | number | boolean +>typeof x === "string" // string | number | boolean || typeof x === "number" // number | boolean || x : boolean +>typeof x === "string" // string | number | boolean || typeof x === "number" : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + || typeof x === "number" // number | boolean +>typeof x === "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + || x; // boolean +>x : boolean +} +function foo5(x: number | string | boolean) { +>foo5 : (x: number | string | boolean) => boolean | number +>x : number | string | boolean + + // usage of x or assignment to separate variable shouldn't cause narrowing of type to stop + var b: number | boolean; +>b : number | boolean + + return typeof x === "string" // string | number | boolean +>typeof x === "string" // string | number | boolean || ((b = x) || (typeof x === "number" // number | boolean || x)) : boolean | number +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + || ((b = x) || (typeof x === "number" // number | boolean +>((b = x) || (typeof x === "number" // number | boolean || x)) : number | boolean +>(b = x) || (typeof x === "number" // number | boolean || x) : number | boolean +>(b = x) : number | boolean +>b = x : number | boolean +>b : number | boolean +>x : number | boolean +>(typeof x === "number" // number | boolean || x) : boolean +>typeof x === "number" // number | boolean || x : boolean +>typeof x === "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + || x)); // boolean +>x : boolean +} +function foo6(x: number | string | boolean) { +>foo6 : (x: number | string | boolean) => boolean +>x : number | string | boolean + + // Mixing typeguard + return typeof x === "string" // string | number | boolean +>typeof x === "string" // string | number | boolean || (typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + || (typeof x !== "number" // number | boolean +>(typeof x !== "number" // number | boolean ? x // boolean : x === 10) : boolean +>typeof x !== "number" // number | boolean ? x // boolean : x === 10 : boolean +>typeof x !== "number" : boolean +>typeof x : string +>x : number | boolean +>"number" : string + + ? x // boolean +>x : boolean + + : x === 10) // number +>x === 10 : boolean +>x : number +>10 : number +} +function foo7(x: number | string | boolean) { +>foo7 : (x: number | string | boolean) => boolean | number | string +>x : number | string | boolean + + var y: number| boolean | string; +>y : number | boolean | string + + var z: number| boolean | string; +>z : number | boolean | string + + // Mixing typeguard narrowing + // Assigning value to x deep inside another guard stops narrowing of type too + return typeof x === "string" +>typeof x === "string" || ((z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : boolean | number | string +>typeof x === "string" : boolean +>typeof x : string +>x : number | string | boolean +>"string" : string + + || ((z = x) // string | number | boolean - x changed deeper in conditional expression +>((z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()))) : number | string | boolean +>(z = x) // string | number | boolean - x changed deeper in conditional expression || (typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : number | string | boolean +>(z = x) : number | string | boolean +>z = x : number | string | boolean +>z : number | boolean | string +>x : number | string | boolean + + || (typeof x === "number" +>(typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString())) : string +>typeof x === "number" // change value of x ? (x = 10 && x.toString()) // number | boolean | string // do not change value : (y = x && x.toString()) : string +>typeof x === "number" : boolean +>typeof x : string +>x : number | string | boolean +>"number" : string + + // change value of x + ? (x = 10 && x.toString()) // number | boolean | string +>(x = 10 && x.toString()) : string +>x = 10 && x.toString() : string +>x : number | string | boolean +>10 && x.toString() : string +>10 : number +>x.toString() : string +>x.toString : ((radix?: number) => string) | (() => string) +>x : number | string | boolean +>toString : ((radix?: number) => string) | (() => string) + + // do not change value + : (y = x && x.toString()))); // number | boolean | string +>(y = x && x.toString()) : string +>y = x && x.toString() : string +>y : number | boolean | string +>x && x.toString() : string +>x : number | string | boolean +>x.toString() : string +>x.toString : ((radix?: number) => string) | (() => string) +>x : number | string | boolean +>toString : ((radix?: number) => string) | (() => string) +} +function foo8(x: number | string) { +>foo8 : (x: number | string) => boolean | number +>x : number | string + + // Mixing typeguard + // Assigning value to x in outer guard shouldn't stop narrowing in the inner expression + return typeof x === "string" +>typeof x === "string" || (x = 10) // change x - number| string || (typeof x === "number" ? x // number : x.length) : boolean | number +>typeof x === "string" || (x = 10) : boolean | number +>typeof x === "string" : boolean +>typeof x : string +>x : number | string +>"string" : string + + || (x = 10) // change x - number| string +>(x = 10) : number +>x = 10 : number +>x : number | string +>10 : number + + || (typeof x === "number" +>(typeof x === "number" ? x // number : x.length) : number +>typeof x === "number" ? x // number : x.length : number +>typeof x === "number" : boolean +>typeof x : string +>x : number | string +>"number" : string + + ? x // number +>x : number + + : x.length); // string +>x.length : number +>x : string +>length : number +} diff --git a/tests/baselines/reference/typeResolution.js.map b/tests/baselines/reference/typeResolution.js.map index 8bbff8aa760df..e05b5d65d10bb 100644 --- a/tests/baselines/reference/typeResolution.js.map +++ b/tests/baselines/reference/typeResolution.js.map @@ -1,2 +1,2 @@ //// [typeResolution.js.map] -{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.ClassA.AisIn1","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor","TopLevelModule2.SubModule3.ClassA.AisIn2_3"],"mappings":";IAAA,IAAc,eAAe,CAmG5B;IAnGD,WAAc,eAAe,EAAC,CAAC;QAC3BA,IAAcA,UAAUA,CAwEvBA;QAxEDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAcA,aAAaA,CAwD1BA;YAxDDA,WAAcA,aAAaA,EAACA,CAACA;gBACzBC;oBAAAC;oBAmBAC,CAACA;oBAlBUD,2BAAUA,GAAjBA;wBAEIE,AADAA,uCAAuCA;4BACnCA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAwBA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAC9CA,IAAIA,EAAmCA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzDA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,yCAAyCA;4BACrCA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,qCAAqCA;4BACjCA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,sBAAsBA;4BAClBA,EAAcA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACpCA,IAAIA,EAA4BA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;oBACtDA,CAACA;oBACLF,aAACA;gBAADA,CAACA,AAnBDD,IAmBCA;gBAnBYA,oBAAMA,SAmBlBA,CAAAA;gBACDA;oBAAAI;oBAsBAC,CAACA;oBArBUD,2BAAUA,GAAjBA;wBACIE,+CAA+CA;wBAG/CA,AADAA,uCAAuCA;4BACnCA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAwBA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAC9CA,IAAIA,EAAmCA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzDA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,yCAAyCA;4BACrCA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,qCAAqCA;4BACjCA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzEA,IAAIA,EAAqCA,CAACA;wBAACA,EAAEA,CAACA,QAAQA,EAAEA,CAACA;wBAGzDA,AADAA,sBAAsBA;4BAClBA,EAAcA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACpCA,IAAIA,EAA4BA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;oBACtDA,CAACA;oBACLF,aAACA;gBAADA,CAACA,AAtBDJ,IAsBCA;gBAtBYA,oBAAMA,SAsBlBA,CAAAA;gBAEDA;oBACIO;wBACIC;4BAEIC,AADAA,uCAAuCA;gCACnCA,EAAmDA,CAACA;4BAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;4BACzEA,IAAIA,EAAmDA,CAACA;4BAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;4BACzEA,IAAIA,EAAcA,CAACA;4BAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;4BACpCA,IAAIA,EAAqCA,CAACA;4BAACA,EAAEA,CAACA,QAAQA,EAAEA,CAACA;wBAC7DA,CAACA;oBACLD,CAACA;oBACLD,wBAACA;gBAADA,CAACA,AAVDP,IAUCA;YACLA,CAACA,EAxDaD,aAAaA,GAAbA,wBAAaA,KAAbA,wBAAaA,QAwD1BA;YAGDA,AADAA,0EAA0EA;;gBAEtEW;oBACIC;wBACIC,IAAIA,EAAwBA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAC9CA,IAAIA,EAAmCA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzDA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAGzEA,AADAA,sBAAsBA;4BAClBA,EAA4BA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;oBACtDA,CAACA;gBACLD,CAACA;gBACLD,aAACA;YAADA,CAACA,AAXDX,IAWCA;QACLA,CAACA,EAxEaD,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAwEvBA;QAEDA,IAAcA,UAAUA,CAWvBA;QAXDA,WAAcA,UAAUA,EAACA,CAACA;YACtBe,IAAcA,aAAaA,CAO1BA;YAPDA,WAAcA,aAAaA,EAACA,CAACA;gBAEzBC,AADAA,6DAA6DA;;oBAC7DC;oBAA8CC,CAACA;oBAAlBD,2BAAUA,GAAjBA,cAAsBE,CAACA;oBAACF,aAACA;gBAADA,CAACA,AAA/CD,IAA+CA;gBAAlCA,oBAAMA,SAA4BA,CAAAA;gBAC/CA;oBAAAI;oBAA8CC,CAACA;oBAAlBD,2BAAUA,GAAjBA,cAAsBE,CAACA;oBAACF,aAACA;gBAADA,CAACA,AAA/CJ,IAA+CA;gBAAlCA,oBAAMA,SAA4BA,CAAAA;gBAC/CA;oBAAAO;oBAA8CC,CAACA;oBAAlBD,2BAAUA,GAAjBA,cAAsBE,CAACA;oBAACF,aAACA;gBAADA,CAACA,AAA/CP,IAA+CA;gBAAlCA,oBAAMA,SAA4BA,CAAAA;gBAEZA,JACvCA,CAACA,EAPaD,aAAaA,GAAbA,wBAAaA,KAAbA,wBAAaA,QAO1BA;YAE0CA,JAC/CA,CAACA,EAXaf,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAWvBA;QAEDA;YAAA0B;YAEAC,CAACA;YADUD,uBAAMA,GAAbA,cAAkBE,CAACA;YACvBF,aAACA;QAADA,CAACA,AAFD1B,IAECA;QAMDA,IAAOA,iBAAiBA,CAEvBA;QAFDA,WAAOA,iBAAiBA,EAACA,CAACA;YACtB6B;gBAAAC;gBAAsBC,CAACA;gBAADD,aAACA;YAADA,CAACA,AAAvBD,IAAuBA;YAAVA,wBAAMA,SAAIA,CAAAA;QAC3BA,CAACA,EAFM7B,iBAAiBA,KAAjBA,iBAAiBA,QAEvBA;IACLA,CAACA,EAnGa,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAmG5B;IAED,IAAO,eAAe,CAMrB;IAND,WAAO,eAAe,EAAC,CAAC;QACpBgC,IAAcA,UAAUA,CAIvBA;QAJDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC;gBAAAC;gBAEAC,CAACA;gBADUD,yBAAQA,GAAfA,cAAoBE,CAACA;gBACzBF,aAACA;YAADA,CAACA,AAFDD,IAECA;YAFYA,iBAAMA,SAElBA,CAAAA;QACLA,CAACA,EAJaD,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAIvBA;IACLA,CAACA,EANM,eAAe,KAAf,eAAe,QAMrB"} \ No newline at end of file +{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.ClassA.AisIn1","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor","TopLevelModule2.SubModule3.ClassA.AisIn2_3"],"mappings":";IAAA,IAAc,eAAe,CAmG5B;IAnGD,WAAc,eAAe,EAAC,CAAC;QAC3BA,IAAcA,UAAUA,CAwEvBA;QAxEDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAcA,aAAaA,CAwD1BA;YAxDDA,WAAcA,aAAaA,EAACA,CAACA;gBACzBC;oBAAAC;oBAmBAC,CAACA;oBAlBUD,2BAAUA,GAAjBA;wBACIE,uCAAuCA;wBACvCA,IAAIA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAwBA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAC9CA,IAAIA,EAAmCA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzDA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAEzEA,yCAAyCA;wBACzCA,IAAIA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAEzEA,qCAAqCA;wBACrCA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAEzEA,sBAAsBA;wBACtBA,IAAIA,EAAcA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACpCA,IAAIA,EAA4BA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;oBACtDA,CAACA;oBACLF,aAACA;gBAADA,CAACA,AAnBDD,IAmBCA;gBAnBYA,oBAAMA,SAmBlBA,CAAAA;gBACDA;oBAAAI;oBAsBAC,CAACA;oBArBUD,2BAAUA,GAAjBA;wBACIE,+CAA+CA;wBAE/CA,uCAAuCA;wBACvCA,IAAIA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAwBA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAC9CA,IAAIA,EAAmCA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzDA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAEzEA,yCAAyCA;wBACzCA,IAAIA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAEzEA,qCAAqCA;wBACrCA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzEA,IAAIA,EAAqCA,CAACA;wBAACA,EAAEA,CAACA,QAAQA,EAAEA,CAACA;wBAEzDA,sBAAsBA;wBACtBA,IAAIA,EAAcA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACpCA,IAAIA,EAA4BA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;oBACtDA,CAACA;oBACLF,aAACA;gBAADA,CAACA,AAtBDJ,IAsBCA;gBAtBYA,oBAAMA,SAsBlBA,CAAAA;gBAEDA;oBACIO;wBACIC;4BACIC,uCAAuCA;4BACvCA,IAAIA,EAAmDA,CAACA;4BAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;4BACzEA,IAAIA,EAAmDA,CAACA;4BAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;4BACzEA,IAAIA,EAAcA,CAACA;4BAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;4BACpCA,IAAIA,EAAqCA,CAACA;4BAACA,EAAEA,CAACA,QAAQA,EAAEA,CAACA;wBAC7DA,CAACA;oBACLD,CAACA;oBACLD,wBAACA;gBAADA,CAACA,AAVDP,IAUCA;YACLA,CAACA,EAxDaD,aAAaA,GAAbA,wBAAaA,KAAbA,wBAAaA,QAwD1BA;YAEDA,0EAA0EA;YAC1EA;gBACIW;oBACIC;wBACIC,IAAIA,EAAwBA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAC9CA,IAAIA,EAAmCA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBACzDA,IAAIA,EAAmDA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAEzEA,sBAAsBA;wBACtBA,IAAIA,EAA4BA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;oBACtDA,CAACA;gBACLD,CAACA;gBACLD,aAACA;YAADA,CAACA,AAXDX,IAWCA;QACLA,CAACA,EAxEaD,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAwEvBA;QAEDA,IAAcA,UAAUA,CAWvBA;QAXDA,WAAcA,UAAUA,EAACA,CAACA;YACtBe,IAAcA,aAAaA,CAO1BA;YAPDA,WAAcA,aAAaA,EAACA,CAACA;gBACzBC,6DAA6DA;gBAC7DA;oBAAAC;oBAA8CC,CAACA;oBAAlBD,2BAAUA,GAAjBA,cAAsBE,CAACA;oBAACF,aAACA;gBAADA,CAACA,AAA/CD,IAA+CA;gBAAlCA,oBAAMA,SAA4BA,CAAAA;gBAC/CA;oBAAAI;oBAA8CC,CAACA;oBAAlBD,2BAAUA,GAAjBA,cAAsBE,CAACA;oBAACF,aAACA;gBAADA,CAACA,AAA/CJ,IAA+CA;gBAAlCA,oBAAMA,SAA4BA,CAAAA;gBAC/CA;oBAAAO;oBAA8CC,CAACA;oBAAlBD,2BAAUA,GAAjBA,cAAsBE,CAACA;oBAACF,aAACA;gBAADA,CAACA,AAA/CP,IAA+CA;gBAAlCA,oBAAMA,SAA4BA,CAAAA;YAGnDA,CAACA,EAPaD,aAAaA,GAAbA,wBAAaA,KAAbA,wBAAaA,QAO1BA;QAGLA,CAACA,EAXaf,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAWvBA;QAEDA;YAAA0B;YAEAC,CAACA;YADUD,uBAAMA,GAAbA,cAAkBE,CAACA;YACvBF,aAACA;QAADA,CAACA,AAFD1B,IAECA;QAMDA,IAAOA,iBAAiBA,CAEvBA;QAFDA,WAAOA,iBAAiBA,EAACA,CAACA;YACtB6B;gBAAAC;gBAAsBC,CAACA;gBAADD,aAACA;YAADA,CAACA,AAAvBD,IAAuBA;YAAVA,wBAAMA,SAAIA,CAAAA;QAC3BA,CAACA,EAFM7B,iBAAiBA,KAAjBA,iBAAiBA,QAEvBA;IACLA,CAACA,EAnGa,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAmG5B;IAED,IAAO,eAAe,CAMrB;IAND,WAAO,eAAe,EAAC,CAAC;QACpBgC,IAAcA,UAAUA,CAIvBA;QAJDA,WAAcA,UAAUA,EAACA,CAACA;YACtBC;gBAAAC;gBAEAC,CAACA;gBADUD,yBAAQA,GAAfA,cAAoBE,CAACA;gBACzBF,aAACA;YAADA,CAACA,AAFDD,IAECA;YAFYA,iBAAMA,SAElBA,CAAAA;QACLA,CAACA,EAJaD,UAAUA,GAAVA,0BAAUA,KAAVA,0BAAUA,QAIvBA;IACLA,CAACA,EANM,eAAe,KAAf,eAAe,QAMrB"} \ No newline at end of file diff --git a/tests/baselines/reference/typeResolution.sourcemap.txt b/tests/baselines/reference/typeResolution.sourcemap.txt index a7d8bd170f18e..244dbed0b9261 100644 --- a/tests/baselines/reference/typeResolution.sourcemap.txt +++ b/tests/baselines/reference/typeResolution.sourcemap.txt @@ -390,29 +390,28 @@ sourceFile:typeResolution.ts --- >>> // Try all qualified names of this type 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1->public AisIn1_1_1() { - > // Try all qualified names of this type > -2 > -3 > // Try all qualified names of this type -1->Emitted(12, 25) Source(7, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -2 >Emitted(12, 25) Source(6, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -3 >Emitted(12, 64) Source(6, 60) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 > // Try all qualified names of this type +1->Emitted(12, 25) Source(6, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 >Emitted(12, 64) Source(6, 60) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) --- >>> var a1; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > a1: ClassA -3 > ; -1 >Emitted(13, 29) Source(7, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -2 >Emitted(13, 31) Source(7, 35) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -3 >Emitted(13, 32) Source(7, 36) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) + > +2 > var +3 > a1: ClassA +4 > ; +1 >Emitted(13, 25) Source(7, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 >Emitted(13, 29) Source(7, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +3 >Emitted(13, 31) Source(7, 35) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +4 >Emitted(13, 32) Source(7, 36) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) --- >>> a1.AisIn1_1_1(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -545,30 +544,29 @@ sourceFile:typeResolution.ts --- >>> // Two variants of qualifying a peer type 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - > // Two variants of qualifying a peer type > -2 > -3 > // Two variants of qualifying a peer type -1->Emitted(21, 25) Source(13, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -2 >Emitted(21, 25) Source(12, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -3 >Emitted(21, 66) Source(12, 62) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 > // Two variants of qualifying a peer type +1->Emitted(21, 25) Source(12, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 >Emitted(21, 66) Source(12, 62) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) --- >>> var b1; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > b1: ClassB -3 > ; -1 >Emitted(22, 29) Source(13, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -2 >Emitted(22, 31) Source(13, 35) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -3 >Emitted(22, 32) Source(13, 36) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) + > +2 > var +3 > b1: ClassB +4 > ; +1 >Emitted(22, 25) Source(13, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 >Emitted(22, 29) Source(13, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +3 >Emitted(22, 31) Source(13, 35) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +4 >Emitted(22, 32) Source(13, 36) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) --- >>> b1.BisIn1_1_1(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -629,30 +627,29 @@ sourceFile:typeResolution.ts --- >>> // Type only accessible from the root 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - > // Type only accessible from the root > -2 > -3 > // Type only accessible from the root -1->Emitted(26, 25) Source(17, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -2 >Emitted(26, 25) Source(16, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -3 >Emitted(26, 62) Source(16, 58) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 > // Type only accessible from the root +1->Emitted(26, 25) Source(16, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 >Emitted(26, 62) Source(16, 58) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) --- >>> var c1; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > c1: TopLevelModule1.SubModule2.SubSubModule2.ClassA -3 > ; -1 >Emitted(27, 29) Source(17, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -2 >Emitted(27, 31) Source(17, 76) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -3 >Emitted(27, 32) Source(17, 77) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) + > +2 > var +3 > c1: TopLevelModule1.SubModule2.SubSubModule2.ClassA +4 > ; +1 >Emitted(27, 25) Source(17, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 >Emitted(27, 29) Source(17, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +3 >Emitted(27, 31) Source(17, 76) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +4 >Emitted(27, 32) Source(17, 77) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) --- >>> c1.AisIn1_2_2(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -677,30 +674,29 @@ sourceFile:typeResolution.ts --- >>> // Interface reference 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ 1-> > - > // Interface reference > -2 > -3 > // Interface reference -1->Emitted(29, 25) Source(20, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -2 >Emitted(29, 25) Source(19, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -3 >Emitted(29, 47) Source(19, 43) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 > // Interface reference +1->Emitted(29, 25) Source(19, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 >Emitted(29, 47) Source(19, 43) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) --- >>> var d1; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > d1: InterfaceX -3 > ; -1 >Emitted(30, 29) Source(20, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -2 >Emitted(30, 31) Source(20, 39) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) -3 >Emitted(30, 32) Source(20, 40) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) + > +2 > var +3 > d1: InterfaceX +4 > ; +1 >Emitted(30, 25) Source(20, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +2 >Emitted(30, 29) Source(20, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +3 >Emitted(30, 31) Source(20, 39) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) +4 >Emitted(30, 32) Source(20, 40) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1) --- >>> d1.XisIn1_1_1(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -911,30 +907,29 @@ sourceFile:typeResolution.ts --- >>> // Try all qualified names of this type 1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > > - > // Try all qualified names of this type > -2 > -3 > // Try all qualified names of this type -1 >Emitted(43, 25) Source(29, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(43, 25) Source(28, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(43, 64) Source(28, 60) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 > // Try all qualified names of this type +1 >Emitted(43, 25) Source(28, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(43, 64) Source(28, 60) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> var a1; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > a1: ClassA -3 > ; -1 >Emitted(44, 29) Source(29, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(44, 31) Source(29, 35) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(44, 32) Source(29, 36) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) + > +2 > var +3 > a1: ClassA +4 > ; +1 >Emitted(44, 25) Source(29, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(44, 29) Source(29, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +3 >Emitted(44, 31) Source(29, 35) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +4 >Emitted(44, 32) Source(29, 36) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> a1.AisIn1_1_1(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1067,30 +1062,29 @@ sourceFile:typeResolution.ts --- >>> // Two variants of qualifying a peer type 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - > // Two variants of qualifying a peer type > -2 > -3 > // Two variants of qualifying a peer type -1->Emitted(52, 25) Source(35, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(52, 25) Source(34, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(52, 66) Source(34, 62) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 > // Two variants of qualifying a peer type +1->Emitted(52, 25) Source(34, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(52, 66) Source(34, 62) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> var b1; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > b1: ClassB -3 > ; -1 >Emitted(53, 29) Source(35, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(53, 31) Source(35, 35) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(53, 32) Source(35, 36) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) + > +2 > var +3 > b1: ClassB +4 > ; +1 >Emitted(53, 25) Source(35, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(53, 29) Source(35, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +3 >Emitted(53, 31) Source(35, 35) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +4 >Emitted(53, 32) Source(35, 36) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> b1.BisIn1_1_1(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1151,30 +1145,29 @@ sourceFile:typeResolution.ts --- >>> // Type only accessible from the root 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> > - > // Type only accessible from the root > -2 > -3 > // Type only accessible from the root -1->Emitted(57, 25) Source(39, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(57, 25) Source(38, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(57, 62) Source(38, 58) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 > // Type only accessible from the root +1->Emitted(57, 25) Source(38, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(57, 62) Source(38, 58) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> var c1; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > c1: TopLevelModule1.SubModule2.SubSubModule2.ClassA -3 > ; -1 >Emitted(58, 29) Source(39, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(58, 31) Source(39, 76) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(58, 32) Source(39, 77) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) + > +2 > var +3 > c1: TopLevelModule1.SubModule2.SubSubModule2.ClassA +4 > ; +1 >Emitted(58, 25) Source(39, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(58, 29) Source(39, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +3 >Emitted(58, 31) Source(39, 76) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +4 >Emitted(58, 32) Source(39, 77) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> c1.AisIn1_2_2(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1235,30 +1228,29 @@ sourceFile:typeResolution.ts --- >>> // Interface reference 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ 1-> > - > // Interface reference > -2 > -3 > // Interface reference -1->Emitted(62, 25) Source(43, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(62, 25) Source(42, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(62, 47) Source(42, 43) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 > // Interface reference +1->Emitted(62, 25) Source(42, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(62, 47) Source(42, 43) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> var d1; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > d1: InterfaceX -3 > ; -1 >Emitted(63, 29) Source(43, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(63, 31) Source(43, 39) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(63, 32) Source(43, 40) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) + > +2 > var +3 > d1: InterfaceX +4 > ; +1 >Emitted(63, 25) Source(43, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(63, 29) Source(43, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +3 >Emitted(63, 31) Source(43, 39) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +4 >Emitted(63, 32) Source(43, 40) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> d1.XisIn1_1_1(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1433,29 +1425,28 @@ sourceFile:typeResolution.ts --- >>> /* Sampling of stuff from AisIn1_1_1 */ 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1->function QQ() { - > /* Sampling of stuff from AisIn1_1_1 */ > -2 > -3 > /* Sampling of stuff from AisIn1_1_1 */ -1->Emitted(74, 29) Source(52, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) -2 >Emitted(74, 29) Source(51, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) -3 >Emitted(74, 68) Source(51, 64) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) +2 > /* Sampling of stuff from AisIn1_1_1 */ +1->Emitted(74, 29) Source(51, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) +2 >Emitted(74, 68) Source(51, 64) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) --- >>> var a4; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > a4: TopLevelModule1.SubModule1.SubSubModule1.ClassA -3 > ; -1 >Emitted(75, 33) Source(52, 29) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) -2 >Emitted(75, 35) Source(52, 80) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) -3 >Emitted(75, 36) Source(52, 81) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) + > +2 > var +3 > a4: TopLevelModule1.SubModule1.SubSubModule1.ClassA +4 > ; +1 >Emitted(75, 29) Source(52, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) +2 >Emitted(75, 33) Source(52, 29) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) +3 >Emitted(75, 35) Source(52, 80) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) +4 >Emitted(75, 36) Source(52, 81) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ) --- >>> a4.AisIn1_1_1(); 1->^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1726,26 +1717,27 @@ sourceFile:typeResolution.ts --- >>> // Should have no effect on S1.SS1.ClassA above because it is not exported 1 >^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 > > - > // Should have no effect on S1.SS1.ClassA above because it is not exported > -2 > -3 > // Should have no effect on S1.SS1.ClassA above because it is not exported -1 >Emitted(88, 13) Source(62, 9) + SourceIndex(0) name (TopLevelModule1.SubModule1) -2 >Emitted(88, 13) Source(61, 9) + SourceIndex(0) name (TopLevelModule1.SubModule1) -3 >Emitted(88, 87) Source(61, 83) + SourceIndex(0) name (TopLevelModule1.SubModule1) +2 > // Should have no effect on S1.SS1.ClassA above because it is not exported +1 >Emitted(88, 13) Source(61, 9) + SourceIndex(0) name (TopLevelModule1.SubModule1) +2 >Emitted(88, 87) Source(61, 83) + SourceIndex(0) name (TopLevelModule1.SubModule1) --- >>> var ClassA = (function () { +1 >^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > +1 >Emitted(89, 13) Source(62, 9) + SourceIndex(0) name (TopLevelModule1.SubModule1) +--- >>> function ClassA() { -1 >^^^^^^^^^^^^^^^^ +1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^-> -1 > - > class ClassA { +1->class ClassA { > -1 >Emitted(90, 17) Source(63, 13) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA) +1->Emitted(90, 17) Source(63, 13) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA) --- >>> function AA() { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1865,30 +1857,29 @@ sourceFile:typeResolution.ts --- >>> // Interface reference 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^ 1-> > - > // Interface reference > -2 > -3 > // Interface reference -1->Emitted(98, 25) Source(70, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) -2 >Emitted(98, 25) Source(69, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) -3 >Emitted(98, 47) Source(69, 43) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) +2 > // Interface reference +1->Emitted(98, 25) Source(69, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) +2 >Emitted(98, 47) Source(69, 43) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) --- >>> var d2; -1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^^^^^^^^^^-> +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^ +3 > ^^ +4 > ^ +5 > ^^^^^^^^^^-> 1 > - > var -2 > d2: SubSubModule1.InterfaceX -3 > ; -1 >Emitted(99, 29) Source(70, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) -2 >Emitted(99, 31) Source(70, 53) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) -3 >Emitted(99, 32) Source(70, 54) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) + > +2 > var +3 > d2: SubSubModule1.InterfaceX +4 > ; +1 >Emitted(99, 25) Source(70, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) +2 >Emitted(99, 29) Source(70, 25) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) +3 >Emitted(99, 31) Source(70, 53) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) +4 >Emitted(99, 32) Source(70, 54) + SourceIndex(0) name (TopLevelModule1.SubModule1.ClassA.constructor.AA) --- >>> d2.XisIn1_1_1(); 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -2154,24 +2145,25 @@ sourceFile:typeResolution.ts --- >>> // No code here since these are the mirror of the above calls 1->^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> - > // No code here since these are the mirror of the above calls > -2 > -3 > // No code here since these are the mirror of the above calls -1->Emitted(110, 17) Source(79, 13) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) -2 >Emitted(110, 17) Source(78, 13) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) -3 >Emitted(110, 78) Source(78, 74) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) +2 > // No code here since these are the mirror of the above calls +1->Emitted(110, 17) Source(78, 13) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) +2 >Emitted(110, 78) Source(78, 74) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) --- >>> var ClassA = (function () { ->>> function ClassA() { -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^^-> +1 >^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > -1 >Emitted(112, 21) Source(79, 13) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) +1 >Emitted(111, 17) Source(79, 13) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) +--- +>>> function ClassA() { +1->^^^^^^^^^^^^^^^^^^^^ +2 > ^^-> +1-> +1->Emitted(112, 21) Source(79, 13) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2.ClassA) --- >>> } 1->^^^^^^^^^^^^^^^^^^^^ @@ -2390,29 +2382,27 @@ sourceFile:typeResolution.ts 4 >Emitted(131, 47) Source(81, 60) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) --- >>> })(SubSubModule2 = SubModule2.SubSubModule2 || (SubModule2.SubSubModule2 = {})); -1->^^^^^^^^^^^^^^^^ -2 > -3 > ^ -4 > ^^ -5 > ^^^^^^^^^^^^^ -6 > ^^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^ -8 > ^^^^^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^ -10> ^^^^^^^^ +1->^^^^^^^^^^^^ +2 > ^ +3 > ^^ +4 > ^^^^^^^^^^^^^ +5 > ^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^^^^ 1-> > export interface InterfaceY { YisIn1_2_2(); } - > interface NonExportedInterfaceQ { } -2 > - > -3 > } -4 > -5 > SubSubModule2 -6 > -7 > SubSubModule2 -8 > -9 > SubSubModule2 -10> { + > interface NonExportedInterfaceQ { } + > +2 > } +3 > +4 > SubSubModule2 +5 > +6 > SubSubModule2 +7 > +8 > SubSubModule2 +9 > { > // No code here since these are the mirror of the above calls > export class ClassA { public AisIn1_2_2() { } } > export class ClassB { public BisIn1_2_2() { } } @@ -2420,41 +2410,38 @@ sourceFile:typeResolution.ts > export interface InterfaceY { YisIn1_2_2(); } > interface NonExportedInterfaceQ { } > } -1->Emitted(132, 17) Source(83, 48) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) -2 >Emitted(132, 13) Source(84, 9) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) -3 >Emitted(132, 14) Source(84, 10) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) -4 >Emitted(132, 16) Source(77, 23) + SourceIndex(0) name (TopLevelModule1.SubModule2) -5 >Emitted(132, 29) Source(77, 36) + SourceIndex(0) name (TopLevelModule1.SubModule2) -6 >Emitted(132, 32) Source(77, 23) + SourceIndex(0) name (TopLevelModule1.SubModule2) -7 >Emitted(132, 56) Source(77, 36) + SourceIndex(0) name (TopLevelModule1.SubModule2) -8 >Emitted(132, 61) Source(77, 23) + SourceIndex(0) name (TopLevelModule1.SubModule2) -9 >Emitted(132, 85) Source(77, 36) + SourceIndex(0) name (TopLevelModule1.SubModule2) -10>Emitted(132, 93) Source(84, 10) + SourceIndex(0) name (TopLevelModule1.SubModule2) +1->Emitted(132, 13) Source(84, 9) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) +2 >Emitted(132, 14) Source(84, 10) + SourceIndex(0) name (TopLevelModule1.SubModule2.SubSubModule2) +3 >Emitted(132, 16) Source(77, 23) + SourceIndex(0) name (TopLevelModule1.SubModule2) +4 >Emitted(132, 29) Source(77, 36) + SourceIndex(0) name (TopLevelModule1.SubModule2) +5 >Emitted(132, 32) Source(77, 23) + SourceIndex(0) name (TopLevelModule1.SubModule2) +6 >Emitted(132, 56) Source(77, 36) + SourceIndex(0) name (TopLevelModule1.SubModule2) +7 >Emitted(132, 61) Source(77, 23) + SourceIndex(0) name (TopLevelModule1.SubModule2) +8 >Emitted(132, 85) Source(77, 36) + SourceIndex(0) name (TopLevelModule1.SubModule2) +9 >Emitted(132, 93) Source(84, 10) + SourceIndex(0) name (TopLevelModule1.SubModule2) --- >>> })(SubModule2 = TopLevelModule1.SubModule2 || (TopLevelModule1.SubModule2 = {})); -1 >^^^^^^^^^^^^ -2 > -3 > ^ -4 > ^^ -5 > ^^^^^^^^^^ -6 > ^^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ -8 > ^^^^^ -9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ -10> ^^^^^^^^ +1 >^^^^^^^^ +2 > ^ +3 > ^^ +4 > ^^^^^^^^^^ +5 > ^^^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +9 > ^^^^^^^^ 1 > > - > export interface InterfaceY { YisIn1_2(); } -2 > - > -3 > } -4 > -5 > SubModule2 -6 > -7 > SubModule2 -8 > -9 > SubModule2 -10> { + > export interface InterfaceY { YisIn1_2(); } + > +2 > } +3 > +4 > SubModule2 +5 > +6 > SubModule2 +7 > +8 > SubModule2 +9 > { > export module SubSubModule2 { > // No code here since these are the mirror of the above calls > export class ClassA { public AisIn1_2_2() { } } @@ -2466,16 +2453,15 @@ sourceFile:typeResolution.ts > > export interface InterfaceY { YisIn1_2(); } > } -1 >Emitted(133, 13) Source(86, 52) + SourceIndex(0) name (TopLevelModule1.SubModule2) -2 >Emitted(133, 9) Source(87, 5) + SourceIndex(0) name (TopLevelModule1.SubModule2) -3 >Emitted(133, 10) Source(87, 6) + SourceIndex(0) name (TopLevelModule1.SubModule2) -4 >Emitted(133, 12) Source(76, 19) + SourceIndex(0) name (TopLevelModule1) -5 >Emitted(133, 22) Source(76, 29) + SourceIndex(0) name (TopLevelModule1) -6 >Emitted(133, 25) Source(76, 19) + SourceIndex(0) name (TopLevelModule1) -7 >Emitted(133, 51) Source(76, 29) + SourceIndex(0) name (TopLevelModule1) -8 >Emitted(133, 56) Source(76, 19) + SourceIndex(0) name (TopLevelModule1) -9 >Emitted(133, 82) Source(76, 29) + SourceIndex(0) name (TopLevelModule1) -10>Emitted(133, 90) Source(87, 6) + SourceIndex(0) name (TopLevelModule1) +1 >Emitted(133, 9) Source(87, 5) + SourceIndex(0) name (TopLevelModule1.SubModule2) +2 >Emitted(133, 10) Source(87, 6) + SourceIndex(0) name (TopLevelModule1.SubModule2) +3 >Emitted(133, 12) Source(76, 19) + SourceIndex(0) name (TopLevelModule1) +4 >Emitted(133, 22) Source(76, 29) + SourceIndex(0) name (TopLevelModule1) +5 >Emitted(133, 25) Source(76, 19) + SourceIndex(0) name (TopLevelModule1) +6 >Emitted(133, 51) Source(76, 29) + SourceIndex(0) name (TopLevelModule1) +7 >Emitted(133, 56) Source(76, 19) + SourceIndex(0) name (TopLevelModule1) +8 >Emitted(133, 82) Source(76, 29) + SourceIndex(0) name (TopLevelModule1) +9 >Emitted(133, 90) Source(87, 6) + SourceIndex(0) name (TopLevelModule1) --- >>> var ClassA = (function () { 1 >^^^^^^^^ diff --git a/tests/baselines/reference/typedArrays.symbols b/tests/baselines/reference/typedArrays.symbols index 6b9842f6c81a9..0cd1c7bc89a0f 100644 --- a/tests/baselines/reference/typedArrays.symbols +++ b/tests/baselines/reference/typedArrays.symbols @@ -8,39 +8,39 @@ function CreateTypedArrayTypes() { typedArrays[0] = Int8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2121, 42), Decl(lib.d.ts, 2411, 11)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1412, 42), Decl(lib.d.ts, 1685, 11), Decl(lib.d.ts, 4737, 1)) typedArrays[1] = Uint8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2411, 44), Decl(lib.d.ts, 2701, 11)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1685, 44), Decl(lib.d.ts, 1959, 11), Decl(lib.d.ts, 4769, 1)) typedArrays[2] = Int16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2991, 60), Decl(lib.d.ts, 3281, 11)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2232, 60), Decl(lib.d.ts, 2506, 11), Decl(lib.d.ts, 4837, 1)) typedArrays[3] = Uint16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3281, 46), Decl(lib.d.ts, 3571, 11)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2506, 46), Decl(lib.d.ts, 2780, 11), Decl(lib.d.ts, 4873, 1)) typedArrays[4] = Int32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3571, 48), Decl(lib.d.ts, 3861, 11)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2780, 48), Decl(lib.d.ts, 3052, 11), Decl(lib.d.ts, 4905, 1)) typedArrays[5] = Uint32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3861, 46), Decl(lib.d.ts, 4151, 11)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3052, 46), Decl(lib.d.ts, 3325, 11), Decl(lib.d.ts, 4937, 1)) typedArrays[6] = Float32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4151, 48), Decl(lib.d.ts, 4441, 11)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3325, 48), Decl(lib.d.ts, 3599, 11), Decl(lib.d.ts, 4969, 1)) typedArrays[7] = Float64Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4441, 50), Decl(lib.d.ts, 4731, 11)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3599, 50), Decl(lib.d.ts, 3872, 11), Decl(lib.d.ts, 5001, 1)) typedArrays[8] = Uint8ClampedArray; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2701, 46), Decl(lib.d.ts, 2991, 11)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1959, 46), Decl(lib.d.ts, 2232, 11), Decl(lib.d.ts, 4801, 1)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) @@ -55,47 +55,47 @@ function CreateTypedArrayInstancesFromLength(obj: number) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2121, 42), Decl(lib.d.ts, 2411, 11)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1412, 42), Decl(lib.d.ts, 1685, 11), Decl(lib.d.ts, 4737, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2411, 44), Decl(lib.d.ts, 2701, 11)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1685, 44), Decl(lib.d.ts, 1959, 11), Decl(lib.d.ts, 4769, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2991, 60), Decl(lib.d.ts, 3281, 11)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2232, 60), Decl(lib.d.ts, 2506, 11), Decl(lib.d.ts, 4837, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3281, 46), Decl(lib.d.ts, 3571, 11)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2506, 46), Decl(lib.d.ts, 2780, 11), Decl(lib.d.ts, 4873, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3571, 48), Decl(lib.d.ts, 3861, 11)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2780, 48), Decl(lib.d.ts, 3052, 11), Decl(lib.d.ts, 4905, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3861, 46), Decl(lib.d.ts, 4151, 11)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3052, 46), Decl(lib.d.ts, 3325, 11), Decl(lib.d.ts, 4937, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4151, 48), Decl(lib.d.ts, 4441, 11)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3325, 48), Decl(lib.d.ts, 3599, 11), Decl(lib.d.ts, 4969, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4441, 50), Decl(lib.d.ts, 4731, 11)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3599, 50), Decl(lib.d.ts, 3872, 11), Decl(lib.d.ts, 5001, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2701, 46), Decl(lib.d.ts, 2991, 11)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1959, 46), Decl(lib.d.ts, 2232, 11), Decl(lib.d.ts, 4801, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) return typedArrays; @@ -111,47 +111,47 @@ function CreateTypedArrayInstancesFromArray(obj: number[]) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2121, 42), Decl(lib.d.ts, 2411, 11)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1412, 42), Decl(lib.d.ts, 1685, 11), Decl(lib.d.ts, 4737, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2411, 44), Decl(lib.d.ts, 2701, 11)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1685, 44), Decl(lib.d.ts, 1959, 11), Decl(lib.d.ts, 4769, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2991, 60), Decl(lib.d.ts, 3281, 11)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2232, 60), Decl(lib.d.ts, 2506, 11), Decl(lib.d.ts, 4837, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3281, 46), Decl(lib.d.ts, 3571, 11)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2506, 46), Decl(lib.d.ts, 2780, 11), Decl(lib.d.ts, 4873, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3571, 48), Decl(lib.d.ts, 3861, 11)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2780, 48), Decl(lib.d.ts, 3052, 11), Decl(lib.d.ts, 4905, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3861, 46), Decl(lib.d.ts, 4151, 11)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3052, 46), Decl(lib.d.ts, 3325, 11), Decl(lib.d.ts, 4937, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4151, 48), Decl(lib.d.ts, 4441, 11)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3325, 48), Decl(lib.d.ts, 3599, 11), Decl(lib.d.ts, 4969, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4441, 50), Decl(lib.d.ts, 4731, 11)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3599, 50), Decl(lib.d.ts, 3872, 11), Decl(lib.d.ts, 5001, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2701, 46), Decl(lib.d.ts, 2991, 11)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1959, 46), Decl(lib.d.ts, 2232, 11), Decl(lib.d.ts, 4801, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) return typedArrays; @@ -167,65 +167,65 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2401, 38)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2121, 42), Decl(lib.d.ts, 2411, 11)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2401, 38)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1674, 38), Decl(lib.d.ts, 4760, 48)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1412, 42), Decl(lib.d.ts, 1685, 11), Decl(lib.d.ts, 4737, 1)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1674, 38), Decl(lib.d.ts, 4760, 48)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2691, 39)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2411, 44), Decl(lib.d.ts, 2701, 11)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2691, 39)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1948, 39), Decl(lib.d.ts, 4792, 49)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1685, 44), Decl(lib.d.ts, 1959, 11), Decl(lib.d.ts, 4769, 1)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1948, 39), Decl(lib.d.ts, 4792, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3271, 39)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2991, 60), Decl(lib.d.ts, 3281, 11)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3271, 39)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2495, 39), Decl(lib.d.ts, 4864, 49)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2232, 60), Decl(lib.d.ts, 2506, 11), Decl(lib.d.ts, 4837, 1)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2495, 39), Decl(lib.d.ts, 4864, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3561, 40)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3281, 46), Decl(lib.d.ts, 3571, 11)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3561, 40)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2769, 40), Decl(lib.d.ts, 4896, 50)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2506, 46), Decl(lib.d.ts, 2780, 11), Decl(lib.d.ts, 4873, 1)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2769, 40), Decl(lib.d.ts, 4896, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3851, 39)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3571, 48), Decl(lib.d.ts, 3861, 11)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3851, 39)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3042, 39), Decl(lib.d.ts, 4928, 49)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2780, 48), Decl(lib.d.ts, 3052, 11), Decl(lib.d.ts, 4905, 1)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3042, 39), Decl(lib.d.ts, 4928, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4141, 40)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3861, 46), Decl(lib.d.ts, 4151, 11)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4141, 40)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3315, 40), Decl(lib.d.ts, 4960, 50)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3052, 46), Decl(lib.d.ts, 3325, 11), Decl(lib.d.ts, 4937, 1)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3315, 40), Decl(lib.d.ts, 4960, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4431, 41)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4151, 48), Decl(lib.d.ts, 4441, 11)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4431, 41)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3588, 41), Decl(lib.d.ts, 4992, 51)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3325, 48), Decl(lib.d.ts, 3599, 11), Decl(lib.d.ts, 4969, 1)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3588, 41), Decl(lib.d.ts, 4992, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4721, 41)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4441, 50), Decl(lib.d.ts, 4731, 11)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4721, 41)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3862, 41), Decl(lib.d.ts, 5024, 51)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3599, 50), Decl(lib.d.ts, 3872, 11), Decl(lib.d.ts, 5001, 1)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3862, 41), Decl(lib.d.ts, 5024, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2981, 46)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2701, 46), Decl(lib.d.ts, 2991, 11)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2981, 46)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2222, 46), Decl(lib.d.ts, 4827, 56)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1959, 46), Decl(lib.d.ts, 2232, 11), Decl(lib.d.ts, 4801, 1)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2222, 46), Decl(lib.d.ts, 4827, 56)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) return typedArrays; @@ -235,72 +235,72 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >CreateIntegerTypedArraysFromArrayLike : Symbol(CreateIntegerTypedArraysFromArrayLike, Decl(typedArrays.ts, 59, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1447, 1)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1231, 1)) var typedArrays = []; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2401, 38)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2121, 42), Decl(lib.d.ts, 2411, 11)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2401, 38)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1674, 38), Decl(lib.d.ts, 4760, 48)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1412, 42), Decl(lib.d.ts, 1685, 11), Decl(lib.d.ts, 4737, 1)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1674, 38), Decl(lib.d.ts, 4760, 48)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2691, 39)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2411, 44), Decl(lib.d.ts, 2701, 11)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2691, 39)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1948, 39), Decl(lib.d.ts, 4792, 49)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1685, 44), Decl(lib.d.ts, 1959, 11), Decl(lib.d.ts, 4769, 1)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1948, 39), Decl(lib.d.ts, 4792, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3271, 39)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2991, 60), Decl(lib.d.ts, 3281, 11)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3271, 39)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2495, 39), Decl(lib.d.ts, 4864, 49)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2232, 60), Decl(lib.d.ts, 2506, 11), Decl(lib.d.ts, 4837, 1)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2495, 39), Decl(lib.d.ts, 4864, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3561, 40)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3281, 46), Decl(lib.d.ts, 3571, 11)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3561, 40)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2769, 40), Decl(lib.d.ts, 4896, 50)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2506, 46), Decl(lib.d.ts, 2780, 11), Decl(lib.d.ts, 4873, 1)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2769, 40), Decl(lib.d.ts, 4896, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3851, 39)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3571, 48), Decl(lib.d.ts, 3861, 11)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3851, 39)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3042, 39), Decl(lib.d.ts, 4928, 49)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2780, 48), Decl(lib.d.ts, 3052, 11), Decl(lib.d.ts, 4905, 1)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3042, 39), Decl(lib.d.ts, 4928, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4141, 40)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3861, 46), Decl(lib.d.ts, 4151, 11)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4141, 40)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3315, 40), Decl(lib.d.ts, 4960, 50)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3052, 46), Decl(lib.d.ts, 3325, 11), Decl(lib.d.ts, 4937, 1)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3315, 40), Decl(lib.d.ts, 4960, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4431, 41)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4151, 48), Decl(lib.d.ts, 4441, 11)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4431, 41)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3588, 41), Decl(lib.d.ts, 4992, 51)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3325, 48), Decl(lib.d.ts, 3599, 11), Decl(lib.d.ts, 4969, 1)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3588, 41), Decl(lib.d.ts, 4992, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4721, 41)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4441, 50), Decl(lib.d.ts, 4731, 11)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4721, 41)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3862, 41), Decl(lib.d.ts, 5024, 51)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3599, 50), Decl(lib.d.ts, 3872, 11), Decl(lib.d.ts, 5001, 1)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3862, 41), Decl(lib.d.ts, 5024, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2981, 46)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2701, 46), Decl(lib.d.ts, 2991, 11)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2981, 46)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2222, 46), Decl(lib.d.ts, 4827, 56)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1959, 46), Decl(lib.d.ts, 2232, 11), Decl(lib.d.ts, 4801, 1)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2222, 46), Decl(lib.d.ts, 4827, 56)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) return typedArrays; @@ -332,57 +332,57 @@ function CreateTypedArraysOf2() { typedArrays[0] = Int8Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 2395, 30)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2121, 42), Decl(lib.d.ts, 2411, 11)) ->of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 2395, 30)) +>Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 1668, 30)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1412, 42), Decl(lib.d.ts, 1685, 11), Decl(lib.d.ts, 4737, 1)) +>of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 1668, 30)) typedArrays[1] = Uint8Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 2685, 30)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2411, 44), Decl(lib.d.ts, 2701, 11)) ->of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 2685, 30)) +>Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 1942, 30)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1685, 44), Decl(lib.d.ts, 1959, 11), Decl(lib.d.ts, 4769, 1)) +>of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 1942, 30)) typedArrays[2] = Int16Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 3265, 30)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2991, 60), Decl(lib.d.ts, 3281, 11)) ->of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 3265, 30)) +>Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 2489, 30)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2232, 60), Decl(lib.d.ts, 2506, 11), Decl(lib.d.ts, 4837, 1)) +>of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 2489, 30)) typedArrays[3] = Uint16Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 3555, 30)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3281, 46), Decl(lib.d.ts, 3571, 11)) ->of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 3555, 30)) +>Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 2763, 30)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2506, 46), Decl(lib.d.ts, 2780, 11), Decl(lib.d.ts, 4873, 1)) +>of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 2763, 30)) typedArrays[4] = Int32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3845, 30)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3571, 48), Decl(lib.d.ts, 3861, 11)) ->of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3845, 30)) +>Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3036, 30)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2780, 48), Decl(lib.d.ts, 3052, 11), Decl(lib.d.ts, 4905, 1)) +>of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3036, 30)) typedArrays[5] = Uint32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 4135, 30)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3861, 46), Decl(lib.d.ts, 4151, 11)) ->of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 4135, 30)) +>Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 3309, 30)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3052, 46), Decl(lib.d.ts, 3325, 11), Decl(lib.d.ts, 4937, 1)) +>of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 3309, 30)) typedArrays[6] = Float32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 4425, 30)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4151, 48), Decl(lib.d.ts, 4441, 11)) ->of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 4425, 30)) +>Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 3582, 30)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3325, 48), Decl(lib.d.ts, 3599, 11), Decl(lib.d.ts, 4969, 1)) +>of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 3582, 30)) typedArrays[7] = Float64Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 4715, 30)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4441, 50), Decl(lib.d.ts, 4731, 11)) ->of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 4715, 30)) +>Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 3856, 30)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3599, 50), Decl(lib.d.ts, 3872, 11), Decl(lib.d.ts, 5001, 1)) +>of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 3856, 30)) typedArrays[8] = Uint8ClampedArray.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2975, 30)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2701, 46), Decl(lib.d.ts, 2991, 11)) ->of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2975, 30)) +>Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2216, 30)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1959, 46), Decl(lib.d.ts, 2232, 11), Decl(lib.d.ts, 4801, 1)) +>of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2216, 30)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) @@ -391,7 +391,7 @@ function CreateTypedArraysOf2() { function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:number)=> number) { >CreateTypedArraysFromMapFn : Symbol(CreateTypedArraysFromMapFn, Decl(typedArrays.ts, 106, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1447, 1)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1231, 1)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) >n : Symbol(n, Decl(typedArrays.ts, 108, 67)) >v : Symbol(v, Decl(typedArrays.ts, 108, 76)) @@ -401,73 +401,73 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n typedArrays[0] = Int8Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2401, 38)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2121, 42), Decl(lib.d.ts, 2411, 11)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2401, 38)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1674, 38), Decl(lib.d.ts, 4760, 48)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1412, 42), Decl(lib.d.ts, 1685, 11), Decl(lib.d.ts, 4737, 1)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1674, 38), Decl(lib.d.ts, 4760, 48)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[1] = Uint8Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2691, 39)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2411, 44), Decl(lib.d.ts, 2701, 11)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2691, 39)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1948, 39), Decl(lib.d.ts, 4792, 49)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1685, 44), Decl(lib.d.ts, 1959, 11), Decl(lib.d.ts, 4769, 1)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1948, 39), Decl(lib.d.ts, 4792, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[2] = Int16Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3271, 39)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2991, 60), Decl(lib.d.ts, 3281, 11)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3271, 39)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2495, 39), Decl(lib.d.ts, 4864, 49)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2232, 60), Decl(lib.d.ts, 2506, 11), Decl(lib.d.ts, 4837, 1)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2495, 39), Decl(lib.d.ts, 4864, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[3] = Uint16Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3561, 40)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3281, 46), Decl(lib.d.ts, 3571, 11)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3561, 40)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2769, 40), Decl(lib.d.ts, 4896, 50)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2506, 46), Decl(lib.d.ts, 2780, 11), Decl(lib.d.ts, 4873, 1)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2769, 40), Decl(lib.d.ts, 4896, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[4] = Int32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3851, 39)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3571, 48), Decl(lib.d.ts, 3861, 11)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3851, 39)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3042, 39), Decl(lib.d.ts, 4928, 49)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2780, 48), Decl(lib.d.ts, 3052, 11), Decl(lib.d.ts, 4905, 1)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3042, 39), Decl(lib.d.ts, 4928, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[5] = Uint32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4141, 40)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3861, 46), Decl(lib.d.ts, 4151, 11)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4141, 40)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3315, 40), Decl(lib.d.ts, 4960, 50)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3052, 46), Decl(lib.d.ts, 3325, 11), Decl(lib.d.ts, 4937, 1)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3315, 40), Decl(lib.d.ts, 4960, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[6] = Float32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4431, 41)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4151, 48), Decl(lib.d.ts, 4441, 11)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4431, 41)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3588, 41), Decl(lib.d.ts, 4992, 51)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3325, 48), Decl(lib.d.ts, 3599, 11), Decl(lib.d.ts, 4969, 1)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3588, 41), Decl(lib.d.ts, 4992, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[7] = Float64Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4721, 41)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4441, 50), Decl(lib.d.ts, 4731, 11)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4721, 41)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3862, 41), Decl(lib.d.ts, 5024, 51)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3599, 50), Decl(lib.d.ts, 3872, 11), Decl(lib.d.ts, 5001, 1)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3862, 41), Decl(lib.d.ts, 5024, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2981, 46)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2701, 46), Decl(lib.d.ts, 2991, 11)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2981, 46)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2222, 46), Decl(lib.d.ts, 4827, 56)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1959, 46), Decl(lib.d.ts, 2232, 11), Decl(lib.d.ts, 4801, 1)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2222, 46), Decl(lib.d.ts, 4827, 56)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) @@ -478,7 +478,7 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v:number)=> number, thisArg: {}) { >CreateTypedArraysFromThisObj : Symbol(CreateTypedArraysFromThisObj, Decl(typedArrays.ts, 121, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1447, 1)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1231, 1)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >n : Symbol(n, Decl(typedArrays.ts, 123, 69)) >v : Symbol(v, Decl(typedArrays.ts, 123, 78)) @@ -489,81 +489,81 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v typedArrays[0] = Int8Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2401, 38)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2121, 42), Decl(lib.d.ts, 2411, 11)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2401, 38)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1674, 38), Decl(lib.d.ts, 4760, 48)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 1412, 42), Decl(lib.d.ts, 1685, 11), Decl(lib.d.ts, 4737, 1)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 1674, 38), Decl(lib.d.ts, 4760, 48)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[1] = Uint8Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2691, 39)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2411, 44), Decl(lib.d.ts, 2701, 11)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2691, 39)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1948, 39), Decl(lib.d.ts, 4792, 49)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 1685, 44), Decl(lib.d.ts, 1959, 11), Decl(lib.d.ts, 4769, 1)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 1948, 39), Decl(lib.d.ts, 4792, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[2] = Int16Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3271, 39)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2991, 60), Decl(lib.d.ts, 3281, 11)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3271, 39)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2495, 39), Decl(lib.d.ts, 4864, 49)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2232, 60), Decl(lib.d.ts, 2506, 11), Decl(lib.d.ts, 4837, 1)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 2495, 39), Decl(lib.d.ts, 4864, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[3] = Uint16Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3561, 40)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3281, 46), Decl(lib.d.ts, 3571, 11)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3561, 40)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2769, 40), Decl(lib.d.ts, 4896, 50)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 2506, 46), Decl(lib.d.ts, 2780, 11), Decl(lib.d.ts, 4873, 1)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 2769, 40), Decl(lib.d.ts, 4896, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[4] = Int32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3851, 39)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3571, 48), Decl(lib.d.ts, 3861, 11)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3851, 39)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3042, 39), Decl(lib.d.ts, 4928, 49)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 2780, 48), Decl(lib.d.ts, 3052, 11), Decl(lib.d.ts, 4905, 1)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3042, 39), Decl(lib.d.ts, 4928, 49)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[5] = Uint32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4141, 40)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3861, 46), Decl(lib.d.ts, 4151, 11)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4141, 40)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3315, 40), Decl(lib.d.ts, 4960, 50)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3052, 46), Decl(lib.d.ts, 3325, 11), Decl(lib.d.ts, 4937, 1)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 3315, 40), Decl(lib.d.ts, 4960, 50)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[6] = Float32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4431, 41)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4151, 48), Decl(lib.d.ts, 4441, 11)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4431, 41)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3588, 41), Decl(lib.d.ts, 4992, 51)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 3325, 48), Decl(lib.d.ts, 3599, 11), Decl(lib.d.ts, 4969, 1)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 3588, 41), Decl(lib.d.ts, 4992, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[7] = Float64Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4721, 41)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4441, 50), Decl(lib.d.ts, 4731, 11)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4721, 41)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3862, 41), Decl(lib.d.ts, 5024, 51)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 3599, 50), Decl(lib.d.ts, 3872, 11), Decl(lib.d.ts, 5001, 1)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 3862, 41), Decl(lib.d.ts, 5024, 51)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2981, 46)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2701, 46), Decl(lib.d.ts, 2991, 11)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2981, 46)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2222, 46), Decl(lib.d.ts, 4827, 56)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 1959, 46), Decl(lib.d.ts, 2232, 11), Decl(lib.d.ts, 4801, 1)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2222, 46), Decl(lib.d.ts, 4827, 56)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) diff --git a/tests/baselines/reference/typedArrays.types b/tests/baselines/reference/typedArrays.types index 33ae53f609ddd..9886982c0f200 100644 --- a/tests/baselines/reference/typedArrays.types +++ b/tests/baselines/reference/typedArrays.types @@ -274,9 +274,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >0 : number >Int8Array.from(obj) : Int8Array ->Int8Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int8Array +>Int8Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } >Int8Array : Int8ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int8Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } >obj : number[] typedArrays[1] = Uint8Array.from(obj); @@ -285,9 +285,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >1 : number >Uint8Array.from(obj) : Uint8Array ->Uint8Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8Array +>Uint8Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } >Uint8Array : Uint8ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } >obj : number[] typedArrays[2] = Int16Array.from(obj); @@ -296,9 +296,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >2 : number >Int16Array.from(obj) : Int16Array ->Int16Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int16Array +>Int16Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } >Int16Array : Int16ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int16Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } >obj : number[] typedArrays[3] = Uint16Array.from(obj); @@ -307,9 +307,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >3 : number >Uint16Array.from(obj) : Uint16Array ->Uint16Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint16Array +>Uint16Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } >Uint16Array : Uint16ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint16Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } >obj : number[] typedArrays[4] = Int32Array.from(obj); @@ -318,9 +318,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >4 : number >Int32Array.from(obj) : Int32Array ->Int32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int32Array +>Int32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } >Int32Array : Int32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } >obj : number[] typedArrays[5] = Uint32Array.from(obj); @@ -329,9 +329,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >5 : number >Uint32Array.from(obj) : Uint32Array ->Uint32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint32Array +>Uint32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } >Uint32Array : Uint32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } >obj : number[] typedArrays[6] = Float32Array.from(obj); @@ -340,9 +340,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >6 : number >Float32Array.from(obj) : Float32Array ->Float32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float32Array +>Float32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } >Float32Array : Float32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } >obj : number[] typedArrays[7] = Float64Array.from(obj); @@ -351,9 +351,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >7 : number >Float64Array.from(obj) : Float64Array ->Float64Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float64Array +>Float64Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } >Float64Array : Float64ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float64Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } >obj : number[] typedArrays[8] = Uint8ClampedArray.from(obj); @@ -362,9 +362,9 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { >typedArrays : any[] >8 : number >Uint8ClampedArray.from(obj) : Uint8ClampedArray ->Uint8ClampedArray.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8ClampedArray +>Uint8ClampedArray.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } >Uint8ClampedArray : Uint8ClampedArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8ClampedArray +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } >obj : number[] return typedArrays; @@ -386,9 +386,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >0 : number >Int8Array.from(obj) : Int8Array ->Int8Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int8Array +>Int8Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } >Int8Array : Int8ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int8Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } >obj : ArrayLike typedArrays[1] = Uint8Array.from(obj); @@ -397,9 +397,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >1 : number >Uint8Array.from(obj) : Uint8Array ->Uint8Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8Array +>Uint8Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } >Uint8Array : Uint8ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } >obj : ArrayLike typedArrays[2] = Int16Array.from(obj); @@ -408,9 +408,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >2 : number >Int16Array.from(obj) : Int16Array ->Int16Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int16Array +>Int16Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } >Int16Array : Int16ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int16Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } >obj : ArrayLike typedArrays[3] = Uint16Array.from(obj); @@ -419,9 +419,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >3 : number >Uint16Array.from(obj) : Uint16Array ->Uint16Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint16Array +>Uint16Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } >Uint16Array : Uint16ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint16Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } >obj : ArrayLike typedArrays[4] = Int32Array.from(obj); @@ -430,9 +430,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >4 : number >Int32Array.from(obj) : Int32Array ->Int32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int32Array +>Int32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } >Int32Array : Int32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } >obj : ArrayLike typedArrays[5] = Uint32Array.from(obj); @@ -441,9 +441,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >5 : number >Uint32Array.from(obj) : Uint32Array ->Uint32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint32Array +>Uint32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } >Uint32Array : Uint32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } >obj : ArrayLike typedArrays[6] = Float32Array.from(obj); @@ -452,9 +452,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >6 : number >Float32Array.from(obj) : Float32Array ->Float32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float32Array +>Float32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } >Float32Array : Float32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } >obj : ArrayLike typedArrays[7] = Float64Array.from(obj); @@ -463,9 +463,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >7 : number >Float64Array.from(obj) : Float64Array ->Float64Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float64Array +>Float64Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } >Float64Array : Float64ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float64Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } >obj : ArrayLike typedArrays[8] = Uint8ClampedArray.from(obj); @@ -474,9 +474,9 @@ function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >typedArrays : any[] >8 : number >Uint8ClampedArray.from(obj) : Uint8ClampedArray ->Uint8ClampedArray.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8ClampedArray +>Uint8ClampedArray.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } >Uint8ClampedArray : Uint8ClampedArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8ClampedArray +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } >obj : ArrayLike return typedArrays; @@ -655,9 +655,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >0 : number >Int8Array.from(obj, mapFn) : Int8Array ->Int8Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int8Array +>Int8Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } >Int8Array : Int8ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int8Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -667,9 +667,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >1 : number >Uint8Array.from(obj, mapFn) : Uint8Array ->Uint8Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8Array +>Uint8Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } >Uint8Array : Uint8ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -679,9 +679,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >2 : number >Int16Array.from(obj, mapFn) : Int16Array ->Int16Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int16Array +>Int16Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } >Int16Array : Int16ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int16Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -691,9 +691,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >3 : number >Uint16Array.from(obj, mapFn) : Uint16Array ->Uint16Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint16Array +>Uint16Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } >Uint16Array : Uint16ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint16Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -703,9 +703,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >4 : number >Int32Array.from(obj, mapFn) : Int32Array ->Int32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int32Array +>Int32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } >Int32Array : Int32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -715,9 +715,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >5 : number >Uint32Array.from(obj, mapFn) : Uint32Array ->Uint32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint32Array +>Uint32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } >Uint32Array : Uint32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -727,9 +727,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >6 : number >Float32Array.from(obj, mapFn) : Float32Array ->Float32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float32Array +>Float32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } >Float32Array : Float32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -739,9 +739,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >7 : number >Float64Array.from(obj, mapFn) : Float64Array ->Float64Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float64Array +>Float64Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } >Float64Array : Float64ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float64Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -751,9 +751,9 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n >typedArrays : any[] >8 : number >Uint8ClampedArray.from(obj, mapFn) : Uint8ClampedArray ->Uint8ClampedArray.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8ClampedArray +>Uint8ClampedArray.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } >Uint8ClampedArray : Uint8ClampedArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8ClampedArray +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } >obj : ArrayLike >mapFn : (n: number, v: number) => number @@ -780,9 +780,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >0 : number >Int8Array.from(obj, mapFn, thisArg) : Int8Array ->Int8Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int8Array +>Int8Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } >Int8Array : Int8ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int8Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} @@ -793,9 +793,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >1 : number >Uint8Array.from(obj, mapFn, thisArg) : Uint8Array ->Uint8Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8Array +>Uint8Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } >Uint8Array : Uint8ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} @@ -806,9 +806,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >2 : number >Int16Array.from(obj, mapFn, thisArg) : Int16Array ->Int16Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int16Array +>Int16Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } >Int16Array : Int16ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int16Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} @@ -819,9 +819,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >3 : number >Uint16Array.from(obj, mapFn, thisArg) : Uint16Array ->Uint16Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint16Array +>Uint16Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } >Uint16Array : Uint16ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint16Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} @@ -832,9 +832,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >4 : number >Int32Array.from(obj, mapFn, thisArg) : Int32Array ->Int32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int32Array +>Int32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } >Int32Array : Int32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Int32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} @@ -845,9 +845,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >5 : number >Uint32Array.from(obj, mapFn, thisArg) : Uint32Array ->Uint32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint32Array +>Uint32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } >Uint32Array : Uint32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} @@ -858,9 +858,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >6 : number >Float32Array.from(obj, mapFn, thisArg) : Float32Array ->Float32Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float32Array +>Float32Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } >Float32Array : Float32ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float32Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} @@ -871,9 +871,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >7 : number >Float64Array.from(obj, mapFn, thisArg) : Float64Array ->Float64Array.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float64Array +>Float64Array.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } >Float64Array : Float64ArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Float64Array +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} @@ -884,9 +884,9 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v >typedArrays : any[] >8 : number >Uint8ClampedArray.from(obj, mapFn, thisArg) : Uint8ClampedArray ->Uint8ClampedArray.from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8ClampedArray +>Uint8ClampedArray.from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } >Uint8ClampedArray : Uint8ClampedArrayConstructor ->from : (arrayLike: ArrayLike | Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any) => Uint8ClampedArray +>from : { (arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; (arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; } >obj : ArrayLike >mapFn : (n: number, v: number) => number >thisArg : {} diff --git a/tests/baselines/reference/unionTypeCallSignatures.errors.txt b/tests/baselines/reference/unionTypeCallSignatures.errors.txt index c25a2bf9f847a..ebe38a589ee98 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeCallSignatures.errors.txt @@ -12,29 +12,25 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(30,1): error TS23 tests/cases/conformance/types/union/unionTypeCallSignatures.ts(31,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(36,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(37,12): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(40,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(41,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(42,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(43,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(46,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(47,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(48,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(49,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(40,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(42,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(43,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(47,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(48,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(49,12): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(55,45): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeCallSignatures.ts(56,12): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(59,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(60,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(61,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(62,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(63,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(66,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(67,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(68,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(69,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. -tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2349: Cannot invoke an expression whose type lacks a call signature. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(59,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(61,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(62,45): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(63,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(67,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(68,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(69,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2346: Supplied parameters do not match any signature of call target. -==== tests/cases/conformance/types/union/unionTypeCallSignatures.ts (34 errors) ==== +==== tests/cases/conformance/types/union/unionTypeCallSignatures.ts (30 errors) ==== var numOrDate: number | Date; var strOrBoolean: string | boolean; var strOrNum: string | number; @@ -80,7 +76,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2 ~~~~~~~ !!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. - var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; + var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; unionWithDifferentParameterCount();// no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2349: Cannot invoke an expression whose type lacks a call signature. @@ -91,7 +87,7 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2349: Cannot invoke an expression whose type lacks a call signature. - var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; + var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; strOrNum = unionWithOptionalParameter1('hello'); strOrNum = unionWithOptionalParameter1('hello', 10); strOrNum = unionWithOptionalParameter1('hello', "hello"); // error in parameter type @@ -104,30 +100,26 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2 var unionWithOptionalParameter2: { (a: string, b?: number): string; } | { (a: string, b: number): number }; strOrNum = unionWithOptionalParameter2('hello'); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = unionWithOptionalParameter2(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. var unionWithOptionalParameter3: { (a: string, b?: number): string; } | { (a: string): number; }; - strOrNum = unionWithOptionalParameter3('hello'); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + strOrNum = unionWithOptionalParameter3('hello'); strOrNum = unionWithOptionalParameter3('hello', 10); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = unionWithOptionalParameter3('hello', "hello"); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = unionWithOptionalParameter3(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. var unionWithRestParameter1: { (a: string, ...b: number[]): string; } | { (a: string, ...b: number[]): number }; strOrNum = unionWithRestParameter1('hello'); @@ -143,33 +135,31 @@ tests/cases/conformance/types/union/unionTypeCallSignatures.ts(70,12): error TS2 var unionWithRestParameter2: { (a: string, ...b: number[]): string; } | { (a: string, b: number): number }; strOrNum = unionWithRestParameter2('hello'); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = unionWithRestParameter2('hello', 10); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. strOrNum = unionWithRestParameter2('hello', 10, 11); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = unionWithRestParameter2(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. var unionWithRestParameter3: { (a: string, ...b: number[]): string; } | { (a: string): number }; - strOrNum = unionWithRestParameter3('hello'); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. + strOrNum = unionWithRestParameter3('hello'); strOrNum = unionWithRestParameter3('hello', 10); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = unionWithRestParameter3(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. + + \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeCallSignatures.js b/tests/baselines/reference/unionTypeCallSignatures.js index a4000038ce6cd..fc3dfc8ebbc96 100644 --- a/tests/baselines/reference/unionTypeCallSignatures.js +++ b/tests/baselines/reference/unionTypeCallSignatures.js @@ -26,12 +26,12 @@ unionOfDifferentNumberOfSignatures(); // error - no call signatures unionOfDifferentNumberOfSignatures(10); // error - no call signatures unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures - var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; +var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; unionWithDifferentParameterCount();// no call signature unionWithDifferentParameterCount("hello");// no call signature unionWithDifferentParameterCount("hello", 10);// no call signature - var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; +var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; strOrNum = unionWithOptionalParameter1('hello'); strOrNum = unionWithOptionalParameter1('hello', 10); strOrNum = unionWithOptionalParameter1('hello', "hello"); // error in parameter type @@ -44,7 +44,7 @@ strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signa strOrNum = unionWithOptionalParameter2(); // error no call signature var unionWithOptionalParameter3: { (a: string, b?: number): string; } | { (a: string): number; }; -strOrNum = unionWithOptionalParameter3('hello'); // error no call signature +strOrNum = unionWithOptionalParameter3('hello'); strOrNum = unionWithOptionalParameter3('hello', 10); // error no call signature strOrNum = unionWithOptionalParameter3('hello', "hello"); // error no call signature strOrNum = unionWithOptionalParameter3(); // error no call signature @@ -64,11 +64,13 @@ strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature strOrNum = unionWithRestParameter2(); // error no call signature var unionWithRestParameter3: { (a: string, ...b: number[]): string; } | { (a: string): number }; -strOrNum = unionWithRestParameter3('hello'); // error no call signature +strOrNum = unionWithRestParameter3('hello'); strOrNum = unionWithRestParameter3('hello', 10); // error no call signature strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature -strOrNum = unionWithRestParameter3(); // error no call signature +strOrNum = unionWithRestParameter3(); // error no call signature + + //// [unionTypeCallSignatures.js] var numOrDate; @@ -108,7 +110,7 @@ strOrNum = unionWithOptionalParameter2('hello', 10); // error no call signature strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signature strOrNum = unionWithOptionalParameter2(); // error no call signature var unionWithOptionalParameter3; -strOrNum = unionWithOptionalParameter3('hello'); // error no call signature +strOrNum = unionWithOptionalParameter3('hello'); strOrNum = unionWithOptionalParameter3('hello', 10); // error no call signature strOrNum = unionWithOptionalParameter3('hello', "hello"); // error no call signature strOrNum = unionWithOptionalParameter3(); // error no call signature @@ -125,7 +127,7 @@ strOrNum = unionWithRestParameter2('hello', 10, 11); // error no call signature strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature strOrNum = unionWithRestParameter2(); // error no call signature var unionWithRestParameter3; -strOrNum = unionWithRestParameter3('hello'); // error no call signature +strOrNum = unionWithRestParameter3('hello'); strOrNum = unionWithRestParameter3('hello', 10); // error no call signature strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature diff --git a/tests/baselines/reference/unionTypeCallSignatures2.js b/tests/baselines/reference/unionTypeCallSignatures2.js new file mode 100644 index 0000000000000..7ec5180972a08 --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures2.js @@ -0,0 +1,51 @@ +//// [unionTypeCallSignatures2.ts] +interface A { + (x: number): number; + (x: string, y?: string): boolean; + (x: Date): void; + (x: T[]): T[]; +} + +interface B { + (x: number): number; + (x: string): string; + (x: Date): void; + (x: T[]): T[]; +} + +interface C { + (x: string, ...y: string[]): number; + (x: number, s?: string): number; + (x: T[]): T[]; +} + +var f1: A | B | C; +var n1 = f1(42); // number +var s1 = f1("abc"); // boolean | string | number +var a1 = f1([true, false]); // boolean[] + +var f2: C | B | A; +var n2 = f2(42); // number +var s2 = f2("abc"); // number | string | boolean +var a2 = f2([true, false]); // boolean[] + +var f3: B | A | C; +var n3 = f3(42); // number +var s3 = f3("abc"); // string | boolean | number +var a3 = f3([true, false]); // boolean[] + + + +//// [unionTypeCallSignatures2.js] +var f1; +var n1 = f1(42); // number +var s1 = f1("abc"); // boolean | string | number +var a1 = f1([true, false]); // boolean[] +var f2; +var n2 = f2(42); // number +var s2 = f2("abc"); // number | string | boolean +var a2 = f2([true, false]); // boolean[] +var f3; +var n3 = f3(42); // number +var s3 = f3("abc"); // string | boolean | number +var a3 = f3([true, false]); // boolean[] diff --git a/tests/baselines/reference/unionTypeCallSignatures2.symbols b/tests/baselines/reference/unionTypeCallSignatures2.symbols new file mode 100644 index 0000000000000..35ba9464df094 --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures2.symbols @@ -0,0 +1,115 @@ +=== tests/cases/conformance/types/union/unionTypeCallSignatures2.ts === +interface A { +>A : Symbol(A, Decl(unionTypeCallSignatures2.ts, 0, 0)) + + (x: number): number; +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 1, 5)) + + (x: string, y?: string): boolean; +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 2, 5)) +>y : Symbol(y, Decl(unionTypeCallSignatures2.ts, 2, 15)) + + (x: Date): void; +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 3, 5)) +>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) + + (x: T[]): T[]; +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 4, 5)) +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 4, 8)) +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 4, 5)) +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 4, 5)) +} + +interface B { +>B : Symbol(B, Decl(unionTypeCallSignatures2.ts, 5, 1)) + + (x: number): number; +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 8, 5)) + + (x: string): string; +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 9, 5)) + + (x: Date): void; +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 10, 5)) +>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11)) + + (x: T[]): T[]; +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 11, 5)) +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 11, 8)) +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 11, 5)) +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 11, 5)) +} + +interface C { +>C : Symbol(C, Decl(unionTypeCallSignatures2.ts, 12, 1)) + + (x: string, ...y: string[]): number; +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 15, 5)) +>y : Symbol(y, Decl(unionTypeCallSignatures2.ts, 15, 15)) + + (x: number, s?: string): number; +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 16, 5)) +>s : Symbol(s, Decl(unionTypeCallSignatures2.ts, 16, 15)) + + (x: T[]): T[]; +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 17, 5)) +>x : Symbol(x, Decl(unionTypeCallSignatures2.ts, 17, 8)) +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 17, 5)) +>T : Symbol(T, Decl(unionTypeCallSignatures2.ts, 17, 5)) +} + +var f1: A | B | C; +>f1 : Symbol(f1, Decl(unionTypeCallSignatures2.ts, 20, 3)) +>A : Symbol(A, Decl(unionTypeCallSignatures2.ts, 0, 0)) +>B : Symbol(B, Decl(unionTypeCallSignatures2.ts, 5, 1)) +>C : Symbol(C, Decl(unionTypeCallSignatures2.ts, 12, 1)) + +var n1 = f1(42); // number +>n1 : Symbol(n1, Decl(unionTypeCallSignatures2.ts, 21, 3)) +>f1 : Symbol(f1, Decl(unionTypeCallSignatures2.ts, 20, 3)) + +var s1 = f1("abc"); // boolean | string | number +>s1 : Symbol(s1, Decl(unionTypeCallSignatures2.ts, 22, 3)) +>f1 : Symbol(f1, Decl(unionTypeCallSignatures2.ts, 20, 3)) + +var a1 = f1([true, false]); // boolean[] +>a1 : Symbol(a1, Decl(unionTypeCallSignatures2.ts, 23, 3)) +>f1 : Symbol(f1, Decl(unionTypeCallSignatures2.ts, 20, 3)) + +var f2: C | B | A; +>f2 : Symbol(f2, Decl(unionTypeCallSignatures2.ts, 25, 3)) +>C : Symbol(C, Decl(unionTypeCallSignatures2.ts, 12, 1)) +>B : Symbol(B, Decl(unionTypeCallSignatures2.ts, 5, 1)) +>A : Symbol(A, Decl(unionTypeCallSignatures2.ts, 0, 0)) + +var n2 = f2(42); // number +>n2 : Symbol(n2, Decl(unionTypeCallSignatures2.ts, 26, 3)) +>f2 : Symbol(f2, Decl(unionTypeCallSignatures2.ts, 25, 3)) + +var s2 = f2("abc"); // number | string | boolean +>s2 : Symbol(s2, Decl(unionTypeCallSignatures2.ts, 27, 3)) +>f2 : Symbol(f2, Decl(unionTypeCallSignatures2.ts, 25, 3)) + +var a2 = f2([true, false]); // boolean[] +>a2 : Symbol(a2, Decl(unionTypeCallSignatures2.ts, 28, 3)) +>f2 : Symbol(f2, Decl(unionTypeCallSignatures2.ts, 25, 3)) + +var f3: B | A | C; +>f3 : Symbol(f3, Decl(unionTypeCallSignatures2.ts, 30, 3)) +>B : Symbol(B, Decl(unionTypeCallSignatures2.ts, 5, 1)) +>A : Symbol(A, Decl(unionTypeCallSignatures2.ts, 0, 0)) +>C : Symbol(C, Decl(unionTypeCallSignatures2.ts, 12, 1)) + +var n3 = f3(42); // number +>n3 : Symbol(n3, Decl(unionTypeCallSignatures2.ts, 31, 3)) +>f3 : Symbol(f3, Decl(unionTypeCallSignatures2.ts, 30, 3)) + +var s3 = f3("abc"); // string | boolean | number +>s3 : Symbol(s3, Decl(unionTypeCallSignatures2.ts, 32, 3)) +>f3 : Symbol(f3, Decl(unionTypeCallSignatures2.ts, 30, 3)) + +var a3 = f3([true, false]); // boolean[] +>a3 : Symbol(a3, Decl(unionTypeCallSignatures2.ts, 33, 3)) +>f3 : Symbol(f3, Decl(unionTypeCallSignatures2.ts, 30, 3)) + + diff --git a/tests/baselines/reference/unionTypeCallSignatures2.types b/tests/baselines/reference/unionTypeCallSignatures2.types new file mode 100644 index 0000000000000..64295c1b4529e --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures2.types @@ -0,0 +1,139 @@ +=== tests/cases/conformance/types/union/unionTypeCallSignatures2.ts === +interface A { +>A : A + + (x: number): number; +>x : number + + (x: string, y?: string): boolean; +>x : string +>y : string + + (x: Date): void; +>x : Date +>Date : Date + + (x: T[]): T[]; +>T : T +>x : T[] +>T : T +>T : T +} + +interface B { +>B : B + + (x: number): number; +>x : number + + (x: string): string; +>x : string + + (x: Date): void; +>x : Date +>Date : Date + + (x: T[]): T[]; +>T : T +>x : T[] +>T : T +>T : T +} + +interface C { +>C : C + + (x: string, ...y: string[]): number; +>x : string +>y : string[] + + (x: number, s?: string): number; +>x : number +>s : string + + (x: T[]): T[]; +>T : T +>x : T[] +>T : T +>T : T +} + +var f1: A | B | C; +>f1 : A | B | C +>A : A +>B : B +>C : C + +var n1 = f1(42); // number +>n1 : number +>f1(42) : number +>f1 : A | B | C +>42 : number + +var s1 = f1("abc"); // boolean | string | number +>s1 : boolean | string | number +>f1("abc") : boolean | string | number +>f1 : A | B | C +>"abc" : string + +var a1 = f1([true, false]); // boolean[] +>a1 : boolean[] +>f1([true, false]) : boolean[] +>f1 : A | B | C +>[true, false] : boolean[] +>true : boolean +>false : boolean + +var f2: C | B | A; +>f2 : C | B | A +>C : C +>B : B +>A : A + +var n2 = f2(42); // number +>n2 : number +>f2(42) : number +>f2 : C | B | A +>42 : number + +var s2 = f2("abc"); // number | string | boolean +>s2 : number | string | boolean +>f2("abc") : number | string | boolean +>f2 : C | B | A +>"abc" : string + +var a2 = f2([true, false]); // boolean[] +>a2 : boolean[] +>f2([true, false]) : boolean[] +>f2 : C | B | A +>[true, false] : boolean[] +>true : boolean +>false : boolean + +var f3: B | A | C; +>f3 : B | A | C +>B : B +>A : A +>C : C + +var n3 = f3(42); // number +>n3 : number +>f3(42) : number +>f3 : B | A | C +>42 : number + +var s3 = f3("abc"); // string | boolean | number +>s3 : string | boolean | number +>f3("abc") : string | boolean | number +>f3 : B | A | C +>"abc" : string + +var a3 = f3([true, false]); // boolean[] +>a3 : boolean[] +>f3([true, false]) : boolean[] +>f3 : B | A | C +>[true, false] : boolean[] +>true : boolean +>false : boolean + + diff --git a/tests/baselines/reference/unionTypeCallSignatures3.js b/tests/baselines/reference/unionTypeCallSignatures3.js new file mode 100644 index 0000000000000..2dae152e47450 --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures3.js @@ -0,0 +1,39 @@ +//// [unionTypeCallSignatures3.ts] +function f1(s: string) { } +function f2(s?: string) { } +function f3(...s: string[]) { } +function f4(s: string, s2?: string) { } +function f5(s?: string, n?: number) { } +function f6(s?: string, ...n: number[]) { } +function f7(s: string, ...sRest: string[]) { } + +var fUnion: typeof f1 | typeof f2 | typeof f3 | typeof f4 | typeof f5 | typeof f6 | typeof f7; + +fUnion(""); // All constituents can be called by passing a single string. + + +//// [unionTypeCallSignatures3.js] +function f1(s) { } +function f2(s) { } +function f3() { + var s = []; + for (var _i = 0; _i < arguments.length; _i++) { + s[_i - 0] = arguments[_i]; + } +} +function f4(s, s2) { } +function f5(s, n) { } +function f6(s) { + var n = []; + for (var _i = 1; _i < arguments.length; _i++) { + n[_i - 1] = arguments[_i]; + } +} +function f7(s) { + var sRest = []; + for (var _i = 1; _i < arguments.length; _i++) { + sRest[_i - 1] = arguments[_i]; + } +} +var fUnion; +fUnion(""); // All constituents can be called by passing a single string. diff --git a/tests/baselines/reference/unionTypeCallSignatures3.symbols b/tests/baselines/reference/unionTypeCallSignatures3.symbols new file mode 100644 index 0000000000000..45dffe2d8218b --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures3.symbols @@ -0,0 +1,46 @@ +=== tests/cases/conformance/types/union/unionTypeCallSignatures3.ts === +function f1(s: string) { } +>f1 : Symbol(f1, Decl(unionTypeCallSignatures3.ts, 0, 0)) +>s : Symbol(s, Decl(unionTypeCallSignatures3.ts, 0, 12)) + +function f2(s?: string) { } +>f2 : Symbol(f2, Decl(unionTypeCallSignatures3.ts, 0, 26)) +>s : Symbol(s, Decl(unionTypeCallSignatures3.ts, 1, 12)) + +function f3(...s: string[]) { } +>f3 : Symbol(f3, Decl(unionTypeCallSignatures3.ts, 1, 27)) +>s : Symbol(s, Decl(unionTypeCallSignatures3.ts, 2, 12)) + +function f4(s: string, s2?: string) { } +>f4 : Symbol(f4, Decl(unionTypeCallSignatures3.ts, 2, 31)) +>s : Symbol(s, Decl(unionTypeCallSignatures3.ts, 3, 12)) +>s2 : Symbol(s2, Decl(unionTypeCallSignatures3.ts, 3, 22)) + +function f5(s?: string, n?: number) { } +>f5 : Symbol(f5, Decl(unionTypeCallSignatures3.ts, 3, 39)) +>s : Symbol(s, Decl(unionTypeCallSignatures3.ts, 4, 12)) +>n : Symbol(n, Decl(unionTypeCallSignatures3.ts, 4, 23)) + +function f6(s?: string, ...n: number[]) { } +>f6 : Symbol(f6, Decl(unionTypeCallSignatures3.ts, 4, 39)) +>s : Symbol(s, Decl(unionTypeCallSignatures3.ts, 5, 12)) +>n : Symbol(n, Decl(unionTypeCallSignatures3.ts, 5, 23)) + +function f7(s: string, ...sRest: string[]) { } +>f7 : Symbol(f7, Decl(unionTypeCallSignatures3.ts, 5, 43)) +>s : Symbol(s, Decl(unionTypeCallSignatures3.ts, 6, 12)) +>sRest : Symbol(sRest, Decl(unionTypeCallSignatures3.ts, 6, 22)) + +var fUnion: typeof f1 | typeof f2 | typeof f3 | typeof f4 | typeof f5 | typeof f6 | typeof f7; +>fUnion : Symbol(fUnion, Decl(unionTypeCallSignatures3.ts, 8, 3)) +>f1 : Symbol(f1, Decl(unionTypeCallSignatures3.ts, 0, 0)) +>f2 : Symbol(f2, Decl(unionTypeCallSignatures3.ts, 0, 26)) +>f3 : Symbol(f3, Decl(unionTypeCallSignatures3.ts, 1, 27)) +>f4 : Symbol(f4, Decl(unionTypeCallSignatures3.ts, 2, 31)) +>f5 : Symbol(f5, Decl(unionTypeCallSignatures3.ts, 3, 39)) +>f6 : Symbol(f6, Decl(unionTypeCallSignatures3.ts, 4, 39)) +>f7 : Symbol(f7, Decl(unionTypeCallSignatures3.ts, 5, 43)) + +fUnion(""); // All constituents can be called by passing a single string. +>fUnion : Symbol(fUnion, Decl(unionTypeCallSignatures3.ts, 8, 3)) + diff --git a/tests/baselines/reference/unionTypeCallSignatures3.types b/tests/baselines/reference/unionTypeCallSignatures3.types new file mode 100644 index 0000000000000..52aae993e4aaf --- /dev/null +++ b/tests/baselines/reference/unionTypeCallSignatures3.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/types/union/unionTypeCallSignatures3.ts === +function f1(s: string) { } +>f1 : (s: string) => void +>s : string + +function f2(s?: string) { } +>f2 : (s?: string) => void +>s : string + +function f3(...s: string[]) { } +>f3 : (...s: string[]) => void +>s : string[] + +function f4(s: string, s2?: string) { } +>f4 : (s: string, s2?: string) => void +>s : string +>s2 : string + +function f5(s?: string, n?: number) { } +>f5 : (s?: string, n?: number) => void +>s : string +>n : number + +function f6(s?: string, ...n: number[]) { } +>f6 : (s?: string, ...n: number[]) => void +>s : string +>n : number[] + +function f7(s: string, ...sRest: string[]) { } +>f7 : (s: string, ...sRest: string[]) => void +>s : string +>sRest : string[] + +var fUnion: typeof f1 | typeof f2 | typeof f3 | typeof f4 | typeof f5 | typeof f6 | typeof f7; +>fUnion : ((s: string) => void) | ((s?: string) => void) | ((...s: string[]) => void) | ((s: string, s2?: string) => void) | ((s?: string, n?: number) => void) | ((s?: string, ...n: number[]) => void) | ((s: string, ...sRest: string[]) => void) +>f1 : (s: string) => void +>f2 : (s?: string) => void +>f3 : (...s: string[]) => void +>f4 : (s: string, s2?: string) => void +>f5 : (s?: string, n?: number) => void +>f6 : (s?: string, ...n: number[]) => void +>f7 : (s: string, ...sRest: string[]) => void + +fUnion(""); // All constituents can be called by passing a single string. +>fUnion("") : void +>fUnion : ((s: string) => void) | ((s?: string) => void) | ((...s: string[]) => void) | ((s: string, s2?: string) => void) | ((s?: string, n?: number) => void) | ((s?: string, ...n: number[]) => void) | ((s: string, ...sRest: string[]) => void) +>"" : string + diff --git a/tests/baselines/reference/unionTypeConstructSignatures.errors.txt b/tests/baselines/reference/unionTypeConstructSignatures.errors.txt index cbdcc9ed12a03..0332aa611100f 100644 --- a/tests/baselines/reference/unionTypeConstructSignatures.errors.txt +++ b/tests/baselines/reference/unionTypeConstructSignatures.errors.txt @@ -12,29 +12,25 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(30,1): error tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(31,1): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(36,53): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(37,12): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(40,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(41,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(42,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(43,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(46,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(47,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(48,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(49,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(40,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(42,53): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(43,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(47,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(48,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(49,12): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(55,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(56,12): error TS2346: Supplied parameters do not match any signature of call target. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(59,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(60,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(61,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(62,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(63,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(66,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(67,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(68,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(69,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. -tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(59,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(61,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(62,49): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(63,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(67,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(68,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(69,12): error TS2346: Supplied parameters do not match any signature of call target. +tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): error TS2346: Supplied parameters do not match any signature of call target. -==== tests/cases/conformance/types/union/unionTypeConstructSignatures.ts (34 errors) ==== +==== tests/cases/conformance/types/union/unionTypeConstructSignatures.ts (30 errors) ==== var numOrDate: number | Date; var strOrBoolean: string | boolean; var strOrNum: string | number; @@ -104,30 +100,26 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro var unionWithOptionalParameter2: { new (a: string, b?: number): string; } | { new (a: string, b: number): number }; strOrNum = new unionWithOptionalParameter2('hello'); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = new unionWithOptionalParameter2('hello', 10); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. strOrNum = new unionWithOptionalParameter2('hello', "hello"); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = new unionWithOptionalParameter2(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. var unionWithOptionalParameter3: { new (a: string, b?: number): string; } | { new (a: string): number; }; strOrNum = new unionWithOptionalParameter3('hello'); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. strOrNum = new unionWithOptionalParameter3('hello', 10); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = new unionWithOptionalParameter3('hello', "hello"); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = new unionWithOptionalParameter3(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. var unionWithRestParameter1: { new (a: string, ...b: number[]): string; } | { new (a: string, ...b: number[]): number }; strOrNum = new unionWithRestParameter1('hello'); @@ -143,33 +135,29 @@ tests/cases/conformance/types/union/unionTypeConstructSignatures.ts(70,12): erro var unionWithRestParameter2: { new (a: string, ...b: number[]): string; } | { new (a: string, b: number): number }; strOrNum = new unionWithRestParameter2('hello'); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = new unionWithRestParameter2('hello', 10); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. strOrNum = new unionWithRestParameter2('hello', 10, 11); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = new unionWithRestParameter2('hello', "hello"); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. + ~~~~~~~ +!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. strOrNum = new unionWithRestParameter2(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. var unionWithRestParameter3: { new (a: string, ...b: number[]): string; } | { new (a: string): number }; strOrNum = new unionWithRestParameter3('hello'); // error no call signature - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. strOrNum = new unionWithRestParameter3('hello', 10); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = new unionWithRestParameter3('hello', 10, 11); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = new unionWithRestParameter3('hello', "hello"); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. +!!! error TS2346: Supplied parameters do not match any signature of call target. strOrNum = new unionWithRestParameter3(); // error no call signature ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature. \ No newline at end of file +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/cases/compiler/commentsArgumentsOfCallExpression1.ts b/tests/cases/compiler/commentsArgumentsOfCallExpression1.ts new file mode 100644 index 0000000000000..4dfab371d62e8 --- /dev/null +++ b/tests/cases/compiler/commentsArgumentsOfCallExpression1.ts @@ -0,0 +1,15 @@ +function foo(/*c1*/ x: any) { } +foo(/*c2*/ 1); +foo(/*c3*/ function () { }); +foo( + /*c4*/ + () => { }); +foo( + /*c5*/ + /*c6*/ + () => { }); +foo(/*c7*/ + () => { }); +foo( + /*c7*/ + /*c8*/() => { }); \ No newline at end of file diff --git a/tests/cases/compiler/commentsArgumentsOfCallExpression2.ts b/tests/cases/compiler/commentsArgumentsOfCallExpression2.ts new file mode 100644 index 0000000000000..65350880b5d71 --- /dev/null +++ b/tests/cases/compiler/commentsArgumentsOfCallExpression2.ts @@ -0,0 +1,10 @@ +function foo(/*c1*/ x: any, /*d1*/ y: any,/*e1*/w?: any) { } +var a, b: any; +foo(/*c2*/ 1, /*d2*/ 1 + 2, /*e1*/ a + b); +foo(/*c3*/ function () { }, /*d2*/() => { }, /*e2*/ a + /*e3*/ b); +foo(/*c3*/ function () { }, /*d3*/() => { }, /*e3*/(a + b)); +foo( + /*c4*/ function () { }, + /*d4*/() => { }, + /*e4*/ + /*e5*/ "hello"); \ No newline at end of file diff --git a/tests/cases/compiler/commentsOnPropertyOfObjectLiteral1.ts b/tests/cases/compiler/commentsOnPropertyOfObjectLiteral1.ts new file mode 100644 index 0000000000000..6ecf7a754bde7 --- /dev/null +++ b/tests/cases/compiler/commentsOnPropertyOfObjectLiteral1.ts @@ -0,0 +1,13 @@ +var resolve = { + id: /*! @ngInject */ (details: any) => details.id, + id1: /* c1 */ "hello", + id2: + /*! @ngInject */ (details: any) => details.id, + id3: + /*! @ngInject */ + (details: any) => details.id, + id4: + /*! @ngInject */ + /* C2 */ + (details: any) => details.id, +}; \ No newline at end of file diff --git a/tests/cases/compiler/commonjsSafeImport.ts b/tests/cases/compiler/commonjsSafeImport.ts new file mode 100644 index 0000000000000..ce494ee54ad8e --- /dev/null +++ b/tests/cases/compiler/commonjsSafeImport.ts @@ -0,0 +1,11 @@ +// @target: ES5 +// @module: commonjs +// @declaration: true +// @filename: 10_lib.ts + +export function Foo() {} + +// @filename: main.ts +import { Foo } from './10_lib'; + +Foo(); diff --git a/tests/cases/compiler/declarationEmit_exportAssignment.ts b/tests/cases/compiler/declarationEmit_exportAssignment.ts new file mode 100644 index 0000000000000..166f4abe8e7d1 --- /dev/null +++ b/tests/cases/compiler/declarationEmit_exportAssignment.ts @@ -0,0 +1,12 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +// @filename: utils.ts +export function foo() { } +export function bar() { } +export interface Buzz { } + +// @filename: index.ts +import {foo} from "utils"; +export = foo; \ No newline at end of file diff --git a/tests/cases/compiler/declarationEmit_exportDeclaration.ts b/tests/cases/compiler/declarationEmit_exportDeclaration.ts new file mode 100644 index 0000000000000..a9e0bda761f1e --- /dev/null +++ b/tests/cases/compiler/declarationEmit_exportDeclaration.ts @@ -0,0 +1,15 @@ +// @target: es5 +// @module: commonjs +// @declaration: true + +// @filename: utils.ts +export function foo() { } +export function bar() { } +export interface Buzz { } + +// @filename: index.ts +import {foo, bar, Buzz} from "utils"; + +foo(); +let obj: Buzz; +export {bar}; \ No newline at end of file diff --git a/tests/cases/compiler/decoratorMetadataWithConstructorType.ts b/tests/cases/compiler/decoratorMetadataWithConstructorType.ts new file mode 100644 index 0000000000000..31c42ee9b437b --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithConstructorType.ts @@ -0,0 +1,21 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs + +declare var console: { + log(msg: string): void; +}; + +class A { + constructor() { console.log('new A'); } +} + +function decorator(target: Object, propertyKey: string) { +} + +export class B { + @decorator + x: A = new A(); +} diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts new file mode 100644 index 0000000000000..8d198e44752f5 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export class db { + public doSomething() { + } +} + +// @filename: service.ts +import {db} from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db; + + constructor(db: db) { + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts new file mode 100644 index 0000000000000..ac097dd3ba452 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision2.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export class db { + public doSomething() { + } +} + +// @filename: service.ts +import {db as Database} from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: Database; + + constructor(db: Database) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision3.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision3.ts new file mode 100644 index 0000000000000..e15570cb5baae --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision3.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export class db { + public doSomething() { + } +} + +// @filename: service.ts +import db = require('./db'); +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db.db; + + constructor(db: db.db) { // collision with namespace of external module db + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision4.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision4.ts new file mode 100644 index 0000000000000..d04d1300531da --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision4.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export class db { + public doSomething() { + } +} + +// @filename: service.ts +import db from './db'; // error no default export +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db.db; + + constructor(db: db.db) { + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts new file mode 100644 index 0000000000000..24934963b3e12 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision5.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export default class db { + public doSomething() { + } +} + +// @filename: service.ts +import db from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db; + + constructor(db: db) { // collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts new file mode 100644 index 0000000000000..2043279c4aaf2 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision6.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export default class db { + public doSomething() { + } +} + +// @filename: service.ts +import database from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: database; + + constructor(db: database) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision7.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision7.ts new file mode 100644 index 0000000000000..bbedf61c6dfc5 --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision7.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export default class db { + public doSomething() { + } +} + +// @filename: service.ts +import db from './db'; +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: db.db; //error + + constructor(db: db.db) { // error + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision8.ts b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision8.ts new file mode 100644 index 0000000000000..e3318d813a87b --- /dev/null +++ b/tests/cases/compiler/decoratorMetadataWithImportDeclarationNameCollision8.ts @@ -0,0 +1,26 @@ +// @noemithelpers: true +// @experimentaldecorators: true +// @emitdecoratormetadata: true +// @target: es5 +// @module: commonjs +// @filename: db.ts +export class db { + public doSomething() { + } +} + +// @filename: service.ts +import database = require('./db'); +function someDecorator(target) { + return target; +} +@someDecorator +class MyClass { + db: database.db; + + constructor(db: database.db) { // no collision + this.db = db; + this.db.doSomething(); + } +} +export {MyClass}; diff --git a/tests/cases/compiler/es6ImportEqualsDeclaration2.ts b/tests/cases/compiler/es6ImportEqualsDeclaration2.ts new file mode 100644 index 0000000000000..554740d80e1f5 --- /dev/null +++ b/tests/cases/compiler/es6ImportEqualsDeclaration2.ts @@ -0,0 +1,19 @@ +// @target: es6 + +// @filename: server.d.ts +declare module "other" { + export class C { } +} + +declare module "server" { + import events = require("other"); // Ambient declaration, no error expected. + + module S { + export var a: number; + } + + export = S; // Ambient declaration, no error expected. +} + +// @filename: client.ts +import {a} from "server"; diff --git a/tests/cases/compiler/jsxHash.jsx b/tests/cases/compiler/jsxHash.jsx new file mode 100644 index 0000000000000..cf7e2b1b9e7e2 --- /dev/null +++ b/tests/cases/compiler/jsxHash.jsx @@ -0,0 +1,11 @@ +var t01 = #; +var t02 = {0}#; +var t03 = #{0}; +var t04 = #{0}#; +var t05 = #; +var t06 = #; +var t07 = ##; +var t08 = #; +var t09 = ##; +var t10 = #; +var t11 = #; diff --git a/tests/cases/compiler/moduleResolutionNoResolve.ts b/tests/cases/compiler/moduleResolutionNoResolve.ts new file mode 100644 index 0000000000000..aea0208b5d68a --- /dev/null +++ b/tests/cases/compiler/moduleResolutionNoResolve.ts @@ -0,0 +1,8 @@ +// @module:commonjs +// @noResolve: true + +// @filename: a.ts +import a = require('./b'); + +// @filename: b.ts +export var c = ''; diff --git a/tests/cases/compiler/nodeResolution1.ts b/tests/cases/compiler/nodeResolution1.ts new file mode 100644 index 0000000000000..19316ef251b5d --- /dev/null +++ b/tests/cases/compiler/nodeResolution1.ts @@ -0,0 +1,8 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: a.ts +export var x = 1; + +// @filename: b.ts +import y = require("./a"); \ No newline at end of file diff --git a/tests/cases/compiler/nodeResolution2.ts b/tests/cases/compiler/nodeResolution2.ts new file mode 100644 index 0000000000000..9d1972c72390e --- /dev/null +++ b/tests/cases/compiler/nodeResolution2.ts @@ -0,0 +1,8 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/a.d.ts +export var x: number; + +// @filename: b.ts +import y = require("a"); \ No newline at end of file diff --git a/tests/cases/compiler/nodeResolution3.ts b/tests/cases/compiler/nodeResolution3.ts new file mode 100644 index 0000000000000..ede8f76dbbeef --- /dev/null +++ b/tests/cases/compiler/nodeResolution3.ts @@ -0,0 +1,8 @@ +// @module: commonjs +// @moduleResolution: node + +// @filename: node_modules/b/index.d.ts +export var x: number; + +// @filename: a.ts +import y = require("b"); \ No newline at end of file diff --git a/tests/cases/compiler/out-flag2.ts b/tests/cases/compiler/out-flag2.ts new file mode 100644 index 0000000000000..d3349563a9f44 --- /dev/null +++ b/tests/cases/compiler/out-flag2.ts @@ -0,0 +1,11 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: commonjs +// @outFile: c.js + +// @Filename: a.ts +class A { } + +// @Filename: b.ts +class B { } \ No newline at end of file diff --git a/tests/cases/compiler/out-flag3.ts b/tests/cases/compiler/out-flag3.ts new file mode 100644 index 0000000000000..cb3c6819811e1 --- /dev/null +++ b/tests/cases/compiler/out-flag3.ts @@ -0,0 +1,14 @@ +// @target: ES5 +// @sourcemap: true +// @declaration: true +// @module: commonjs +// @outFile: c.js +// @out: d.js + +// --out and --outFile error + +// @Filename: a.ts +class A { } + +// @Filename: b.ts +class B { } \ No newline at end of file diff --git a/tests/cases/compiler/sourceMap-Comments.ts b/tests/cases/compiler/sourceMap-Comments.ts new file mode 100644 index 0000000000000..6b810858d6e3d --- /dev/null +++ b/tests/cases/compiler/sourceMap-Comments.ts @@ -0,0 +1,21 @@ +// @target: ES5 +// @sourcemap: true +module sas.tools { + export class Test { + public doX(): void { + let f: number = 2; + switch (f) { + case 1: + break; + case 2: + //line comment 1 + //line comment 2 + break; + case 3: + //a comment + break; + } + } + } + +} diff --git a/tests/cases/compiler/sourceMap-Comments2.ts b/tests/cases/compiler/sourceMap-Comments2.ts new file mode 100644 index 0000000000000..7a064c81c9ff3 --- /dev/null +++ b/tests/cases/compiler/sourceMap-Comments2.ts @@ -0,0 +1,21 @@ +// @target: ES5 +// @sourcemap: true +function foo(str: string, num: number): void { + return; +} + +/** + * some sort of block quote + */ +function bar(str: string, num: number): void { + return; +} + +// some sort of comment +function baz(str: string, num: number): void { + return; +} + +function qat(str: string, num: number): void { + return; +} \ No newline at end of file diff --git a/tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts b/tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts new file mode 100644 index 0000000000000..d4d25743333fa --- /dev/null +++ b/tests/cases/conformance/classes/classExpressions/extendClassExpressionFromModule.ts @@ -0,0 +1,10 @@ +// @module: commonjs +// @Filename: foo1.ts +class x{} + +export = x; + +// @Filename: foo2.ts +import foo1 = require('./foo1'); +var x = foo1; +class y extends x {} diff --git a/tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts b/tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts index 1b1e3cfab6c38..f72845c18a4a9 100644 --- a/tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts +++ b/tests/cases/conformance/expressions/typeGuards/typeGuardsInIfStatement.ts @@ -1,8 +1,8 @@ -// In the true branch statement of an ‘if’ statement, -// the type of a variable or parameter is narrowed by any type guard in the ‘if’ condition when true, +// In the true branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when true, // provided the true branch statement contains no assignments to the variable or parameter. -// In the false branch statement of an ‘if’ statement, -// the type of a variable or parameter is narrowed by any type guard in the ‘if’ condition when false, +// In the false branch statement of an 'if' statement, +// the type of a variable or parameter is narrowed by any type guard in the 'if' condition when false, // provided the false branch statement contains no assignments to the variable or parameter function foo(x: number | string) { if (typeof x === "string") { diff --git a/tests/cases/conformance/externalModules/reexportClassDefinition.ts b/tests/cases/conformance/externalModules/reexportClassDefinition.ts new file mode 100644 index 0000000000000..31d90fd7fd2c7 --- /dev/null +++ b/tests/cases/conformance/externalModules/reexportClassDefinition.ts @@ -0,0 +1,16 @@ +// @module: commonjs +// @Filename: foo1.ts +class x{} +export = x; + +// @Filename: foo2.ts +import foo1 = require('./foo1'); + +export = { + x: foo1 +} + +// @Filename: foo3.ts +import foo2 = require('./foo2') +class x extends foo2.x {} + diff --git a/tests/cases/conformance/jsx/tsxReactEmitEntities.tsx b/tests/cases/conformance/jsx/tsxReactEmitEntities.tsx new file mode 100644 index 0000000000000..4b7dc5780f8e9 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxReactEmitEntities.tsx @@ -0,0 +1,11 @@ +//@filename: file.tsx +//@jsx: react +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +
Dot goes here: · ¬AnEntity;
; diff --git a/tests/cases/conformance/jsx/tsxReactEmitWhitespace2.tsx b/tests/cases/conformance/jsx/tsxReactEmitWhitespace2.tsx new file mode 100644 index 0000000000000..964064979ec55 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxReactEmitWhitespace2.tsx @@ -0,0 +1,17 @@ +//@filename: file.tsx +//@jsx: react +declare module JSX { + interface Element { } + interface IntrinsicElements { + [s: string]: any; + } +} +declare var React: any; + +// Emit ' word' in the last string +
word code word
; +// Same here +
code word
; +// And here +
word
; + diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures.ts index 1261de3299e63..ca5993297430a 100644 --- a/tests/cases/conformance/types/union/unionTypeCallSignatures.ts +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures.ts @@ -25,12 +25,12 @@ unionOfDifferentNumberOfSignatures(); // error - no call signatures unionOfDifferentNumberOfSignatures(10); // error - no call signatures unionOfDifferentNumberOfSignatures("hello"); // error - no call signatures - var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; +var unionWithDifferentParameterCount: { (a: string): string; } | { (a: string, b: number): number; } ; unionWithDifferentParameterCount();// no call signature unionWithDifferentParameterCount("hello");// no call signature unionWithDifferentParameterCount("hello", 10);// no call signature - var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; +var unionWithOptionalParameter1: { (a: string, b?: number): string; } | { (a: string, b?: number): number; }; strOrNum = unionWithOptionalParameter1('hello'); strOrNum = unionWithOptionalParameter1('hello', 10); strOrNum = unionWithOptionalParameter1('hello', "hello"); // error in parameter type @@ -43,7 +43,7 @@ strOrNum = unionWithOptionalParameter2('hello', "hello"); // error no call signa strOrNum = unionWithOptionalParameter2(); // error no call signature var unionWithOptionalParameter3: { (a: string, b?: number): string; } | { (a: string): number; }; -strOrNum = unionWithOptionalParameter3('hello'); // error no call signature +strOrNum = unionWithOptionalParameter3('hello'); strOrNum = unionWithOptionalParameter3('hello', 10); // error no call signature strOrNum = unionWithOptionalParameter3('hello', "hello"); // error no call signature strOrNum = unionWithOptionalParameter3(); // error no call signature @@ -63,8 +63,9 @@ strOrNum = unionWithRestParameter2('hello', "hello"); // error no call signature strOrNum = unionWithRestParameter2(); // error no call signature var unionWithRestParameter3: { (a: string, ...b: number[]): string; } | { (a: string): number }; -strOrNum = unionWithRestParameter3('hello'); // error no call signature +strOrNum = unionWithRestParameter3('hello'); strOrNum = unionWithRestParameter3('hello', 10); // error no call signature strOrNum = unionWithRestParameter3('hello', 10, 11); // error no call signature strOrNum = unionWithRestParameter3('hello', "hello"); // error no call signature -strOrNum = unionWithRestParameter3(); // error no call signature \ No newline at end of file +strOrNum = unionWithRestParameter3(); // error no call signature + diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures2.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures2.ts new file mode 100644 index 0000000000000..2fa5190cc35b8 --- /dev/null +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures2.ts @@ -0,0 +1,35 @@ +interface A { + (x: number): number; + (x: string, y?: string): boolean; + (x: Date): void; + (x: T[]): T[]; +} + +interface B { + (x: number): number; + (x: string): string; + (x: Date): void; + (x: T[]): T[]; +} + +interface C { + (x: string, ...y: string[]): number; + (x: number, s?: string): number; + (x: T[]): T[]; +} + +var f1: A | B | C; +var n1 = f1(42); // number +var s1 = f1("abc"); // boolean | string | number +var a1 = f1([true, false]); // boolean[] + +var f2: C | B | A; +var n2 = f2(42); // number +var s2 = f2("abc"); // number | string | boolean +var a2 = f2([true, false]); // boolean[] + +var f3: B | A | C; +var n3 = f3(42); // number +var s3 = f3("abc"); // string | boolean | number +var a3 = f3([true, false]); // boolean[] + diff --git a/tests/cases/conformance/types/union/unionTypeCallSignatures3.ts b/tests/cases/conformance/types/union/unionTypeCallSignatures3.ts new file mode 100644 index 0000000000000..8549315a31986 --- /dev/null +++ b/tests/cases/conformance/types/union/unionTypeCallSignatures3.ts @@ -0,0 +1,11 @@ +function f1(s: string) { } +function f2(s?: string) { } +function f3(...s: string[]) { } +function f4(s: string, s2?: string) { } +function f5(s?: string, n?: number) { } +function f6(s?: string, ...n: number[]) { } +function f7(s: string, ...sRest: string[]) { } + +var fUnion: typeof f1 | typeof f2 | typeof f3 | typeof f4 | typeof f5 | typeof f6 | typeof f7; + +fUnion(""); // All constituents can be called by passing a single string. diff --git a/tests/cases/fourslash/completionEntryForUnionProperty2.ts b/tests/cases/fourslash/completionEntryForUnionProperty2.ts index 0b2d50fc13006..aa5bc40b5e354 100644 --- a/tests/cases/fourslash/completionEntryForUnionProperty2.ts +++ b/tests/cases/fourslash/completionEntryForUnionProperty2.ts @@ -15,6 +15,6 @@ ////x.commonProperty./**/ goTo.marker(); -verify.memberListContains("toString", "(property) toString: ((radix?: number) => string) | (() => string)"); +verify.memberListContains("toString", "(method) toString(): string"); verify.memberListContains("valueOf", "(method) valueOf(): number | string"); verify.memberListCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/completionInJsDoc.ts b/tests/cases/fourslash/completionInJsDoc.ts new file mode 100644 index 0000000000000..5424c8e79faa5 --- /dev/null +++ b/tests/cases/fourslash/completionInJsDoc.ts @@ -0,0 +1,62 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: Foo.js +/////** @/*1*/ */ +////var v1; +//// +/////** @p/*2*/ */ +////var v2; +//// +/////** @param /*3*/ */ +////var v3; +//// +/////** @param { n/*4*/ } bar */ +////var v4; +//// +/////** @type { n/*5*/ } */ +////var v5; +//// +////// @/*6*/ +////var v6; +//// +////// @pa/*7*/ +////var v7; +//// +/////** @param { n/*8*/ } */ +////var v8; +//// +/////** @return { n/*9*/ } */ +////var v9; + +goTo.marker('1'); +verify.completionListContains("constructor"); +verify.completionListContains("param"); +verify.completionListContains("type"); + +goTo.marker('2'); +verify.completionListContains("constructor"); +verify.completionListContains("param"); +verify.completionListContains("type"); + +goTo.marker('3'); +verify.completionListIsEmpty(); + +goTo.marker('4'); +verify.completionListContains('number'); + +goTo.marker('5'); +verify.completionListContains('number'); + +goTo.marker('6'); +verify.completionListIsEmpty(); + +goTo.marker('7'); +verify.completionListIsEmpty(); + +goTo.marker('8'); +verify.completionListContains('number'); + +goTo.marker('9'); +verify.completionListContains('number'); + diff --git a/tests/cases/fourslash/completionInsideFunctionContainsArguments.ts b/tests/cases/fourslash/completionInsideFunctionContainsArguments.ts new file mode 100644 index 0000000000000..903253b1a095a --- /dev/null +++ b/tests/cases/fourslash/completionInsideFunctionContainsArguments.ts @@ -0,0 +1,22 @@ +/// + +////function testArguments() {/*1*/} +/////*2*/ +////function testNestedArguments() { +//// function nestedfunction(){/*3*/} +////} +////function f() { +//// let g = () => /*4*/ +////} +////let g = () => /*5*/ + +goTo.marker('1'); +verify.completionListContains("arguments"); +goTo.marker('2'); +verify.not.completionListContains("arguments"); +goTo.marker('3'); +verify.completionListContains("arguments"); +goTo.marker('4'); +verify.completionListContains("arguments"); +goTo.marker('5'); +verify.not.completionListContains("arguments"); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingJsxElements.ts b/tests/cases/fourslash/formattingJsxElements.ts new file mode 100644 index 0000000000000..d0c77804ed5fa --- /dev/null +++ b/tests/cases/fourslash/formattingJsxElements.ts @@ -0,0 +1,19 @@ +/// + +//@Filename: file.tsx +////function () { +//// return ( +////
+////Hello, World!/*autoformat*/ +/////*indent*/ +////
+//// ) +////} +//// + + +format.document(); +goTo.marker("autoformat"); +verify.currentLineContentIs(' Hello, World!'); +goTo.marker("indent"); +verify.indentationIs(12); \ No newline at end of file diff --git a/tests/cases/fourslash/formattingOptionsChange.ts b/tests/cases/fourslash/formattingOptionsChange.ts index d84e876f06b19..cdd8f61a21518 100644 --- a/tests/cases/fourslash/formattingOptionsChange.ts +++ b/tests/cases/fourslash/formattingOptionsChange.ts @@ -6,6 +6,7 @@ /////*InsertSpaceAfterKeywordsInControlFlowStatements*/if (true) { } /////*InsertSpaceAfterFunctionKeywordForAnonymousFunctions*/(function () { }) /////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis*/(1 ) +/////*InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets*/[1 ]; [ ]; []; [,] /////*PlaceOpenBraceOnNewLineForFunctions*/class foo { ////} /////*PlaceOpenBraceOnNewLineForControlBlocks*/if (true) { @@ -17,6 +18,7 @@ runTest("InsertSpaceBeforeAndAfterBinaryOperators", "1 + 2 - 3", "1+2-3"); runTest("InsertSpaceAfterKeywordsInControlFlowStatements", "if (true) { }", "if(true) { }"); runTest("InsertSpaceAfterFunctionKeywordForAnonymousFunctions", "(function () { })", "(function() { })"); runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis", " ( 1 )", " (1)"); +runTest("InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets", "[ 1 ];[];[];[ , ]", "[1];[];[];[, ]"); runTest("PlaceOpenBraceOnNewLineForFunctions", "class foo", "class foo {"); runTest("PlaceOpenBraceOnNewLineForControlBlocks", "if ( true )", "if ( true ) {"); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 8ce5869a0042f..42cfc1248b0c4 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -90,6 +90,7 @@ module FourSlashInterface { InsertSpaceAfterKeywordsInControlFlowStatements: boolean; InsertSpaceAfterFunctionKeywordForAnonymousFunctions: boolean; InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; + InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; [s: string]: boolean | number| string; diff --git a/tests/cases/fourslash/genericsFormatting.ts b/tests/cases/fourslash/genericsFormatting.ts index b8ef27fa8f2c7..f5e44522a8ec9 100644 --- a/tests/cases/fourslash/genericsFormatting.ts +++ b/tests/cases/fourslash/genericsFormatting.ts @@ -14,6 +14,13 @@ //// ////foo()(); ////(a + b)(); +//// +////function bar() { +/////*inClassExpression*/ return class < T2 > { +//// } +////} +/////*expressionWithTypeArguments*/class A < T > extends bar < T >( ) < T > { +////} format.document(); @@ -33,4 +40,10 @@ goTo.marker("inNewSignature"); verify.currentLineContentIs(" new (a: T);"); goTo.marker("inOptionalMethodSignature"); -verify.currentLineContentIs(" op?(a: T, b: M);"); \ No newline at end of file +verify.currentLineContentIs(" op?(a: T, b: M);"); + +goTo.marker("inClassExpression"); +verify.currentLineContentIs(" return class {"); + +goTo.marker("expressionWithTypeArguments"); +verify.currentLineContentIs("class A extends bar() {"); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputOutFile.ts b/tests/cases/fourslash/getEmitOutputOutFile.ts new file mode 100644 index 0000000000000..4a9439737eae2 --- /dev/null +++ b/tests/cases/fourslash/getEmitOutputOutFile.ts @@ -0,0 +1,22 @@ +/// + +// @BaselineFile: getEmitOutputOutFile.baseline +// @declaration: true +// @outFile: outFile.js + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// var x: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +//// var x1: string = "hello world"; +//// class Foo{ +//// x : string; +//// y : number; +//// } + +verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputTsxFile_Preserve.ts b/tests/cases/fourslash/getEmitOutputTsxFile_Preserve.ts new file mode 100644 index 0000000000000..19eda2ad11172 --- /dev/null +++ b/tests/cases/fourslash/getEmitOutputTsxFile_Preserve.ts @@ -0,0 +1,22 @@ +/// + +// @BaselineFile: getEmitOutputTsxFile_Preserve.baseline +// @declaration: true +// @sourceMap: true +// @jsx: preserve + +// @Filename: inputFile1.ts +// @emitThisFile: true +////// regular ts file +//// var t: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.tsx +// @emitThisFile: true +//// var y = "my div"; +//// var x =
+ +verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getEmitOutputTsxFile_React.ts b/tests/cases/fourslash/getEmitOutputTsxFile_React.ts new file mode 100644 index 0000000000000..ccfa3bcc0c2b5 --- /dev/null +++ b/tests/cases/fourslash/getEmitOutputTsxFile_React.ts @@ -0,0 +1,22 @@ +/// + +// @BaselineFile: getEmitOutputTsxFile_React.baseline +// @declaration: true +// @sourceMap: true +// @jsx: react + +// @Filename: inputFile1.ts +// @emitThisFile: true +////// regular ts file +//// var t: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.tsx +// @emitThisFile: true +//// var y = "my div"; +//// var x =
+ +verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo2.ts b/tests/cases/fourslash/getJavaScriptQuickInfo2.ts index 1da049ed5c897..ce347a62b2727 100644 --- a/tests/cases/fourslash/getJavaScriptQuickInfo2.ts +++ b/tests/cases/fourslash/getJavaScriptQuickInfo2.ts @@ -5,6 +5,5 @@ /////** @param {number} [a] */ ////function /**/f(a) { } -debugger; goTo.marker(); verify.quickInfoIs('function f(a?: number): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo3.ts b/tests/cases/fourslash/getJavaScriptQuickInfo3.ts index 213b3b4ab5e2f..2e094bd21f6f2 100644 --- a/tests/cases/fourslash/getJavaScriptQuickInfo3.ts +++ b/tests/cases/fourslash/getJavaScriptQuickInfo3.ts @@ -5,6 +5,5 @@ /////** @param {number[]} [a] */ ////function /**/f(a) { } -debugger; goTo.marker(); verify.quickInfoIs('function f(a?: number[]): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo4.ts b/tests/cases/fourslash/getJavaScriptQuickInfo4.ts index c2a1095d23573..34ee10d97b747 100644 --- a/tests/cases/fourslash/getJavaScriptQuickInfo4.ts +++ b/tests/cases/fourslash/getJavaScriptQuickInfo4.ts @@ -5,6 +5,5 @@ /////** @param {[number,string]} [a] */ ////function /**/f(a) { } -debugger; goTo.marker(); verify.quickInfoIs('function f(a?: [number, string]): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo5.ts b/tests/cases/fourslash/getJavaScriptQuickInfo5.ts index 12dd37834bc64..004af0811b7ac 100644 --- a/tests/cases/fourslash/getJavaScriptQuickInfo5.ts +++ b/tests/cases/fourslash/getJavaScriptQuickInfo5.ts @@ -5,6 +5,5 @@ /////** @param {{b:number}} [a] */ ////function /**/f(a) { } -debugger; goTo.marker(); verify.quickInfoIs('function f(a?: {\n b: number;\n}): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo6.ts b/tests/cases/fourslash/getJavaScriptQuickInfo6.ts index 2d23752fa636c..3aebd19deda12 100644 --- a/tests/cases/fourslash/getJavaScriptQuickInfo6.ts +++ b/tests/cases/fourslash/getJavaScriptQuickInfo6.ts @@ -5,6 +5,5 @@ /////** @type {function(this:number)} */ ////function f() { /**/this } -debugger; goTo.marker(); verify.quickInfoIs('number'); \ No newline at end of file diff --git a/tests/cases/fourslash/getJavaScriptQuickInfo7.ts b/tests/cases/fourslash/getJavaScriptQuickInfo7.ts index d8ecb1ec138d9..282f5aeabfd3d 100644 --- a/tests/cases/fourslash/getJavaScriptQuickInfo7.ts +++ b/tests/cases/fourslash/getJavaScriptQuickInfo7.ts @@ -6,6 +6,5 @@ //// /** @type {f} */ //// var v/**/ -debugger; goTo.marker(); verify.quickInfoIs('var v: (a: any, b: any) => void'); \ No newline at end of file diff --git a/tests/cases/fourslash/getQuickInfo5.ts b/tests/cases/fourslash/getQuickInfo5.ts index 509e9fd139561..844447dbf1803 100644 --- a/tests/cases/fourslash/getQuickInfo5.ts +++ b/tests/cases/fourslash/getQuickInfo5.ts @@ -2,6 +2,5 @@ ////function /**/f(a: {b: number}) { } -debugger; goTo.marker(); verify.quickInfoIs('function f(a: {\n b: number;\n}): void'); \ No newline at end of file diff --git a/tests/cases/fourslash/javaScriptModules1.ts b/tests/cases/fourslash/javaScriptModules1.ts new file mode 100644 index 0000000000000..c34e54151c36a --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules1.ts @@ -0,0 +1,21 @@ +/// + +// We can resolve modules declared in .d.ts files +// using the dependency array in 'define' + +// @allowNonTsExtensions: true +// @Filename: node.d.ts +//// declare module "fs" { +//// export function readFile(path: string): string; +//// export function writeFile(path: string, content: string): number; +//// } + +// @Filename: Foo.js +//// define('myMod', ['fs'], function(ff) { +//// let y = ff/**/; +//// }); + +goTo.marker(); +edit.insert('.'); +verify.completionListContains("readFile", /*displayText:*/ undefined, /*documentation*/ undefined, "function"); + diff --git a/tests/cases/fourslash/javaScriptModules10.ts b/tests/cases/fourslash/javaScriptModules10.ts new file mode 100644 index 0000000000000..7c21bce97d9d5 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules10.ts @@ -0,0 +1,18 @@ +/// + +// Metadata coming after '!' in a module name is ignored + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('myMod', ['module'], function(m) { +//// m.exports = { hello: 'world', size: 42 }; +//// }); +//// define('consumer', ['myMod!watwat'], function(mm) { +//// let x = mm; +//// mm/**/; +//// }); + +goTo.marker(); +edit.insert('.'); +verify.completionListContains("hello", undefined, undefined, 'property'); +verify.completionListContains("size", undefined, undefined, 'property'); diff --git a/tests/cases/fourslash/javaScriptModules11.ts b/tests/cases/fourslash/javaScriptModules11.ts new file mode 100644 index 0000000000000..27e39d42f65cf --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules11.ts @@ -0,0 +1,17 @@ +/// + +// If the last argument to 'define' isn't a function expression, we should +// use the type of that expression as the shape of the module + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('myMod', { hello: 'world', size: 42 }); +//// define('consumer', ['myMod'], function(mm) { +//// let x = mm; +//// mm/**/; +//// }); + +goTo.marker(); +edit.insert('.'); +verify.completionListContains("hello", undefined, undefined, 'property'); +verify.completionListContains("size", undefined, undefined, 'property'); diff --git a/tests/cases/fourslash/javaScriptModules12.ts b/tests/cases/fourslash/javaScriptModules12.ts new file mode 100644 index 0000000000000..0c52fa359bdaa --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules12.ts @@ -0,0 +1,20 @@ +/// + +// If the last argument to 'define' isn't a function expression +// but is a function type, use its return type + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// function myFunc() { +//// return { hello: 'world', size: 42 }; +//// } +//// define('myMod', myFunc); +//// define('consumer', ['myMod'], function(mm) { +//// let x = mm; +//// mm/**/; +//// }); + +goTo.marker(); +edit.insert('.'); +verify.completionListContains("hello", undefined, undefined, 'property'); +verify.completionListContains("size", undefined, undefined, 'property'); diff --git a/tests/cases/fourslash/javaScriptModules13.ts b/tests/cases/fourslash/javaScriptModules13.ts new file mode 100644 index 0000000000000..7131c92e9e080 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules13.ts @@ -0,0 +1,19 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: myJavascript.js +//// define('myMod', function() { +//// let x = { n: 3, s: 'foo', b: true }; +//// return x; +//// }); +//// +//// require(['myMod'], function(mm) { +//// mm/**/ +//// }); + +goTo.marker(); +edit.insert('.'); +verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); + diff --git a/tests/cases/fourslash/javaScriptModules14.ts b/tests/cases/fourslash/javaScriptModules14.ts new file mode 100644 index 0000000000000..53e2aaf985c27 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules14.ts @@ -0,0 +1,18 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: myJavascript.js +//// define('myMod', function() { +//// let x = { n: 3, s: 'foo', b: true }; +//// return /*2*/x; +//// }); +//// +//// define('m2', ['myMod'], function(/*3*/mm) { +//// mm/*1*/ +//// }); + +goTo.marker('1'); +edit.insert('.'); +verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); diff --git a/tests/cases/fourslash/javaScriptModules15.ts b/tests/cases/fourslash/javaScriptModules15.ts new file mode 100644 index 0000000000000..72ed63220284f --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules15.ts @@ -0,0 +1,22 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// define(function() { +//// let x = { n: 3, s: 'foo', b: true }; +//// return x; +//// }); +//// + +// @Filename: consumer.js +//// var x = require('./myMod'); +//// x/**/; + +goTo.file('consumer.js'); +goTo.marker(); +edit.insert('.'); +verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +edit.insert('n.'); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/javaScriptModules16.ts b/tests/cases/fourslash/javaScriptModules16.ts new file mode 100644 index 0000000000000..0105d3740abb6 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules16.ts @@ -0,0 +1,20 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// exports.n = 3; +//// exports.s = 'foo'; +//// exports.b = true; + +// @Filename: consumer.js +//// var x = require('myMod'); +//// x/**/; + +goTo.file('consumer.js'); +goTo.marker(); +edit.insert('.'); +verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +edit.insert('n.'); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/javaScriptModules17.ts b/tests/cases/fourslash/javaScriptModules17.ts new file mode 100644 index 0000000000000..ed046b2235d41 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules17.ts @@ -0,0 +1,18 @@ +/// + +// @allowNonTsExtensions: true +// @Filename: myMod.js +//// module.exports = { n: 3, s: 'foo', b: true }; + +// @Filename: consumer.js +//// var x = require('myMod'); +//// x/**/; + +goTo.file('consumer.js'); +goTo.marker(); +edit.insert('.'); +verify.completionListContains("n", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("s", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +verify.completionListContains("b", /*displayText:*/ undefined, /*documentation*/ undefined, "property"); +edit.insert('n.'); +verify.completionListContains("toFixed", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/javaScriptModules2.ts b/tests/cases/fourslash/javaScriptModules2.ts new file mode 100644 index 0000000000000..399397dc09662 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules2.ts @@ -0,0 +1,19 @@ +/// + +// If the first argument to 'define' is a string, we register +// a module under that string. + +// @allowNonTsExtensions: true + +// @Filename: Foo.js +//// define('myMod', function() { +//// return {x: 'hello'}; +//// }); +//// define('qq', ['myMod'], function(mm) { +//// var yy = mm.x; +//// yy/**/; +//// } + +goTo.marker(); +edit.insert('.'); +verify.completionListContains("charCodeAt", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/javaScriptModules3.ts b/tests/cases/fourslash/javaScriptModules3.ts new file mode 100644 index 0000000000000..61d6daf657f3a --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules3.ts @@ -0,0 +1,24 @@ +/// + +// If the first argument to 'define' is a string, we register +// a module under that string (not this test). Otherwise (this test), +// we register it using the filename + +// @allowNonTsExtensions: true +// @module: amd + +// @Filename: foo.js +//// define(function(ff) { +//// return {x: 'hello'}; +//// }); + +// @Filename: bar.js +//// define(['./foo'], function(ff) { +//// let y = ff.x; +//// y/**/; +//// }); + +goTo.file('bar.js'); +goTo.marker(); +edit.insert('.'); +verify.completionListContains("charCodeAt", /*displayText:*/ undefined, /*documentation*/ undefined, "method"); diff --git a/tests/cases/fourslash/javaScriptModules4.ts b/tests/cases/fourslash/javaScriptModules4.ts new file mode 100644 index 0000000000000..c3e1339f57178 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules4.ts @@ -0,0 +1,24 @@ +/// + +// When a module name is 'require', it acts as a function that +// can produce a module as if it were imported + +// @allowNonTsExtensions: true +// @Filename: node.d.ts +//// declare module "fs" { +//// export function readFile(path: string): string; +//// export function writeFile(path: string, content: string): number; +//// } + +// @Filename: Foo.js +//// define('myMod', ['require'], function(r) { +//// let req = /*r*/r; +//// let ff = r('fs'); +//// let y = ff/*ff*/; +//// } + +goTo.marker('r'); + +goTo.marker('ff'); +edit.insert('.'); +verify.completionListContains("readFile", /*displayText:*/ undefined, /*documentation*/ undefined, "function"); diff --git a/tests/cases/fourslash/javaScriptModules5.ts b/tests/cases/fourslash/javaScriptModules5.ts new file mode 100644 index 0000000000000..661b2cbd9b452 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules5.ts @@ -0,0 +1,26 @@ +/// + +// The type of a module is its assignment to 'module.exports' if there +// were no 'return' statements in its body + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('myMod', ['module'], function(m) { +//// m.exports = { hello: 'world', size: 42 }; +//// }); +//// define('consumer', ['myMod'], function(mm) { +//// let x = mm; +//// mm/*1*/; +//// let y = mm.hello; +//// y/*2*/; +//// }); + +goTo.marker('1'); +edit.insert('.'); +verify.completionListContains("hello", undefined, undefined, 'property'); +verify.completionListContains("size", undefined, undefined, 'property'); +edit.backspace(); + +goTo.marker('2'); +edit.insert('.'); +verify.completionListContains("charCodeAt", undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules6.ts b/tests/cases/fourslash/javaScriptModules6.ts new file mode 100644 index 0000000000000..6547bba5d09e4 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules6.ts @@ -0,0 +1,27 @@ +/// + +// The type of a module is its collected property assignments +// to 'exports' + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('myMod', ['exports'], function(e) { +//// e.hello = 'world'; +//// e.size = 42; +//// }); +//// define('consumer', ['myMod'], function(mm) { +//// let x = mm; +//// mm/*1*/; +//// let y = mm.hello; +//// y/*2*/; +//// }); + +goTo.marker('1'); +edit.insert('.'); +verify.completionListContains("hello", undefined, undefined, 'property'); +verify.completionListContains("size", undefined, undefined, 'property'); +edit.backspace(); + +goTo.marker('2'); +edit.insert('.'); +verify.completionListContains("charCodeAt", undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules7.ts b/tests/cases/fourslash/javaScriptModules7.ts new file mode 100644 index 0000000000000..c028a6d8373fe --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules7.ts @@ -0,0 +1,30 @@ +/// + +// You can use the CommonJS wrapper by not specifying a dependency array +// and naming your function arguments require, [exports [, module]]. Assignments +// to exports.propName or module.exports.propName add properties. + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('myMod', function(require, exports, module) { +//// exports.hello = 'world'; +//// exports.size = 42; +//// module.exports.other = []; +//// }); +//// define('consumer', ['myMod'], function(mm) { +//// let x = mm; +//// mm/*1*/; +//// let y = mm.hello; +//// y/*2*/; +//// }); + +goTo.marker('1'); +edit.insert('.'); +verify.completionListContains("hello", undefined, undefined, 'property'); +verify.completionListContains("size", undefined, undefined, 'property'); +verify.completionListContains("other", undefined, undefined, 'property'); +edit.backspace(); + +goTo.marker('2'); +edit.insert('.'); +verify.completionListContains("charCodeAt", undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules8.ts b/tests/cases/fourslash/javaScriptModules8.ts new file mode 100644 index 0000000000000..3e8b34ab8afdc --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules8.ts @@ -0,0 +1,29 @@ +/// + +// You can use the CommonJS wrapper by not specifying a dependency array +// and naming your function arguments require, [exports [, module]]. A +// module definition can be provided by putting an object into +// module.exports + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('myMod', function(require, exports, module) { +//// module.exports = {hello: 'world', size: 42, other: []}; +//// }); +//// define('consumer', ['myMod'], function(mm) { +//// let x = mm; +//// mm/*1*/; +//// let y = mm.hello; +//// y/*2*/; +//// }); + +goTo.marker('1'); +edit.insert('.'); +verify.completionListContains("hello", undefined, undefined, 'property'); +verify.completionListContains("size", undefined, undefined, 'property'); +verify.completionListContains("other", undefined, undefined, 'property'); +edit.backspace(); + +goTo.marker('2'); +edit.insert('.'); +verify.completionListContains("charCodeAt", undefined, undefined, 'method'); diff --git a/tests/cases/fourslash/javaScriptModules9.ts b/tests/cases/fourslash/javaScriptModules9.ts new file mode 100644 index 0000000000000..9db6107fa0cc4 --- /dev/null +++ b/tests/cases/fourslash/javaScriptModules9.ts @@ -0,0 +1,50 @@ +/// + +// You can import multiple modules using the dependency array syntax, +// including when those modules mix and match things. + +// This works even if you name your arguments 'reserved' names + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('mod1', function() { +//// return { x: 10, y: 10 }; +//// }); +//// define('mod2', ['mod1', 'module'], function(m1, mod) { +//// mod.exports = { z: m1.x + m1.y } +//// }); +//// define('mod3', ['exports'], function(ex) { +//// ex.foo = 'bar'; +//// }); +//// define(['mod1', 'mod2', 'mod3'], function (m1, m2, m3) { +//// m1/*a1*/; +//// m2/*a2*/; +//// m3/*a3*/; +//// }); +//// define(['mod1', 'mod2', 'mod3'], function (require, exports, module) { +//// require/*b1*/; +//// exports/*b2*/; +//// module/*b3*/; +//// }); + +for(var pfx of ['a', 'b']) { + goTo.marker(pfx + '1'); + edit.insert('.'); + verify.completionListContains("x", undefined, undefined, 'property'); + verify.completionListContains("y", undefined, undefined, 'property'); + edit.backspace(); + + goTo.marker(pfx + '2'); + edit.insert('.'); + verify.completionListContains("z", undefined, undefined, 'property'); + edit.insert('z.'); + verify.completionListContains("toFixed", undefined, undefined, 'method'); + edit.backspace(3); + + goTo.marker(pfx + '3'); + edit.insert('.'); + verify.completionListContains("foo", undefined, undefined, 'property'); + edit.insert('foo.'); + verify.completionListContains("charCodeAt", undefined, undefined, 'method'); +} + diff --git a/tests/cases/fourslash/javaScriptModulesError1.ts b/tests/cases/fourslash/javaScriptModulesError1.ts new file mode 100644 index 0000000000000..f13b25a182efb --- /dev/null +++ b/tests/cases/fourslash/javaScriptModulesError1.ts @@ -0,0 +1,12 @@ +/// + +// Error: Having more function parameters than entries in the dependency array + +// @allowNonTsExtensions: true +// @Filename: Foo.js +//// define('mod1', ['a'], /**/function(a, b) { +//// +//// }); + +// TODO: what should happen? +goTo.marker(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getBraceMatchingAtPosition.ts b/tests/cases/fourslash/shims-pp/getBraceMatchingAtPosition.ts new file mode 100644 index 0000000000000..fc8a71197db11 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getBraceMatchingAtPosition.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/shims-pp/getBreakpointStatementAtPosition.ts b/tests/cases/fourslash/shims-pp/getBreakpointStatementAtPosition.ts new file mode 100644 index 0000000000000..9e1d075a17ff5 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getBreakpointStatementAtPosition.ts @@ -0,0 +1,17 @@ +/// + +// @BaselineFile: getBreakpointStatementAtPosition.baseline +// @Filename: getBreakpointStatementAtPosition.ts +////while (true) { +//// break; +////} +////y: while (true) { +//// break y; +////} +////while (true) { +//// continue; +////} +////z: while (true) { +//// continue z; +////} +verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts b/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts new file mode 100644 index 0000000000000..714d3390e760b --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts @@ -0,0 +1,20 @@ +/// + +////function foo(strOrNum: string | number) { +//// /*1*/ +//// if (typeof strOrNum === "number") { +//// /*2*/ +//// } +//// else { +//// /*3*/ +//// } +////} + +goTo.marker('1'); +verify.completionListContains("strOrNum", "(parameter) strOrNum: string | number"); + +goTo.marker('2'); +verify.completionListContains("strOrNum", "(parameter) strOrNum: number"); + +goTo.marker('3'); +verify.completionListContains("strOrNum", "(parameter) strOrNum: string"); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getDefinitionAtPosition.ts b/tests/cases/fourslash/shims-pp/getDefinitionAtPosition.ts new file mode 100644 index 0000000000000..3aa31d1556c56 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getDefinitionAtPosition.ts @@ -0,0 +1,29 @@ +/// + +// @Filename: goToDefinitionDifferentFile_Definition.ts +////var /*remoteVariableDefinition*/remoteVariable; +/////*remoteFunctionDefinition*/function remoteFunction() { } +/////*remoteClassDefinition*/class remoteClass { } +/////*remoteInterfaceDefinition*/interface remoteInterface{ } +/////*remoteModuleDefinition*/module remoteModule{ export var foo = 1;} + +// @Filename: goToDefinitionDifferentFile_Consumption.ts +/////*remoteVariableReference*/remoteVariable = 1; +/////*remoteFunctionReference*/remoteFunction(); +////var foo = new /*remoteClassReference*/remoteClass(); +////class fooCls implements /*remoteInterfaceReference*/remoteInterface { } +////var fooVar = /*remoteModuleReference*/remoteModule.foo; + +var markerList = [ + "remoteVariable", + "remoteFunction", + "remoteClass", + "remoteInterface", + "remoteModule", +]; + +markerList.forEach((marker) => { + goTo.marker(marker + 'Reference'); + goTo.definition(); + verify.caretAtMarker(marker + 'Definition'); +}); diff --git a/tests/cases/fourslash/shims-pp/getEmitOutput.ts b/tests/cases/fourslash/shims-pp/getEmitOutput.ts new file mode 100644 index 0000000000000..45679066278c0 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getEmitOutput.ts @@ -0,0 +1,22 @@ +/// + +// @BaselineFile: getEmitOutput-pp.baseline +// @declaration: true + +// @Filename: inputFile1.ts +// @emitThisFile: true +//// var x: number = 5; +//// class Bar { +//// x : string; +//// y : number +//// } + +// @Filename: inputFile2.ts +// @emitThisFile: true +//// var x1: string = "hello world"; +//// class Foo{ +//// x : string; +//// y : number; +//// } + +verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getIndentationAtPosition.ts b/tests/cases/fourslash/shims-pp/getIndentationAtPosition.ts new file mode 100644 index 0000000000000..ba2936bd70223 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getIndentationAtPosition.ts @@ -0,0 +1,21 @@ +/// + +////class Bar { +//// {| "indentation": 4|} +//// private foo: string = ""; +//// {| "indentation": 4|} +//// private f() { +//// var a: any[] = [[1, 2], [3, 4], 5]; +//// {| "indentation": 8|} +//// return ((1 + 1)); +//// } +//// {| "indentation": 4|} +//// private f2() { +//// if (true) { } { }; +//// } +////} +////{| "indentation": 0|} + +test.markers().forEach((marker) => { + verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); +}); diff --git a/tests/cases/fourslash/shims-pp/getNavigateToItems.ts b/tests/cases/fourslash/shims-pp/getNavigateToItems.ts new file mode 100644 index 0000000000000..5481f4295cb3b --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getNavigateToItems.ts @@ -0,0 +1,27 @@ +/// + +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point { +//// // Instance member +//// {| "itemName": "origin", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private origin = 0.0; +//// +//// {| "itemName": "distFromZero", "kind": "property", "parentName": "Point", "matchKind": "exact"|}private distFromZero = 0.0; +//// +//// // Getter +//// {| "itemName": "distance", "kind": "getter", "parentName": "Point", "matchKind": "exact" |}get distance(): number { return 0; } +//// } +////} +//// +////// Local variables +////{| "itemName": "point", "kind": "var", "parentName": "", "matchKind": "exact"|}var point = new Shapes.Point(); + +//// Testing for exact matching of navigationItems + +test.markers().forEach((marker) => { + if (marker.data) { + verify.navigationItemsListContains(marker.data.itemName, marker.data.kind, marker.data.itemName, marker.data.matchKind, marker.fileName, marker.data.parentName); + } +}); diff --git a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts new file mode 100644 index 0000000000000..6c0738747f37c --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts @@ -0,0 +1,13 @@ +/// + +//// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains( + marker.data.itemName, + marker.data.kind, + marker.fileName, + marker.data.parentName, + marker.data.isAdditionalRange, + marker.position); +}); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getOccurrencesAtPosition.ts b/tests/cases/fourslash/shims-pp/getOccurrencesAtPosition.ts new file mode 100644 index 0000000000000..0654cc3962c20 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getOccurrencesAtPosition.ts @@ -0,0 +1,18 @@ +/// + +/////*0*/ +////interface A { +//// foo: string; +////} +////function foo(x: A) { +//// x.f/*1*/oo +////} + +goTo.marker("1"); +verify.occurrencesAtPositionCount(2); + +goTo.marker("0"); +edit.insert("\r\n"); + +goTo.marker("1"); +verify.occurrencesAtPositionCount(2); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getOutliningSpans.ts b/tests/cases/fourslash/shims-pp/getOutliningSpans.ts new file mode 100644 index 0000000000000..93665889eb429 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getOutliningSpans.ts @@ -0,0 +1,113 @@ +/// + +////// interface +////interface IFoo[| { +//// getDist(): number; +////}|] +//// +////// class members +////class Foo[| { +//// constructor()[| { +//// }|] +//// +//// public foo(): number[| { +//// return 0; +//// }|] +//// +//// public get X()[| { +//// return 1; +//// }|] +//// +//// public set X(v: number)[| { +//// }|] +//// +//// public member = function f()[| { +//// +//// }|] +////}|] +////switch(1)[| { +//// case 1: break; +////}|] +//// +////var array =[| [ +//// 1, +//// 2 +////]|] +//// +////// modules +////module m1[| { +//// module m2[| { }|] +//// module m3[| { +//// function foo()[| { +//// +//// }|] +//// +//// interface IFoo2[| { +//// +//// }|] +//// +//// class foo2 implements IFoo2[| { +//// +//// }|] +//// }|] +////}|] +//// +////// function declaration +////function foo(): number[| { +//// return 0; +////}|] +//// +////// function expressions +////(function f()[| { +//// +////}|]) +//// +////// trivia handeling +////class ClassFooWithTrivia[| /* some comments */ +//// /* more trivia */ { +//// +//// +//// /*some trailing trivia */ +////}|] /* even more */ +//// +////// object literals +////var x =[|{ +//// a:1, +//// b:2, +//// get foo()[| { +//// return 1; +//// }|] +////}|] +//////outline with deep nesting +////module m1[|{ +//// module m2[| { +//// module m3[| { +//// module m4[| { +//// module m5[| { +//// module m6[| { +//// module m7[| { +//// module m8[| { +//// module m9[| { +//// module m10[| { +//// module m11 { +//// module m12 { +//// export interface IFoo { +//// } +//// } +//// } +//// }|] +//// }|] +//// }|] +//// }|] +//// }|] +//// }|] +//// }|] +//// }|] +//// }|] +////}|] +//// +//////outline after a deeply nested node +////class AfterNestedNodes[| { +////}|] + +verify.outliningSpansInCurrentFile(test.ranges()); diff --git a/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts b/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts new file mode 100644 index 0000000000000..aa0ff4c066935 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts @@ -0,0 +1,30 @@ +/// + +// @Filename: refFile1.ts +//// class D { } + +// @Filename: refFile2.ts +//// export class E {} + +// @Filename: main.ts +// @ResolveReference: true +//// /// +//// /*1*/////*2*/ +//// /*3*/////*4*/ +//// import ref2 = require("refFile2"); +//// import noExistref2 = require(/*5*/"NotExistRefFile2"/*6*/); +//// import invalidRef1 /*7*/require/*8*/("refFile2"); +//// import invalidRef2 = /*9*/requi/*10*/(/*10A*/"refFile2"); +//// var obj: /*11*/C/*12*/; +//// var obj1: D; +//// var obj2: ref2.E; + +goTo.file("main.ts"); +verify.numberOfErrorsInCurrentFile(7); +verify.errorExistsBetweenMarkers("1", "2"); +verify.errorExistsBetweenMarkers("3", "4"); +verify.errorExistsBetweenMarkers("5", "6"); +verify.errorExistsBetweenMarkers("7", "8"); +verify.errorExistsBetweenMarkers("9", "10"); +verify.errorExistsBetweenMarkers("10", "10A"); +verify.errorExistsBetweenMarkers("11", "12"); diff --git a/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts b/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts new file mode 100644 index 0000000000000..ef201f6709670 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts @@ -0,0 +1,16 @@ +/// + +////class SS{} +//// +////var x/*1*/1 = new SS(); +////var x/*2*/2 = new SS(); +////var x/*3*/3 = new SS; + +goTo.marker('1'); +verify.quickInfoIs('var x1: SS'); + +goTo.marker('2'); +verify.quickInfoIs('var x2: SS<{}>'); + +goTo.marker('3'); +verify.quickInfoIs('var x3: SS<{}>'); diff --git a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts new file mode 100644 index 0000000000000..34144b748991d --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts @@ -0,0 +1,29 @@ +/// + +//@Filename: findAllRefsOnDefinition-import.ts +////export class Test{ +//// +//// constructor(){ +//// +//// } +//// +//// public /*1*/start(){ +//// return this; +//// } +//// +//// public stop(){ +//// return this; +//// } +////} + +//@Filename: findAllRefsOnDefinition.ts +////import Second = require("findAllRefsOnDefinition-import"); +//// +////var second = new Second.Test() +////second.start(); +////second.stop(); + +goTo.file("findAllRefsOnDefinition-import.ts"); +goTo.marker("1"); + +verify.referencesCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getRenameInfo.ts b/tests/cases/fourslash/shims-pp/getRenameInfo.ts new file mode 100644 index 0000000000000..b7a1f5d61ae95 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getRenameInfo.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:*/ false, /*findInComments:*/ false); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getSemanticClassifications.ts b/tests/cases/fourslash/shims-pp/getSemanticClassifications.ts new file mode 100644 index 0000000000000..4eb7f2a32edab --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getSemanticClassifications.ts @@ -0,0 +1,15 @@ +/// + +//// module /*0*/M { +//// export interface /*1*/I { +//// } +//// } +//// interface /*2*/X extends /*3*/M./*4*/I { } + +var c = classification; +verify.semanticClassificationsAre( + c.moduleName("M", test.marker("0").position), + c.interfaceName("I", test.marker("1").position), + c.interfaceName("X", test.marker("2").position), + c.moduleName("M", test.marker("3").position), + c.interfaceName("I", test.marker("4").position)); diff --git a/tests/cases/fourslash/shims-pp/getSemanticDiagnostics.ts b/tests/cases/fourslash/shims-pp/getSemanticDiagnostics.ts new file mode 100644 index 0000000000000..804abbde33bb7 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getSemanticDiagnostics.ts @@ -0,0 +1,11 @@ +/// + +// @module: CommonJS +// @declaration: true +//// interface privateInterface {} +//// export class Bar implements /*1*/privateInterface/*2*/{ } + +verify.errorExistsBetweenMarkers("1", "2"); +verify.numberOfErrorsInCurrentFile(1); + + diff --git a/tests/cases/fourslash/shims-pp/getSignatureHelpItems.ts b/tests/cases/fourslash/shims-pp/getSignatureHelpItems.ts new file mode 100644 index 0000000000000..846c2d5244a1d --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getSignatureHelpItems.ts @@ -0,0 +1,13 @@ +/// + +// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file0.ts +////declare function fn(x: string, y: number); + +// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file1.ts +////declare function fn(x: string); + +// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file2.ts +////fn(/*1*/ + +goTo.marker('1'); +verify.signatureHelpCountIs(2); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getSyntacticClassifications.ts b/tests/cases/fourslash/shims-pp/getSyntacticClassifications.ts new file mode 100644 index 0000000000000..1dbe2944b8ae5 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getSyntacticClassifications.ts @@ -0,0 +1,35 @@ +/// + +//// // comment +//// module M { +//// var v = 0 + 1; +//// var s = "string"; +//// +//// class C { +//// } +//// +//// enum E { +//// } +//// +//// interface I { +//// } +//// +//// module M1.M2 { +//// } +//// } + +var c = classification; +verify.syntacticClassificationsAre( + c.comment("// comment"), + c.keyword("module"), c.moduleName("M"), c.punctuation("{"), + c.keyword("var"), c.identifier("v"), c.operator("="), c.numericLiteral("0"), c.operator("+"), c.numericLiteral("1"), c.punctuation(";"), + c.keyword("var"), c.identifier("s"), c.operator("="), c.stringLiteral('"string"'), c.punctuation(";"), + c.keyword("class"), c.className("C"), c.punctuation("<"), c.typeParameterName("T"), c.punctuation(">"), c.punctuation("{"), + c.punctuation("}"), + c.keyword("enum"), c.enumName("E"), c.punctuation("{"), + c.punctuation("}"), + c.keyword("interface"), c.interfaceName("I"), c.punctuation("{"), + c.punctuation("}"), + c.keyword("module"), c.moduleName("M1"), c.punctuation("."), c.moduleName("M2"), c.punctuation("{"), + c.punctuation("}"), + c.punctuation("}")); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getTodoComments.ts b/tests/cases/fourslash/shims-pp/getTodoComments.ts new file mode 100644 index 0000000000000..b1e0086b93f7b --- /dev/null +++ b/tests/cases/fourslash/shims-pp/getTodoComments.ts @@ -0,0 +1,3 @@ +//// // [|TODO|] + +verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/goToTypeDefinition.ts b/tests/cases/fourslash/shims-pp/goToTypeDefinition.ts new file mode 100644 index 0000000000000..6b34e7e48866c --- /dev/null +++ b/tests/cases/fourslash/shims-pp/goToTypeDefinition.ts @@ -0,0 +1,14 @@ +/// + +// @Filename: goToTypeDefinition_Definition.ts +/////*definition*/class C { +//// p; +////} +////var c: C; + +// @Filename: goToTypeDefinition_Consumption.ts +/////*reference*/c = undefined; + +goTo.marker('reference'); +goTo.type(); +verify.caretAtMarker('definition'); diff --git a/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVar.ts b/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVar.ts new file mode 100644 index 0000000000000..234c23277b6a0 --- /dev/null +++ b/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVar.ts @@ -0,0 +1,86 @@ +/// + +////var /*1*/a = 10; +////function foo() { +//// var /*2*/b = /*3*/a; +////} +////module m { +//// var /*4*/c = 10; +//// export var /*5*/d = 10; +////} +////var /*6*/f: () => number; +////var /*7*/g = /*8*/f; +/////*9*/f(); +////var /*10*/h: { (a: string): number; (a: number): string; }; +////var /*11*/i = /*12*/h; +/////*13*/h(10); +/////*14*/h("hello"); + +var marker = 0; +function verifyVar(name: string, typeDisplay: ts.SymbolDisplayPart[], optionalNameDisplay?: ts.SymbolDisplayPart[], optionalKindModifiers?: string) { + marker++; + goTo.marker(marker.toString()); + var kind = "var"; + verify.verifyQuickInfoDisplayParts(kind, optionalKindModifiers || "", { start: test.markerByName(marker.toString()).position, length: name.length }, + [{ text: kind, kind: "keyword" }, + { text: " ", kind: "space" }].concat(optionalNameDisplay || [{ text: name, kind: "localName" }]).concat( + { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }).concat(typeDisplay), + []); +} +function verifyLocalVar(name: string, typeDisplay: ts.SymbolDisplayPart[], optionalNameDisplay?: ts.SymbolDisplayPart[], optionalKindModifiers?: string) { + marker++; + goTo.marker(marker.toString()); + var kind = "local var"; + verify.verifyQuickInfoDisplayParts(kind, optionalKindModifiers || "", { start: test.markerByName(marker.toString()).position, length: name.length }, + [{ text: "(", kind: "punctuation" }, { text: kind, kind: "text" }, { text: ")", kind: "punctuation" }, + { text: " ", kind: "space" }].concat(optionalNameDisplay || [{ text: name, kind: "localName" }]).concat( + { text: ":", kind: "punctuation" }, { text: " ", kind: "space" }).concat(typeDisplay), + []); +} + +var numberTypeDisplay: ts.SymbolDisplayPart[] = [{ text: "number", kind: "keyword" }]; + +verifyVar("a", numberTypeDisplay); +verifyLocalVar("b", numberTypeDisplay); +verifyVar("a", numberTypeDisplay); +verifyVar("c", numberTypeDisplay); +verifyVar("d", numberTypeDisplay, [{ text: "m", kind: "moduleName" }, { text: ".", kind: "punctuation" }, { text: "d", kind: "localName" }], "export"); + +var functionTypeReturningNumber: ts.SymbolDisplayPart[] = [{ text: "(", kind: "punctuation" }, { text: ")", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: "=>", kind: "punctuation" }, { text: " ", kind: "space" }, { text: "number", kind: "keyword" }]; +verifyVar("f", functionTypeReturningNumber); +verifyVar("g", functionTypeReturningNumber); +verifyVar("f", functionTypeReturningNumber); +verifyVar("f", functionTypeReturningNumber); + + +function getFunctionType(parametertype: string, returnType: string, isArrow?: boolean): ts.SymbolDisplayPart[] { + var functionTypeDisplay = [{ text: "(", kind: "punctuation" }, { text: "a", kind: "parameterName" }, { text: ":", kind: "punctuation" }, + { text: " ", kind: "space" }, { text: parametertype, kind: "keyword" }, { text: ")", kind: "punctuation" }]; + + if (isArrow) { + functionTypeDisplay = functionTypeDisplay.concat({ text: " ", kind: "space" }, { text: "=>", kind: "punctuation" }); + } + else { + functionTypeDisplay = functionTypeDisplay.concat({ text: ":", kind: "punctuation" }); + } + + return functionTypeDisplay.concat({ text: " ", kind: "space" }, { text: returnType, kind: "keyword" }); +} + +var typeLiteralWithOverloadCall: ts.SymbolDisplayPart[] = [{ text: "{", kind: "punctuation" }, { text: "\n", kind: "lineBreak" }, + { text: " ", kind: "space" }].concat(getFunctionType("string", "number")).concat( + { text: ";", kind: "punctuation" }, { text: "\n", kind: "lineBreak" }, + { text: " ", kind: "space" }).concat(getFunctionType("number", "string")).concat( + { text: ";", kind: "punctuation" }, { text: "\n", kind: "lineBreak" }, { text: "}", kind: "punctuation" }); + +verifyVar("h", typeLiteralWithOverloadCall); +verifyVar("i", typeLiteralWithOverloadCall); +verifyVar("h", typeLiteralWithOverloadCall); + +var overloadDisplay: ts.SymbolDisplayPart[] = [{ text: " ", kind: "space" }, { text: "(", kind: "punctuation" }, + { text: "+", kind: "operator" }, { text: "1", kind: "numericLiteral" }, + { text: " ", kind: "space" }, { text: "overload", kind: "text" }, { text: ")", kind: "punctuation" }]; + +verifyVar("h", getFunctionType("number", "string", /*isArrow*/true).concat(overloadDisplay)); +verifyVar("h", getFunctionType("string", "number", /*isArrow*/true).concat(overloadDisplay)); \ No newline at end of file diff --git a/tests/cases/fourslash/tsxFormatting1.ts b/tests/cases/fourslash/tsxFormatting1.ts new file mode 100644 index 0000000000000..84ec6d09720ef --- /dev/null +++ b/tests/cases/fourslash/tsxFormatting1.ts @@ -0,0 +1,15 @@ +/// + +//@Filename: foo.tsx +//// /**/var CommentBox = React.createClass({ +//// render: function() { +//// return ( +////
+//// Hello, world! I am a CommentBox +////
+//// ) +//// } +//// }); + +goTo.marker(); +format.document(); diff --git a/tests/cases/fourslash/tsxRename5.ts b/tests/cases/fourslash/tsxRename5.ts new file mode 100644 index 0000000000000..cc18d6287c3bf --- /dev/null +++ b/tests/cases/fourslash/tsxRename5.ts @@ -0,0 +1,20 @@ +/// + +//@Filename: file.tsx +//// declare module JSX { +//// interface Element { } +//// interface IntrinsicElements { +//// } +//// interface ElementAttributesProperty { props } +//// } +//// class MyClass { +//// props: { +//// name?: string; +//// size?: number; +//// } +//// +//// var [|nn|]: string; +//// var x = ; + +goTo.marker(); +verify.renameLocations(false, false); diff --git a/tests/cases/unittests/cachingInServerLSHost.ts b/tests/cases/unittests/cachingInServerLSHost.ts new file mode 100644 index 0000000000000..ff2da76ba4f13 --- /dev/null +++ b/tests/cases/unittests/cachingInServerLSHost.ts @@ -0,0 +1,206 @@ +/// + +module ts { + interface File { + name: string; + content: string; + } + + function createDefaultServerHost(fileMap: Map): server.ServerHost { + return { + args: [], + newLine: "\r\n", + useCaseSensitiveFileNames: false, + write: (s: string) => { + }, + readFile: (path: string, encoding?: string): string => { + return hasProperty(fileMap, path) && fileMap[path].content; + }, + writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => { + throw new Error("NYI"); + }, + resolvePath: (path: string): string => { + throw new Error("NYI"); + }, + fileExists: (path: string): boolean => { + return hasProperty(fileMap, path); + }, + directoryExists: (path: string): boolean => { + throw new Error("NYI"); + }, + createDirectory: (path: string) => { + }, + getExecutingFilePath: (): string => { + return ""; + }, + getCurrentDirectory: (): string => { + return ""; + }, + readDirectory: (path: string, extension?: string, exclude?: string[]): string[] => { + throw new Error("NYI"); + }, + exit: (exitCode?: number) => { + }, + watchFile: (path, callback) => { + return { + close: () => { } + } + } + }; + } + + function createProject(rootFile: string, serverHost: server.ServerHost): { project: server.Project, rootScriptInfo: server.ScriptInfo } { + let logger: server.Logger = { + close() { }, + isVerbose: () => false, + loggingEnabled: () => false, + perftrc: (s: string) => { }, + info: (s: string) => { }, + startGroup: () => { }, + endGroup: () => { }, + msg: (s: string, type?: string) => { } + }; + + let projectService = new server.ProjectService(serverHost, logger); + let rootScriptInfo = projectService.openFile(rootFile, /* openedByClient */true); + let project = projectService.createInferredProject(rootScriptInfo); + project.setProjectOptions( {files: [rootScriptInfo.fileName], compilerOptions: {module: ts.ModuleKind.AMD} } ); + return { + project, + rootScriptInfo + }; + } + + describe("Caching in LSHost", () => { + it("works using legacy resolution logic", () => { + let root: File = { + name: "c:/d/f0.ts", + content: `import {x} from "f1"` + }; + + let imported: File = { + name: "c:/f1.ts", + content: `foo()` + }; + + let serverHost = createDefaultServerHost({ [root.name]: root, [imported.name]: imported }); + let { project, rootScriptInfo } = createProject(root.name, serverHost); + + // ensure that imported file was found + let diags = project.compilerService.languageService.getSemanticDiagnostics(imported.name); + assert.equal(diags.length, 1); + + let originalFileExists = serverHost.fileExists; + { + // patch fileExists to make sure that disk is not touched + serverHost.fileExists = (fileName): boolean => { + assert.isTrue(false, "fileExists should not be called"); + return false; + }; + + let newContent = `import {x} from "f1" + var x: string = 1;`; + rootScriptInfo.editContent(0, rootScriptInfo.content.length, newContent); + // trigger synchronization to make sure that import will be fetched from the cache + diags = project.compilerService.languageService.getSemanticDiagnostics(imported.name); + // ensure file has correct number of errors after edit + assert.equal(diags.length, 1); + } + { + let fileExistsIsCalled = false; + serverHost.fileExists = (fileName): boolean => { + if (fileName === "lib.d.ts") { + return false; + } + fileExistsIsCalled = true; + assert.isTrue(fileName.indexOf('/f2.') !== -1); + return originalFileExists(fileName); + }; + let newContent = `import {x} from "f2"`; + rootScriptInfo.editContent(0, rootScriptInfo.content.length, newContent); + + try { + // trigger synchronization to make sure that LSHost will try to find 'f2' module on disk + project.compilerService.languageService.getSemanticDiagnostics(imported.name); + assert.isTrue(false, `should not find file '${imported.name}'`) + } + catch(e) { + assert.isTrue(e.message.indexOf(`Could not find file: '${imported.name}'.`) === 0); + } + + assert.isTrue(fileExistsIsCalled); + } + { + let fileExistsCalled = false; + serverHost.fileExists = (fileName): boolean => { + if (fileName === "lib.d.ts") { + return false; + } + fileExistsCalled = true; + assert.isTrue(fileName.indexOf('/f1.') !== -1); + return originalFileExists(fileName); + }; + + let newContent = `import {x} from "f1"`; + rootScriptInfo.editContent(0, rootScriptInfo.content.length, newContent); + project.compilerService.languageService.getSemanticDiagnostics(imported.name); + assert.isTrue(fileExistsCalled); + + // setting compiler options discards module resolution cache + fileExistsCalled = false; + + let opts = ts.clone(project.projectOptions); + opts.compilerOptions = ts.clone(opts.compilerOptions); + opts.compilerOptions.target = ts.ScriptTarget.ES5; + project.setProjectOptions(opts); + + project.compilerService.languageService.getSemanticDiagnostics(imported.name); + assert.isTrue(fileExistsCalled); + } + }); + + it("loads missing files from disk", () => { + let root: File = { + name: 'c:/foo.ts', + content: `import {x} from "bar"` + }; + + let imported: File = { + name: 'c:/bar.d.ts', + content: `export var y = 1` + }; + + let fileMap: Map = { [root.name]: root }; + let serverHost = createDefaultServerHost(fileMap); + let originalFileExists = serverHost.fileExists; + + let fileExistsCalledForBar = false; + serverHost.fileExists = fileName => { + if (fileName === "lib.d.ts") { + return false; + } + if (!fileExistsCalledForBar) { + fileExistsCalledForBar = fileName.indexOf("/bar.") !== -1; + } + + return originalFileExists(fileName); + }; + + let { project, rootScriptInfo } = createProject(root.name, serverHost); + + let diags = project.compilerService.languageService.getSemanticDiagnostics(root.name); + assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called"); + assert.isTrue(diags.length === 1, "one diagnostic expected"); + assert.isTrue(typeof diags[0].messageText === "string" && ((diags[0].messageText).indexOf("Cannot find module") === 0), "should be 'cannot find module' message"); + + // assert that import will success once file appear on disk + fileMap[imported.name] = imported; + fileExistsCalledForBar = false; + rootScriptInfo.editContent(0, rootScriptInfo.content.length, `import {y} from "bar"`) + + diags = project.compilerService.languageService.getSemanticDiagnostics(root.name); + assert.isTrue(fileExistsCalledForBar, "'fileExists' should be called"); + assert.isTrue(diags.length === 0); + }) + }); +} \ No newline at end of file diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts new file mode 100644 index 0000000000000..0917e72f1ce4d --- /dev/null +++ b/tests/cases/unittests/moduleResolution.ts @@ -0,0 +1,221 @@ +/// +/// + +declare namespace chai.assert { + function deepEqual(actual: any, expected: any): void; +} + +module ts { + + interface File { + name: string + content?: string + } + + function createModuleResolutionHost(...files: File[]): ModuleResolutionHost { + let map = arrayToMap(files, f => f.name); + + return { fileExists, readFile }; + + function fileExists(path: string): boolean { + return hasProperty(map, path); + } + + function readFile(path: string): string { + return hasProperty(map, path) ? map[path].content : undefined; + } + } + + function splitPath(path: string): { dir: string; rel: string } { + let index = path.indexOf(directorySeparator); + return index === -1 + ? { dir: path, rel: undefined } + : { dir: path.substr(0, index), rel: path.substr(index + 1) }; + } + + describe("Node module resolution - relative paths", () => { + + function testLoadAsFile(containingFileName: string, moduleFileNameNoExt: string, moduleName: string): void { + for (let ext of supportedExtensions) { + let containingFile = { name: containingFileName } + let moduleFile = { name: moduleFileNameNoExt + ext } + let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); + assert.equal(resolution.resolvedFileName, moduleFile.name); + + let failedLookupLocations: string[] = []; + let dir = getDirectoryPath(containingFileName); + for (let e of supportedExtensions) { + if (e === ext) { + break; + } + else { + failedLookupLocations.push(normalizePath(getRootLength(moduleName) === 0 ? combinePaths(dir, moduleName) : moduleName) + e); + } + } + + assert.deepEqual(resolution.failedLookupLocations, failedLookupLocations); + } + } + + it("module name that starts with './' resolved as relative file name", () => { + testLoadAsFile("/foo/bar/baz.ts", "/foo/bar/foo", "./foo"); + }); + + it("module name that starts with '../' resolved as relative file name", () => { + testLoadAsFile("/foo/bar/baz.ts", "/foo/foo", "../foo"); + }); + + it("module name that starts with '/' script extension resolved as relative file name", () => { + testLoadAsFile("/foo/bar/baz.ts", "/foo", "/foo"); + }); + + it("module name that starts with 'c:/' script extension resolved as relative file name", () => { + testLoadAsFile("c:/foo/bar/baz.ts", "c:/foo", "c:/foo"); + }); + + function testLoadingFromPackageJson(containingFileName: string, packageJsonFileName: string, fieldRef: string, moduleFileName: string, moduleName: string): void { + let containingFile = { name: containingFileName }; + let packageJson = { name: packageJsonFileName, content: JSON.stringify({ "typings": fieldRef }) }; + let moduleFile = { name: moduleFileName }; + let resolution = nodeModuleNameResolver(moduleName, containingFile.name, createModuleResolutionHost(containingFile, packageJson, moduleFile)); + assert.equal(resolution.resolvedFileName, moduleFile.name); + // expect three failed lookup location - attempt to load module as file with all supported extensions + assert.equal(resolution.failedLookupLocations.length, 3); + } + + it("module name as directory - load from typings", () => { + testLoadingFromPackageJson("/a/b/c/d.ts", "/a/b/c/bar/package.json", "c/d/e.d.ts", "/a/b/c/bar/c/d/e.d.ts", "./bar"); + testLoadingFromPackageJson("/a/b/c/d.ts", "/a/bar/package.json", "e.d.ts", "/a/bar/e.d.ts", "../../bar"); + testLoadingFromPackageJson("/a/b/c/d.ts", "/bar/package.json", "e.d.ts", "/bar/e.d.ts", "/bar"); + testLoadingFromPackageJson("c:/a/b/c/d.ts", "c:/bar/package.json", "e.d.ts", "c:/bar/e.d.ts", "c:/bar"); + }); + + it ("module name as directory - load index.d.ts", () => { + let containingFile = {name: "/a/b/c.ts"}; + let packageJson = {name: "/a/b/foo/package.json", content: JSON.stringify({main: "/c/d"})}; + let indexFile = { name: "/a/b/foo/index.d.ts" }; + let resolution = nodeModuleNameResolver("./foo", containingFile.name, createModuleResolutionHost(containingFile, packageJson, indexFile)); + assert.equal(resolution.resolvedFileName, indexFile.name); + assert.deepEqual(resolution.failedLookupLocations, [ + "/a/b/foo.ts", + "/a/b/foo.tsx", + "/a/b/foo.d.ts", + "/a/b/foo/index.ts", + "/a/b/foo/index.tsx", + ]); + }); + }); + + describe("Node module resolution - non-relative paths", () => { + it("load module as file - ts files not loaded", () => { + let containingFile = { name: "/a/b/c/d/e.ts" }; + let moduleFile = { name: "/a/b/node_modules/foo.ts" }; + let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); + assert.equal(resolution.resolvedFileName, undefined); + assert.deepEqual(resolution.failedLookupLocations, [ + "/a/b/c/d/node_modules/foo.d.ts", + "/a/b/c/d/node_modules/foo/package.json", + "/a/b/c/d/node_modules/foo/index.d.ts", + "/a/b/c/node_modules/foo.d.ts", + "/a/b/c/node_modules/foo/package.json", + "/a/b/c/node_modules/foo/index.d.ts", + "/a/b/node_modules/foo.d.ts", + "/a/b/node_modules/foo/package.json", + "/a/b/node_modules/foo/index.d.ts", + "/a/node_modules/foo.d.ts", + "/a/node_modules/foo/package.json", + "/a/node_modules/foo/index.d.ts", + "/node_modules/foo.d.ts", + "/node_modules/foo/package.json", + "/node_modules/foo/index.d.ts" + ]) + }); + + it("load module as file", () => { + let containingFile = { name: "/a/b/c/d/e.ts" }; + let moduleFile = { name: "/a/b/node_modules/foo.d.ts" }; + let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); + assert.equal(resolution.resolvedFileName, moduleFile.name); + }); + + it("load module as directory", () => { + let containingFile = { name: "/a/node_modules/b/c/node_modules/d/e.ts" }; + let moduleFile = { name: "/a/node_modules/foo/index.d.ts" }; + let resolution = nodeModuleNameResolver("foo", containingFile.name, createModuleResolutionHost(containingFile, moduleFile)); + assert.equal(resolution.resolvedFileName, moduleFile.name); + assert.deepEqual(resolution.failedLookupLocations, [ + "/a/node_modules/b/c/node_modules/d/node_modules/foo.d.ts", + "/a/node_modules/b/c/node_modules/d/node_modules/foo/package.json", + "/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts", + "/a/node_modules/b/c/node_modules/foo.d.ts", + "/a/node_modules/b/c/node_modules/foo/package.json", + "/a/node_modules/b/c/node_modules/foo/index.d.ts", + "/a/node_modules/b/node_modules/foo.d.ts", + "/a/node_modules/b/node_modules/foo/package.json", + "/a/node_modules/b/node_modules/foo/index.d.ts", + "/a/node_modules/foo.d.ts", + "/a/node_modules/foo/package.json" + ]); + }); + }); + + describe("BaseUrl mode", () => { + + it ("load module as relative url", () => { + function test(containingFileName: string, moduleFileName: string, moduleName: string): void { + let containingFile = {name: containingFileName }; + let moduleFile = { name: moduleFileName }; + let resolution = baseUrlModuleNameResolver(moduleName, containingFile.name, "", createModuleResolutionHost(containingFile, moduleFile)); + assert.equal(resolution.resolvedFileName, moduleFile.name); + let expectedFailedLookupLocations: string[] = []; + + let moduleNameHasExt = forEach(supportedExtensions, e => fileExtensionIs(moduleName, e)); + if (!moduleNameHasExt) { + let dir = getDirectoryPath(containingFileName); + + // add candidates with extensions that precede extension of the actual module name file in the list of supportd extensions + for (let ext of supportedExtensions) { + + let hasExtension = ext !== ".ts" + ? fileExtensionIs(moduleFileName, ext) + : fileExtensionIs(moduleFileName, ".ts") && !fileExtensionIs(moduleFileName, ".d.ts"); + + if (hasExtension) { + break; + } + else { + expectedFailedLookupLocations.push(normalizePath(combinePaths(dir, moduleName + ext))); + } + } + } + + assert.deepEqual(resolution.failedLookupLocations, expectedFailedLookupLocations) + } + + test("/a/b/c/d.ts", "/foo.ts", "/foo"); + test("/a/b/c/d.ts", "/foo.d.ts", "/foo"); + test("/a/b/c/d.ts", "/foo.tsx", "/foo"); + + test("/a/b/c/d.ts", "/a/b/c/foo.ts", "./foo"); + test("/a/b/c/d.ts", "/a/b/c/foo.d.ts", "./foo"); + test("/a/b/c/d.ts", "/a/b/c/foo.tsx", "./foo"); + + test("/a/b/c/d.ts", "/a/b/foo.ts", "../foo"); + test("/a/b/c/d.ts", "/a/b/foo.d.ts", "../foo"); + test("/a/b/c/d.ts", "/a/b/foo.tsx", "../foo"); + }); + + it ("load module using base url", () => { + function test(containingFileName: string, moduleFileName: string, moduleName: string, baseUrl: string): void { + let containingFile = { name: containingFileName }; + let moduleFile = { name: moduleFileName }; + let resolution = baseUrlModuleNameResolver(moduleName, containingFileName, baseUrl, createModuleResolutionHost(containingFile, moduleFile)); + assert.equal(resolution.resolvedFileName, moduleFile.name); + } + + test("/a/base/c/d.ts", "/a/base/c/d/e.ts", "c/d/e", "/a/base"); + test("/a/base/c/d.ts", "/a/base/c/d/e.d.ts", "c/d/e", "/a/base"); + test("/a/base/c/d.ts", "/a/base/c/d/e.tsx", "c/d/e", "/a/base"); + }); + }); +} \ No newline at end of file diff --git a/tests/cases/unittests/reuseProgramStructure.ts b/tests/cases/unittests/reuseProgramStructure.ts new file mode 100644 index 0000000000000..6c043299c8f15 --- /dev/null +++ b/tests/cases/unittests/reuseProgramStructure.ts @@ -0,0 +1,262 @@ +/// +/// +/// + +module ts { + + const enum ChangedPart { + references = 1 << 0, + importsAndExports = 1 << 1, + program = 1 << 2 + } + + let newLine = "\r\n"; + + interface SourceFileWithText extends SourceFile { + sourceText?: SourceText; + } + + interface NamedSourceText { + name: string; + text: SourceText + } + + interface ProgramWithSourceTexts extends Program { + sourceTexts?: NamedSourceText[]; + } + + class SourceText implements IScriptSnapshot { + private fullText: string; + + constructor(private references: string, + private importsAndExports: string, + private program: string, + private changedPart: ChangedPart = 0, + private version = 0) { + } + + static New(references: string, importsAndExports: string, program: string): SourceText { + Debug.assert(references !== undefined); + Debug.assert(importsAndExports !== undefined); + Debug.assert(program !== undefined); + return new SourceText(references + newLine, importsAndExports + newLine, program || ""); + } + + public getVersion(): number { + return this.version; + } + + public updateReferences(newReferences: string): SourceText { + Debug.assert(newReferences !== undefined); + return new SourceText(newReferences + newLine, this.importsAndExports, this.program, this.changedPart | ChangedPart.references, this.version + 1); + } + public updateImportsAndExports(newImportsAndExports: string): SourceText { + Debug.assert(newImportsAndExports !== undefined); + return new SourceText(this.references, newImportsAndExports + newLine, this.program, this.changedPart | ChangedPart.importsAndExports, this.version + 1); + } + public updateProgram(newProgram: string): SourceText { + Debug.assert(newProgram !== undefined); + return new SourceText(this.references, this.importsAndExports, newProgram, this.changedPart | ChangedPart.program, this.version + 1); + } + + public getFullText() { + return this.fullText || (this.fullText = this.references + this.importsAndExports + this.program); + } + + public getText(start: number, end: number): string { + return this.getFullText().substring(start, end); + } + + getLength(): number { + return this.getFullText().length; + } + + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange { + var oldText = oldSnapshot; + var oldSpan: TextSpan; + var newLength: number; + switch (oldText.changedPart ^ this.changedPart) { + case ChangedPart.references: + oldSpan = createTextSpan(0, oldText.references.length); + newLength = this.references.length; + break; + case ChangedPart.importsAndExports: + oldSpan = createTextSpan(oldText.references.length, oldText.importsAndExports.length); + newLength = this.importsAndExports.length + break; + case ChangedPart.program: + oldSpan = createTextSpan(oldText.references.length + oldText.importsAndExports.length, oldText.program.length); + newLength = this.program.length; + break; + default: + Debug.assert(false, "Unexpected change"); + } + + return createTextChangeRange(oldSpan, newLength); + } + } + + function createTestCompilerHost(texts: NamedSourceText[], target: ScriptTarget): CompilerHost { + let files: Map = {}; + for (let t of texts) { + let file = createSourceFile(t.name, t.text.getFullText(), target); + file.sourceText = t.text; + files[t.name] = file; + } + + return { + getSourceFile(fileName): SourceFile { + return files[fileName]; + }, + getDefaultLibFileName(): string { + return "lib.d.ts" + }, + writeFile(file, text) { + throw new Error("NYI"); + }, + getCurrentDirectory(): string { + return ""; + }, + getCanonicalFileName(fileName): string { + return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + }, + useCaseSensitiveFileNames(): boolean { + return sys.useCaseSensitiveFileNames; + }, + getNewLine(): string { + return sys.newLine; + }, + fileExists: fileName => hasProperty(files, fileName), + readFile: fileName => { + let file = lookUp(files, fileName); + return file && file.text; + } + } + } + + function newProgram(texts: NamedSourceText[], rootNames: string[], options: CompilerOptions): Program { + var host = createTestCompilerHost(texts, options.target); + let program = createProgram(rootNames, options, host); + program.sourceTexts = texts; + return program; + } + + function updateProgram(oldProgram: Program, rootNames: string[], options: CompilerOptions, updater: (files: NamedSourceText[]) => void) { + var texts: NamedSourceText[] = (oldProgram).sourceTexts.slice(0); + updater(texts); + var host = createTestCompilerHost(texts, options.target); + var program = createProgram(rootNames, options, host, oldProgram); + program.sourceTexts = texts; + return program; + } + + function getSizeOfMap(map: Map): number { + let size = 0; + for (let id in map) { + if (hasProperty(map, id)) { + size++; + } + } + return size; + } + + function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map): void { + let file = program.getSourceFile(fileName); + assert.isTrue(file !== undefined, `cannot find file ${fileName}`); + if (expectedContent === undefined) { + assert.isTrue(file.resolvedModules === undefined, "expected resolvedModules to be undefined"); + } + else { + assert.isTrue(file.resolvedModules !== undefined, "expected resolvedModuled to be set"); + let actualCacheSize = getSizeOfMap(file.resolvedModules); + let expectedSize = getSizeOfMap(expectedContent); + assert.isTrue(actualCacheSize === expectedSize, `expected actual size: ${actualCacheSize} to be equal to ${expectedSize}`); + + for (let id in expectedContent) { + if (hasProperty(expectedContent, id)) { + assert.isTrue(hasProperty(file.resolvedModules, id), `expected ${id} to be found in resolved modules`); + assert.isTrue(expectedContent[id] === file.resolvedModules[id], `expected '${expectedContent[id]}' to be equal to '${file.resolvedModules[id]}'`); + } + } + } + } + + describe("Reuse program structure", () => { + let target = ScriptTarget.Latest; + let files = [ + { name: "a.ts", text: SourceText.New(`/// `, "", `var x = 1`) }, + { name: "b.ts", text: SourceText.New(`/// `, "", `var y = 2`) }, + { name: "c.ts", text: SourceText.New("", "", `var z = 1;`) }, + ] + + it("successful if change does not affect imports", () => { + var program_1 = newProgram(files, ["a.ts"], { target }); + var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { + files[0].text = files[0].text.updateProgram("var x = 100"); + }); + assert.isTrue(program_1.structureIsReused); + }); + + it("fails if change affects tripleslash references", () => { + var program_1 = newProgram(files, ["a.ts"], { target }); + var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { + let newReferences = `/// + /// + `; + files[0].text = files[0].text.updateReferences(newReferences); + }); + assert.isTrue(!program_1.structureIsReused); + }); + + it("fails if change affects imports", () => { + var program_1 = newProgram(files, ["a.ts"], { target }); + var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => { + files[2].text = files[2].text.updateImportsAndExports("import x from 'b'"); + }); + assert.isTrue(!program_1.structureIsReused); + }); + + it("fails if module kind changes", () => { + var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS }); + var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, files => void 0); + assert.isTrue(!program_1.structureIsReused); + }); + + it("resolution cache follows imports", () => { + let files = [ + { name: "a.ts", text: SourceText.New("", "import {_} from 'b'", "var x = 1") }, + { name: "b.ts", text: SourceText.New("", "", "var y = 2") }, + ]; + var options: CompilerOptions = { target }; + + var program_1 = newProgram(files, ["a.ts"], options); + checkResolvedModulesCache(program_1, "a.ts", { "b": "b.ts" }); + checkResolvedModulesCache(program_1, "b.ts", undefined); + + var program_2 = updateProgram(program_1, ["a.ts"], options, files => { + files[0].text = files[0].text.updateProgram("var x = 2"); + }); + assert.isTrue(program_1.structureIsReused); + + // content of resolution cache should not change + checkResolvedModulesCache(program_1, "a.ts", { "b": "b.ts" }); + checkResolvedModulesCache(program_1, "b.ts", undefined); + + // imports has changed - program is not reused + var program_3 = updateProgram(program_2, ["a.ts"], options, files => { + files[0].text = files[0].text.updateImportsAndExports(""); + }); + assert.isTrue(!program_2.structureIsReused); + checkResolvedModulesCache(program_3, "a.ts", undefined); + + var program_4 = updateProgram(program_3, ["a.ts"], options, files => { + let newImports = `import x from 'b' + import y from 'c' + `; + files[0].text = files[0].text.updateImportsAndExports(newImports); + }); + assert.isTrue(!program_3.structureIsReused); + checkResolvedModulesCache(program_4, "a.ts", { "b": "b.ts", "c": undefined }); + }); + }) +} \ No newline at end of file diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts index da1fa91036c94..82f2e106aa4b4 100644 --- a/tests/cases/unittests/services/colorization.ts +++ b/tests/cases/unittests/services/colorization.ts @@ -9,8 +9,8 @@ interface ClassificationEntry { describe('Colorization', function () { // Use the shim adapter to ensure test coverage of the shim layer for the classifier - var languageServiceAdabtor = new Harness.LanguageService.ShimLanugageServiceAdapter(); - var classifier = languageServiceAdabtor.getClassifier(); + var languageServiceAdapter = new Harness.LanguageService.ShimLanugageServiceAdapter(/*preprocessToResolve*/ false); + var classifier = languageServiceAdapter.getClassifier(); function getEntryAtPosistion(result: ts.ClassificationResult, position: number) { var entryPosition = 0; diff --git a/tests/cases/unittests/services/documentRegistry.ts b/tests/cases/unittests/services/documentRegistry.ts index 8fc466b857f0e..50a144d305653 100644 --- a/tests/cases/unittests/services/documentRegistry.ts +++ b/tests/cases/unittests/services/documentRegistry.ts @@ -30,10 +30,15 @@ describe("DocumentRegistry", () => { assert(f1 !== f3, "Changed target: Expected to have different instances of document"); - compilerOptions.module = ts.ModuleKind.CommonJS; + compilerOptions.preserveConstEnums = true; var f4 = documentRegistry.acquireDocument("file1.ts", compilerOptions, ts.ScriptSnapshot.fromString("var x = 1;"), /* version */ "1"); - assert(f3 === f4, "Changed module: Expected to have the same instance of the document"); + assert(f3 === f4, "Changed preserveConstEnums: Expected to have the same instance of the document"); + + compilerOptions.module = ts.ModuleKind.System; + var f5 = documentRegistry.acquireDocument("file1.ts", compilerOptions, ts.ScriptSnapshot.fromString("var x = 1;"), /* version */ "1"); + + assert(f4 !== f5, "Changed module: Expected to have different instances of the document"); }); it("Acquiring document gets correct version 1", () => { diff --git a/tests/cases/unittests/services/preProcessFile.ts b/tests/cases/unittests/services/preProcessFile.ts index c504f444f18fa..982c45f0f2d5e 100644 --- a/tests/cases/unittests/services/preProcessFile.ts +++ b/tests/cases/unittests/services/preProcessFile.ts @@ -50,6 +50,7 @@ describe('PreProcessFile:', function () { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 37 }, { fileName: "refFile2.ts", pos: 38, end: 73 }, { fileName: "refFile3.ts", pos: 74, end: 109 }, { fileName: "..\\refFile4d.ts", pos: 110, end: 150 }], importedFiles: [], + ambientExternalModules: undefined, isLibFile: false }); }), @@ -59,6 +60,7 @@ describe('PreProcessFile:', function () { { referencedFiles: [], importedFiles: [], + ambientExternalModules: undefined, isLibFile: false }); }), @@ -69,6 +71,7 @@ describe('PreProcessFile:', function () { referencedFiles: [], importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 }, { fileName: "r4.ts", pos: 106, end: 111 }, { fileName: "r5.ts", pos: 138, end: 143 }], + ambientExternalModules: undefined, isLibFile: false }); }), @@ -78,6 +81,7 @@ describe('PreProcessFile:', function () { { referencedFiles: [], importedFiles: [], + ambientExternalModules: undefined, isLibFile: false }); }), @@ -87,6 +91,7 @@ describe('PreProcessFile:', function () { { referencedFiles: [], importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }], + ambientExternalModules: undefined, isLibFile: false }); }), @@ -96,6 +101,7 @@ describe('PreProcessFile:', function () { { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }, { fileName: "refFile2.ts", pos: 36, end: 71 }], importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }], + ambientExternalModules: undefined, isLibFile: false }); }), @@ -105,6 +111,7 @@ describe('PreProcessFile:', function () { { referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }], importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }], + ambientExternalModules: undefined, isLibFile: false }) }); @@ -129,6 +136,7 @@ describe('PreProcessFile:', function () { { fileName: "m6", pos: 160, end: 162 }, { fileName: "m7", pos: 199, end: 201 } ], + ambientExternalModules: undefined, isLibFile: false }) }); @@ -147,9 +155,24 @@ describe('PreProcessFile:', function () { { fileName: "m3", pos: 63, end: 65 }, { fileName: "m4", pos: 101, end: 103 }, ], + ambientExternalModules: undefined, isLibFile: false }) }); + + it("Correctly return ambient external modules", () => { + test(` + declare module A {} + declare module "B" {} + function foo() { + } + `, false, { + referencedFiles: [], + importedFiles: [], + ambientExternalModules: ["B"], + isLibFile: false + }) + }); }); }); diff --git a/tests/cases/unittests/transpile.ts b/tests/cases/unittests/transpile.ts index 1fd8c860d0197..0b87910d26e49 100644 --- a/tests/cases/unittests/transpile.ts +++ b/tests/cases/unittests/transpile.ts @@ -21,22 +21,36 @@ module ts { } function test(input: string, testSettings: TranspileTestSettings): void { - let diagnostics: Diagnostic[] = []; - let transpileOptions: TranspileOptions = testSettings.options || {}; - let transpileResult = transpile(input, transpileOptions.compilerOptions, transpileOptions.fileName, diagnostics, transpileOptions.moduleName); + let transpileOptions: TranspileOptions = testSettings.options || {}; + if (!transpileOptions.compilerOptions) { + transpileOptions.compilerOptions = {}; + } + if(transpileOptions.compilerOptions.newLine === undefined) { + // use \r\n as default new line + transpileOptions.compilerOptions.newLine = ts.NewLineKind.CarriageReturnLineFeed; + } + + let canUseOldTranspile = !transpileOptions.renamedDependencies; transpileOptions.reportDiagnostics = true; let transpileModuleResult = transpileModule(input, transpileOptions); - checkDiagnostics(diagnostics, testSettings.expectedDiagnosticCodes); checkDiagnostics(transpileModuleResult.diagnostics, testSettings.expectedDiagnosticCodes); if (testSettings.expectedOutput !== undefined) { - assert.equal(transpileResult, testSettings.expectedOutput); assert.equal(transpileModuleResult.outputText, testSettings.expectedOutput); } + if (canUseOldTranspile) { + let diagnostics: Diagnostic[] = []; + let transpileResult = transpile(input, transpileOptions.compilerOptions, transpileOptions.fileName, diagnostics, transpileOptions.moduleName); + checkDiagnostics(diagnostics, testSettings.expectedDiagnosticCodes); + if (testSettings.expectedOutput) { + assert.equal(transpileResult, testSettings.expectedOutput); + } + } + // check source maps if (!transpileOptions.compilerOptions) { transpileOptions.compilerOptions = {}; @@ -138,5 +152,123 @@ var x = 0;`, it("No extra errors for file without extension", () => { test(`var x = 0;`, { options: { compilerOptions: { module: ModuleKind.CommonJS }, fileName: "file" } }); }); + + it("Rename dependencies - System", () => { + let input = + `import {foo} from "SomeName";\n` + + `declare function use(a: any);\n` + + `use(foo);` + let output = + `System.register(["SomeOtherName"], function(exports_1) {\n` + + ` var SomeName_1;\n` + + ` return {\n` + + ` setters:[\n` + + ` function (SomeName_1_1) {\n` + + ` SomeName_1 = SomeName_1_1;\n` + + ` }],\n` + + ` execute: function() {\n` + + ` use(SomeName_1.foo);\n` + + ` }\n` + + ` }\n` + + `});\n` + + test(input, + { + options: { compilerOptions: { module: ModuleKind.System, newLine: NewLineKind.LineFeed }, renamedDependencies: { "SomeName": "SomeOtherName" } }, + expectedOutput: output + }); + }); + + it("Rename dependencies - AMD", () => { + let input = + `import {foo} from "SomeName";\n` + + `declare function use(a: any);\n` + + `use(foo);` + let output = + `define(["require", "exports", "SomeOtherName"], function (require, exports, SomeName_1) {\n` + + ` use(SomeName_1.foo);\n` + + `});\n`; + + test(input, + { + options: { compilerOptions: { module: ModuleKind.AMD, newLine: NewLineKind.LineFeed }, renamedDependencies: { "SomeName": "SomeOtherName" } }, + expectedOutput: output + }); + }); + + it("Rename dependencies - UMD", () => { + let input = + `import {foo} from "SomeName";\n` + + `declare function use(a: any);\n` + + `use(foo);` + let output = + `(function (deps, factory) {\n` + + ` if (typeof module === 'object' && typeof module.exports === 'object') {\n` + + ` var v = factory(require, exports); if (v !== undefined) module.exports = v;\n` + + ` }\n` + + ` else if (typeof define === 'function' && define.amd) {\n` + + ` define(deps, factory);\n` + + ` }\n` + + `})(["require", "exports", "SomeOtherName"], function (require, exports) {\n` + + ` var SomeName_1 = require("SomeOtherName");\n` + + ` use(SomeName_1.foo);\n` + + `});\n`; + + test(input, + { + options: { compilerOptions: { module: ModuleKind.UMD, newLine: NewLineKind.LineFeed }, renamedDependencies: { "SomeName": "SomeOtherName" } }, + expectedOutput: output + }); + }); + + it("Transpile with emit decorators and emit metadata", () => { + let input = + `import {db} from './db';\n` + + `function someDecorator(target) {\n` + + ` return target;\n` + + `} \n` + + `@someDecorator\n` + + `class MyClass {\n` + + ` db: db;\n` + + ` constructor(db: db) {\n` + + ` this.db = db;\n` + + ` this.db.doSomething(); \n` + + ` }\n` + + `}\n` + + `export {MyClass}; \n` + let output = + `var db_1 = require(\'./db\');\n` + + `function someDecorator(target) {\n` + + ` return target;\n` + + `}\n` + + `var MyClass = (function () {\n` + + ` function MyClass(db) {\n` + + ` this.db = db;\n` + + ` this.db.doSomething();\n` + + ` }\n` + + ` MyClass = __decorate([\n` + + ` someDecorator, \n` + + ` __metadata(\'design:paramtypes\', [(typeof (_a = typeof db_1.db !== \'undefined\' && db_1.db) === \'function\' && _a) || Object])\n` + + ` ], MyClass);\n` + + ` return MyClass;\n` + + ` var _a;\n` + + `})();\n` + + `exports.MyClass = MyClass;\n`; + + test(input, + { + options: { + compilerOptions: { + module: ModuleKind.CommonJS, + newLine: NewLineKind.LineFeed, + noEmitHelpers: true, + emitDecoratorMetadata: true, + experimentalDecorators: true, + target: ScriptTarget.ES5, + } + }, + expectedOutput: output + }); + }); }); }